- Home
- MCP servers
- MCP OAuth Server
MCP OAuth Server
- typescript
6
GitHub Stars
typescript
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You run an MCP (Model Context Protocol) server built on a Next.js app to provide OAuth 2.1 authentication and a flexible transport layer for clients. This server lets you manage OAuth clients, user authentication, and MCP connections through a structured API, enabling secure, scalable access to your model context resources across compatible clients.
How to use
Connect your MCP clients to the server to enable OAuth 2.1 authentication and context-aware interactions. Use the Microsoft, Google, or other supported providers to sign in, then grant consent for your app to access resources. Your clients can connect via the HTTP transport (streamable HTTP) or the older SSE transport, depending on client capabilities. Configure your client’s MCP URL to point at the server's endpoints, and ensure your Redis and database backends are available for session storage and token handling.
How to install
Prerequisites you need before starting: a modern Node.js runtime, a PostgreSQL-compatible database, and a Redis instance for transport states. You should also have a Google (and optionally GitHub/Discord) OAuth app configured to obtain client IDs and secrets.
# Install dependencies
pnpm install
# Generate or synchronize database schema
pnpm run db:generate
# Start the development server (first time may require pushing the database schema)
pnpm run dev
# If this is the first run, push the initial schema to the database as needed
pnpm run db:push
Additional notes
Configuration is centered around a Next.js app structure. OAuth flows persist clients, access tokens, and authorization codes in a PostgreSQL database accessed through a ORM suitable for the app. The MCP server itself lives under a dedicated route and handles transport-specific behavior for both streamable and SSE transports.
Configuration overview
The server is set up to expose an MCP entry point and an OAuth workflow that integrates with your selected providers. Key environment values include database connection details, OAuth client secrets, a secret for the authentication layer, and transport-related settings.
{
"mcpServers": {
"myserver": {
"name": "MCP OAuth Demo",
"url": "https://example.com/mcp/mcp",
"transport": "http-stream"
}
}
}