Module mcp

Source
Expand description

Model Context Protocol server Model Context Protocol (MCP) Server Implementation

This module provides a fully-featured MCP server that integrates with the P2P network, enabling AI agents to discover and call tools across the distributed network.

The implementation includes:

  • MCP message routing over P2P transport
  • Tool registration and discovery through DHT
  • Security and authentication for remote calls
  • Service health monitoring and load balancing

Re-exports§

pub use security::*;

Modules§

security
MCP Security Module

Structs§

FunctionToolHandler
Simple function-based tool handler
MCPAuthInfo
MCP authentication information
MCPCallContext
MCP call context
MCPCapabilities
MCP capabilities
MCPClientInfo
MCP client information
MCPEndpoint
MCP endpoint information
MCPLogEntry
MCP log entry
MCPLoggingCapability
Logging capability configuration
MCPPrompt
MCP prompt definition
MCPPromptMessage
MCP prompt message
MCPPromptsCapability
Prompts capability configuration
MCPRequest
MCP request with routing information
MCPResource
MCP resource definition
MCPResourceContent
MCP resource content
MCPResourceReference
MCP resource reference
MCPResourcesCapability
Resources capability configuration
MCPResponse
MCP response with metadata
MCPServer
Main MCP server implementation
MCPServerConfig
MCP server configuration
MCPServerInfo
MCP server information
MCPServerStats
MCP server statistics
MCPService
MCP service descriptor for discovery
MCPServiceMetadata
MCP service metadata
MCPSession
MCP session information
MCPTool
MCP tool definition
MCPToolsCapability
Tools capability configuration
P2PMCPMessage
P2P MCP message wrapper for network transmission
ServiceLoadMetrics
Service load metrics
Tool
MCP tool implementation
ToolBuilder
Builder for creating tools
ToolMetadata
Tool metadata for tracking and optimization
ToolRequirements
Tool resource requirements

Enums§

MCPContent
MCP content types
MCPLogLevel
MCP log levels
MCPMessage
MCP message types
MCPRole
MCP message roles
MCPSessionState
MCP session state
P2PMCPMessageType
P2P MCP message types
ServiceHealthStatus
Service health status
ToolHealthStatus
Tool health status

Constants§

DEFAULT_CALL_TIMEOUT
Default timeout for MCP calls
MAX_MESSAGE_SIZE
Maximum message size for MCP calls (1MB)
MCP_PROTOCOL
MCP protocol identifier for P2P messaging
MCP_VERSION
MCP protocol version
SERVICE_DISCOVERY_INTERVAL
Service discovery refresh interval

Traits§

ToolHandler
Tool handler trait