The MCP Plugin integrates the Model Context Protocol (MCP) into the Executor ecosystem. It allows the system to act as an MCP host, discovering tools from remote or local MCP servers and exposing them to agents. The plugin supports multiple transport modes, handles complex authentication discovery via a custom probing engine, and provides a specialized React UI for server registration.
The plugin supports three primary transport mechanisms to communicate with MCP servers:
Connections are managed via createMcpConnector packages/plugins/mcp/src/sdk/connection.ts43 In serverless environments, the plugin uses a specialized CfWorkerJsonSchemaValidator instead of the default Ajv to avoid issues with dynamic code generation (new Function) packages/plugins/mcp/src/sdk/connection.ts161-166
Sources: packages/plugins/mcp/src/sdk/connection.ts1-166
The plugin bridges the gap between the Executor's persistent tool catalog and the dynamic nature of MCP servers.
When an MCP integration is added or refreshed, discoverTools is invoked packages/plugins/mcp/src/sdk/discover.ts It performs the following:
initialize JSON-RPC call.tools/list to retrieve the server's capabilities.McpToolManifestEntry objects packages/plugins/mcp/src/sdk/manifest.ts51To maintain tool identity across the system, the plugin "stamps" tool definitions with an mcp envelope in the annotations field packages/plugins/mcp/src/sdk/plugin.ts143-148 This includes:
toolName: The original name of the tool on the MCP server.upstream: Original hints like readOnlyHint or destructiveHint packages/plugins/mcp/src/sdk/plugin.ts152-160The system listens for notifications/tools/list_changed from the server packages/plugins/mcp/src/sdk/invoke.ts143-151 When received, it marks the persisted catalog as stale, triggering a re-sync on the next access.
Sources: packages/plugins/mcp/src/sdk/plugin.ts135-170 packages/plugins/mcp/src/sdk/invoke.ts143-151 packages/plugins/mcp/src/sdk/manifest.ts51
A core feature of the MCP plugin is the probeMcpEndpointShape function packages/plugins/mcp/src/sdk/probe-shape.ts53 This is used during registration to verify if an endpoint is a valid MCP server and determine its authentication requirements.
The probe performs a non-destructive check by sending an initialize JSON-RPC POST request packages/plugins/mcp/src/sdk/probe-shape.ts46-55 It classifies the response into:
WWW-Authenticate: Bearer header and a JSON-RPC error body packages/plugins/mcp/src/sdk/probe-shape.ts23-27/.well-known/oauth-protected-resource packages/plugins/mcp/src/sdk/probe-shape.ts115-131Discovery Logic Diagram
Sources: packages/plugins/mcp/src/sdk/probe-shape.ts1-150
The plugin implements a bridge between the MCP elicit capability and the Executor's internal elicitation engine. This allows an MCP tool to pause execution and request additional information from the user (e.g., via a form or URL).
installElicitationHandler is called packages/plugins/mcp/src/sdk/invoke.ts105ElicitRequestSchema from the MCP server is decoded into McpElicitParams packages/plugins/mcp/src/sdk/invoke.ts75-89ElicitationRequest (either FormElicitation or UrlElicitation) packages/plugins/mcp/src/sdk/invoke.ts93-103action and content format packages/plugins/mcp/src/sdk/invoke.ts114-120Sources: packages/plugins/mcp/src/sdk/invoke.ts71-133
The AddMcpSource component provides a stateful wizard for registering new MCP integrations packages/plugins/mcp/src/react/AddMcpSource.tsx164
remote (HTTP/SSE) or stdio packages/plugins/mcp/src/react/AddMcpSource.tsx179probeEndpoint API, which uses the backend probing logic described above packages/plugins/mcp/src/react/AddMcpSource.tsx38AuthMethodListEditor packages/plugins/mcp/src/react/AddMcpSource.tsx8-12UI Data Flow Diagram
Sources: packages/plugins/mcp/src/react/AddMcpSource.tsx74-158 packages/plugins/mcp/src/api/group.ts135-142
The MCP plugin exposes several management endpoints via the McpGroup packages/plugins/mcp/src/api/group.ts135
| Endpoint | Method | Description |
|---|---|---|
/mcp/probe | POST | Triggers the endpoint shape probe packages/plugins/mcp/src/api/group.ts137 |
/mcp/servers | POST | Registers a new MCP server as an integration packages/plugins/mcp/src/api/group.ts144 |
/mcp/servers/:slug | GET | Retrieves server configuration and metadata packages/plugins/mcp/src/api/group.ts163 |
/mcp/servers/:slug/auth | POST | Configures or merges auth templates for the server packages/plugins/mcp/src/api/group.ts178 |