Saltar a contenido

MCP — Model Context Protocol

Anthropic-led standard. Connects agents to tools, resources and prompts. SDKs: official mcp and high-level fastmcp (used by ~70 % of MCP servers).

Native server

Python
from apogee_ai_comunication import NativeMcpServer, ServerConfig, ToolDefinition

server = NativeMcpServer(ServerConfig())

@server.tool(ToolDefinition(name="ping"))
async def _ping() -> str:
    return "pong"

await server.run()  # JSON-RPC 2.0 dispatch

FastMCP adapter (extras=mcp)

Python
from apogee_ai_comunication import ServerConfig
from apogee_ai_comunication.infrastructure.mcp.fastmcp_server import FastMcpServer

server = FastMcpServer(ServerConfig(host="127.0.0.1", port=9001))
# … register_tool / register_resource / register_prompt
await server.run()

When the optional engine is missing, ProviderNotInstalledError is raised and the message instructs the user to pip install 'apogee-ai-comunication[mcp]'.

CLI

Bash
apogee-ai-comunication mcp:serve --port 9001
apogee-ai-comunication mcp:list  --url http://localhost:9001
apogee-ai-comunication mcp:call  echo --url http://localhost:9001 --args '{"text":"hi"}'