Handle gateway MCP request
Handle MCP JSON-RPC requests for the unified gateway. Supports initialize, tools/list, and tools/call methods with content negotiation.
Authorization
User API Key User API key (mgw_usr_live_* or mgw_usr_test_*)
In: header
Header Parameters
Cookie Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://loading/mcp/gateway" \ -H "Content-Type: application/json" \ -d '{}'null{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}Handle Bundle Mcp Request
Handle MCP JSON-RPC requests for bundles. This endpoint exposes bundles via the MCP protocol. Bundles act as transparent tool aggregators that always list all their enabled tools directly. For search/execute mode with semantic search, use the unified gateway endpoint (/mcp/gateway) which respects user's gateway_settings. The bundle_key serves as authentication - only valid keys can access bundles. Session Management: - If Mcp-Session-Id header is provided, uses existing session - Otherwise, creates a new session (anonymous if no user_id) - Returns session ID in Mcp-Session-Id response header Args: bundle_key: The bundle's unique sharing key (auth). request: The JSON-RPC request body. http_response: FastAPI response object for setting headers. session: Database session (injected). server_repo: Server repository (injected). mcp_client: MCP client service (injected). audit_logger: Audit logger (injected). embeddings: Embeddings service (injected). cred_service: Credential resolution service (injected). session_service: Session service (injected). user_id: Optional authenticated user's ID. x_mcp_session_id: Optional session ID from request header. Returns: JSONResponse with the JSON-RPC response and Mcp-Session-Id header. Raises: HTTPException: 404 if bundle not found, 500 if processing fails.
Handle direct server MCP request
Handle MCP JSON-RPC requests for direct server access. Always uses LIST mode with original tool names (no prefixes).
