Skip to content

mcp_protocol

Model Context Protocol (MCP) Implementation

Section titled “Model Context Protocol (MCP) Implementation”

Standards-compliant MCP implementation for PromptFleet agents

  • JSON-RPC 2.0 wire format (MCP specification requirement)
  • HTTP/HTTPS transport with OAuth 2.1 Bearer token support
  • FastMCP compatible - interoperable with Python FastMCP and TypeScript MCP SDKs
  • External MCP servers - connect to any MCP server via proxy
  • MCP Specification 2025-06-18 (latest)
  • JSON-RPC 2.0 specification compliant
  • FastMCP Python implementation compatible
  • Standard OAuth 2.1 Bearer token authentication
  • HTTP+SSE and Streamable HTTP transport support
  • Tool Discovery: list_tools method
  • Tool Execution: call_tool method with proper parameter handling
  • Memory Operations: add_memory, search_memory methods
  • Health Monitoring: heartbeat and health endpoints
  • Authentication: Bearer token and custom auth strategies
  • Proxy Support: Connect to external MCP servers outside Kubernetes
const MCP_PROTOCOL_VERSION: &str = ;

MCP Protocol Version - Current specification version

const JSONRPC_VERSION: &str = ;

JSON-RPC Version - Required by MCP specification

Tool Provider Trait - Pure abstraction for tool operations

Required / Provided Methods

fn list_tools(&self) -> Result<Vec<Tool>, ProtocolError>

List tools from this provider

fn call_tool<'life0, 'life1, 'async_trait>(&self, name: &''life1 str, arguments: Option<serde_json::Value>) -> pin::Pin<Box<dyn future::Future + marker::Send>>
where
Self: ?

Execute tool via this provider

MCP Protocol Handler - Integrates with protocol_transport_core

Methods

fn new() -> Self

Create new MCP protocol handler

fn with_capabilities(self, capabilities: ServerCapabilities) -> Self

Configure server capabilities

fn with_auth_handler<H>(self, handler: H) -> Self

Configure authentication handler

fn with_tool_provider<P>(self, provider: P) -> Self

Configure tool provider

fn with_query_mode(self, query_mode: QueryMode) -> Self

Configure query mode

Query Mode - How to handle tool listing

Variants

VariantDescription
SingleList tools from single provider (standard MCP behavior)
AggregateAggregate tools from all providers (special case)
fn create_mcp_handler() -> McpProtocolHandler

Quick setup function for MCP protocol handler

fn create_mcp_handler_with_capabilities(capabilities: ServerCapabilities) -> McpProtocolHandler

Quick setup function for MCP protocol handler with custom capabilities