fix(mcp): Address PR review comments - defensive checks and docs

- Validate token_endpoint in OAuth metadata before accessing it
- Check authorization_servers list is non-empty before indexing
- Use provider_matches() (renamed from private _provider_matches) in
  creds_manager for Python 3.13 StrEnum compatibility
- Fill in MCP block documentation with technical explanation and use cases
This commit is contained in:
Zamil Majdy
2026-02-10 16:42:29 +04:00
parent 84809f4b94
commit 75a7ccf36e
4 changed files with 21 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
# Mcp Block
<!-- MANUAL: file_description -->
_Add a description of this category of blocks._
Blocks for connecting to and executing tools on MCP (Model Context Protocol) servers.
<!-- END MANUAL -->
## MCP Tool
@@ -10,7 +10,9 @@ Connect to any MCP server and execute its tools. Provide a server URL, select a
### How it works
<!-- MANUAL: how_it_works -->
_Add technical explanation here._
The block uses JSON-RPC 2.0 over HTTP to communicate with MCP servers. When configuring, it sends an `initialize` request followed by `tools/list` to discover available tools and their input schemas. On execution, it calls `tools/call` with the selected tool name and arguments, then extracts text, image, or resource content from the response.
Authentication is handled via OAuth 2.0 when the server requires it. The block supports optional credentials — public servers work without authentication, while protected servers trigger a standard OAuth flow with PKCE. Tokens are automatically refreshed when they expire.
<!-- END MANUAL -->
### Inputs
@@ -30,7 +32,9 @@ _Add technical explanation here._
### Possible use case
<!-- MANUAL: use_case -->
_Add practical use case examples here._
- **Connecting to third-party APIs**: Use an MCP server like Sentry or Linear to query issues, create tickets, or manage projects without building custom integrations.
- **AI-powered tool execution**: Chain MCP tool calls with AI blocks to let agents dynamically discover and use external tools based on task requirements.
- **Data retrieval from knowledge bases**: Connect to MCP servers like DeepWiki to search documentation, retrieve code context, or query structured knowledge bases.
<!-- END MANUAL -->
---