fix(mcp-kb): Add missing /mcp JSON-RPC endpoint for tool execution #74

Closed
opened 2026-01-03 23:57:02 +00:00 by cardosofelipe · 0 comments

Bug Description

The Knowledge Base MCP server is missing the /mcp endpoint required by the backend MCP client infrastructure. Without this endpoint, the backend cannot execute KB tools via JSON-RPC 2.0.

Expected Endpoints (per backend MCP client)

  • GET /health - Exists
  • GET /mcp/tools - Missing
  • POST /mcp - Missing (this issue)

Location

mcp-servers/knowledge-base/server.py

Required Implementation

@app.post("/mcp")
async def mcp_rpc(request: Request):
    """JSON-RPC 2.0 endpoint for tool execution."""
    body = await request.json()
    # Validate JSON-RPC format
    # Route to appropriate tool
    # Return JSON-RPC response

Protocol

Must follow JSON-RPC 2.0 specification:

// Request
{"jsonrpc": "2.0", "method": "search_knowledge", "params": {...}, "id": 1}

// Response
{"jsonrpc": "2.0", "result": {...}, "id": 1}
  • Found during PR #72 deep review
  • Issue #57 (Knowledge Base MCP Server)
  • Companion issue for /mcp/tools endpoint
## Bug Description The Knowledge Base MCP server is missing the `/mcp` endpoint required by the backend MCP client infrastructure. Without this endpoint, the backend cannot execute KB tools via JSON-RPC 2.0. ### Expected Endpoints (per backend MCP client) - `GET /health` - ✅ Exists - `GET /mcp/tools` - ❌ Missing - `POST /mcp` - ❌ Missing (this issue) ### Location `mcp-servers/knowledge-base/server.py` ### Required Implementation ```python @app.post("/mcp") async def mcp_rpc(request: Request): """JSON-RPC 2.0 endpoint for tool execution.""" body = await request.json() # Validate JSON-RPC format # Route to appropriate tool # Return JSON-RPC response ``` ### Protocol Must follow JSON-RPC 2.0 specification: ```json // Request {"jsonrpc": "2.0", "method": "search_knowledge", "params": {...}, "id": 1} // Response {"jsonrpc": "2.0", "result": {...}, "id": 1} ``` ### Related - Found during PR #72 deep review - Issue #57 (Knowledge Base MCP Server) - Companion issue for /mcp/tools endpoint
Sign in to join this conversation.