MCP OAuth — Convex
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP OAuth — Convexwhoami — show my authenticated identity and scopes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP OAuth — Convex
An mcp-use MCP server template that verifies access tokens from your Convex OAuth Provider deployment. Includes a whoami tool that returns the authenticated user's identity and scopes.
Prerequisites
Node.js 22.22.2 or newer and npm.
A Convex project with the Convex OAuth Provider component configured, including working login and consent screens. Convex Auth alone is not an OAuth authorization server.
This template runs the MCP resource server. Your Convex deployment owns user accounts, login, consent, client registration, and token issuance.
Related MCP server: mcp-gateway
Configure Convex
Follow the OAuth Provider component setup in your Convex project.
Enable Dynamic Client Registration so MCP clients can register automatically; it is disabled by default in the component.
Allow the
openid profile emailscopes.Note the complete OAuth issuer URL, including the mounted path, for example
https://your-deployment-name.convex.site/oauth.
Run locally
Create a repository from this template or clone it:
git clone https://github.com/manufacts/mcp-oauth-convex-template.git
cd mcp-oauth-convex-template
npm ci
cp .env.example .envEdit .env to point at your Convex OAuth Provider:
MCP_USE_OAUTH_CONVEX_AUTH_URL=https://your-deployment-name.convex.site/oauthStart the development server:
npm run devConnect an OAuth-capable MCP client to http://localhost:3000/mcp. You can also use the Inspector link printed by the CLI. Set the Inspector Scope to openid profile email if your client does not send scopes by default, complete login and consent through Convex, then call whoami.
Available tool
whoami returns the verified subject ID, OAuth client ID (when present), scopes, permissions, token expiry, and MCP resource URL. Add your own tools in src/index.ts and use ctx.auth for the authenticated identity.
Deploy
Use the deploy link above, or run:
npx mcp-use deploySet MCP_USE_OAUTH_CONVEX_AUTH_URL in the deployment's environment before starting the server. For public or tunnel deployments, set MCP_URL to the public server origin, such as https://mcp.example.com, without /mcp.
To build and run yourself:
npm run typecheck
npm run build
npm startVerify authentication
A request without a bearer token must be rejected.
MCP resource metadata must point at your Convex OAuth issuer.
An OAuth-capable client must register, complete login and consent, and successfully call
whoamiwith a valid token.Invalid or expired tokens must be rejected.
Troubleshooting
Missing environment variable: copy
.env.exampleto.envand set the issuer URL, or configure it in your hosting environment.Registration fails: enable Dynamic Client Registration on the Convex OAuth Provider component.
Login or consent fails: check the login and consent routes in your Convex application; these are hosted separately from this MCP server.
Token rejected: check that the issuer matches your Convex OAuth endpoint and that the token was issued for this MCP resource. For remote deployments, verify
MCP_URLmatches the public origin.
Learn more
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Prove end users to agents and apps: login-links, OIDC clients, and API keys over remote MCP
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
OAuth scope approvals and consent receipts for remote MCP servers.
Authenticated MCP server for ClearPolicy policy and compliance workflows.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceDrop-in OAuth 2.1 + Dynamic Client Registration for MCP servers, providing authentication middleware and token verification.13 npm1MIT
- AlicenseNot gradedqualityAmaintenanceEnables clients to access multiple backend MCP servers through a single endpoint, with OAuth 2.1 authorization, namespaced tools, and secure credential management.1MIT
- FlicenseNot gradedqualityBmaintenanceEnables an MCP server with OAuth authentication, protecting tools like user CRUD operations behind session tokens obtained through a browser-based authentication flow.-
- FlicenseNot gradedqualityBmaintenanceEnables end-to-end testing of OAuth authorization for an MCP server, exposing scoped tools like whoami and echo over streamable HTTP.-