Skip to main content

Open Model Context Protocol (MCP) Specification & Client Guide

This document defines the open endpoints, protocol specifications, and client connection setups for integrating with glow-prow-ai-mcp.


1. Protocol Endpoints Overview​

The service fully conforms to the Model Context Protocol (MCP) standard and OAuth 2.1 (RFC 9728 & RFC 8414).

EndpointMethodProtocol StandardDescription
/mcpPOST/GETStreamable HTTP / SSEDefault MCP connection endpoint (English).
/mcp/zh-CN (or /mcp/zh)POST/GETStreamable HTTP / SSEOptimized Chinese MCP connection endpoint.
/.well-known/oauth-protected-resourceGETRFC 9728Protected Resource Metadata discovery.
/.well-known/oauth-authorization-serverGETRFC 8414Authorization Server Metadata discovery.
/api/mcp/authorizeGETOAuth 2.1Authorization endpoint (redirects 302 to user consent page).
/api/mcp/registerPOSTRFC 7591Dynamic Client Registration (proxied to authorization server).
/api/mcp/tokenPOSTRFC 6749Token exchange & refresh (proxied to authorization server).
/healthGETHTTP StatusService health probe (database status, uptime, version).

2. OAuth 2.1 Discovery & Authentication Flow​

When an MCP client connects without credentials:

[MCP Client]                        [glow-prow-ai-mcp]                 [glow-prow-backend]
│ │ │
├─── 1. POST /mcp (unauthenticated) ──>│ │
│<── 2. 401 + WWW-Authenticate ────────┤ │
│ (resource_metadata link) │ │
│ │ │
├─── 3. GET /.well-known/oauth-protected-resource ─────────> │
│<── 4. 200 JSON (resource URI & auth_server base) ──────── │
│ │
├─── 5. GET /.well-known/oauth-authorization-server ──────────────────────>│
│<── 6. 200 JSON (authorize, token & register endpoints) ──────────────────┤
│ │
├─── 7. Browser: Open /api/mcp/authorize?client_id=... ───>│ │
│<── 8. HTTP 302 Redirect ─────────────────────────────────┴──────────────>│
│ │
│<── 9. Render Consent Page (/apps/ai-connector/consent) ──────────────────┤
│─── 10. User Approves ───────────────────────────────────────────────────>│
│<── 11. 302 Redirect to client redirect_uri with auth code ───────────────┤
│ │
├─── 12. POST /api/mcp/token (Exchange code for token) ───────────────────>│
│<── 13. Access Token (aud: glow-prow-mcp) ────────────────────────────────┤
│ │ │
├─── 14. POST /mcp (Bearer Token) ────>│ │
│<── 15. Streamable Tool Responses ────┤ │

3. Response Format & Error Handling​

Unauthenticated requests receive HTTP 401 with WWW-Authenticate:

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="glow-prow", error="invalid_token", resource_metadata="https://mcp.glow-prow.top/.well-known/oauth-protected-resource"
Content-Type: application/json

{
"error": "unauthorized",
"message": "Authentication required. Please connect via OAuth 2.1."
}

Tool call results follow the standard JSON-RPC 2.0 CallToolResult schema.