A lightweight mock server that combines an OAuth2 token endpoint with an MCP (Model Context Protocol) Streamable HTTP endpoint. Built for testing OAuth2 client_credentials (M2M) flows with LiteLLM proxy.
- OAuth2 token endpoint (
POST /oauth/token) — issues bearer tokens via theclient_credentialsgrant - MCP endpoint (
POST /mcp) — Streamable HTTP transport with a built-inechotool - Bearer token validation — the MCP endpoint rejects requests without a valid token
pip install fastapi uvicornpython mock_oauth2_mcp_server.pyThe server starts on port 8765.
| Parameter | Value |
|---|---|
client_id |
test-client |
client_secret |
test-secret |
Add the following to your LiteLLM proxy config YAML:
mcp_servers:
test_oauth2_server:
url: "http://localhost:8765/mcp"
transport: "http"
auth_type: "oauth2"
client_id: "test-client"
client_secret: "test-secret"
token_url: "http://localhost:8765/oauth/token"See the full LiteLLM MCP OAuth docs: https://docs.litellm.ai/docs/mcp_oauth