# MCP-LLM Adapter Adapter that connects LLM function calls to MCP tool server. ## Overview This adapter: - Converts LLM function calls (OpenAI format) to MCP JSON-RPC calls - Converts MCP responses back to LLM format - Handles tool discovery and registration - Manages errors and retries ## Architecture ``` LLM Server (Ollama/vLLM) ↓ (function call) MCP Adapter ↓ (JSON-RPC) MCP Server ↓ (tool result) MCP Adapter ↓ (function result) LLM Server ``` ## Quick Start ```bash # Run tests ./run_test.sh # Or manually python test_adapter.py ``` ## Usage ```python from adapter import MCPAdapter # Initialize adapter adapter = MCPAdapter(mcp_server_url="http://localhost:8000/mcp") # Discover tools tools = adapter.discover_tools() # Convert LLM function call to MCP call llm_function_call = { "name": "weather", "arguments": {"location": "San Francisco"} } result = adapter.call_tool(llm_function_call) # Result is in LLM format print(result) # "Weather in San Francisco: 72°F, sunny..." ``` ## Integration The adapter can be integrated into: - LLM routing layer - Direct LLM server integration - Standalone service