docs/integrations/block-integrations/mcp/block.md
Blocks for connecting to and executing tools on MCP (Model Context Protocol) servers.
<!-- END MANUAL -->Connect to any MCP server and execute its tools. Provide a server URL, select a tool, and pass arguments dynamically.
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 -->| Input | Description | Type | Required |
|---|---|---|---|
| server_url | URL of the MCP server (Streamable HTTP endpoint) | str | Yes |
| selected_tool | The MCP tool to execute | str | No |
| tool_arguments | Arguments to pass to the selected MCP tool. The fields here are defined by the tool's input schema. | Dict[str, Any] | No |
| Output | Description | Type |
|---|---|---|
| error | Error message if the tool call failed | str |
| result | The result returned by the MCP tool | Result |