OAuth MCP Framework
A minimal MCP server framework for single-owner production deployments using OAuth authorization code flow with PKCE, providing endpoints for MCP, authorization, token, and metadata.
README
OAuth MCP Framework
Minimal MCP server for a single-owner production deployment, using OAuth authorization code flow, S256 PKCE and one-time authorization codes.
Documentation
Security model
- MCP access requires a signed, audience-bound access token with
mcp:tools. - The built-in
grokclient uses Grok's fixed callback URL. - The resource owner approves connections with
OAUTH_AUTHORIZATION_PASSWORD. - Authorization codes expire after five minutes and are consumed atomically in Redis-compatible KV.
- The OAuth client ID is fixed to
grok; dynamic client registration is not exposed.
This is a single-owner authorization server. Use an external identity provider instead if you need multiple users, SSO, account recovery, MFA, or per-user consent.
Deploy to Vercel
The deployment form asks for:
| Variable | Value |
|---|---|
OAUTH_SECRET |
Independent random value with at least 32 characters |
OAUTH_AUTHORIZATION_PASSWORD |
Independent authorization password with at least 12 characters |
Generate the two secrets locally:
openssl rand -base64 48
openssl rand -base64 24
Add Redis storage
After creating the Vercel project:
-
Open the project in Vercel.
-
Go to Storage → Create Database, or install Upstash Redis from Vercel Marketplace.
-
Connect the Redis database to this project and all required environments.
-
Confirm that Vercel injected either variable pair:
Supported pair Variables Vercel KV naming KV_REST_API_URL,KV_REST_API_TOKENUpstash naming UPSTASH_REDIS_REST_URL,UPSTASH_REDIS_REST_TOKEN -
Redeploy the project after connecting storage.
Redis is required for one-time authorization codes and authorization rate limiting. MCP_RESOURCE_URL is inferred automatically from Vercel; configure it only when using a custom domain override.
Verify the deployment:
curl -fsS https://YOUR_DOMAIN/.well-known/oauth-authorization-server
curl -fsS https://YOUR_DOMAIN/.well-known/oauth-protected-resource
See 配置与部署文档 for minimal and advanced configurations.
Endpoints
| Endpoint | Path |
|---|---|
| MCP | /api/mcp |
| Authorization | /oauth/authorize |
| Token | /oauth/token |
| Authorization server metadata | /.well-known/oauth-authorization-server |
| Protected resource metadata | /.well-known/oauth-protected-resource |
Built-in tools
helloget_server_timeechowhoamipublish_page– publish a permanent public text page and return its URL
Replace these examples with the actual tools your server should expose.
Local development
Copy .env.example to .env.local, use a development Redis database, update the public URL and configured redirect URI, then run:
npm install
npm run dev
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.