OAuth MCP Framework

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.

Category
Visit Server

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 grok client 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

Deploy with 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:

  1. Open the project in Vercel.

  2. Go to Storage → Create Database, or install Upstash Redis from Vercel Marketplace.

  3. Connect the Redis database to this project and all required environments.

  4. Confirm that Vercel injected either variable pair:

    Supported pair Variables
    Vercel KV naming KV_REST_API_URL, KV_REST_API_TOKEN
    Upstash naming UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN
  5. 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

  • hello
  • get_server_time
  • echo
  • whoami
  • publish_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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured