Skip to main content
Use the Convex provider when you host your own OAuth authorization server using the Convex OAuth Provider component. MCP clients register directly with your Convex deployment through Dynamic Client Registration, and your MCP server verifies Convex-issued tokens.

Start from the template

Use the Convex OAuth template for a standalone MCP server with an authenticated whoami tool.
Configure your Convex OAuth Provider as described below, set MCP_USE_OAUTH_CONVEX_AUTH_URL in .env, then run npm run dev. Connect your MCP client to http://localhost:3000/mcp. The template hosts the MCP resource server. Your Convex deployment must provide the OAuth Provider component, login, consent, and token issuance; Convex Auth alone is not sufficient. You can also deploy the template to Manufact. Set the issuer URL in the deployment environment before starting the server. For public or tunnel deployments, set MCP_URL to the public MCP server origin, without /mcp.

Configure Convex

In your Convex deployment, set up the OAuth Provider component:
  1. Install the Convex OAuth Provider component in your Convex project.
  2. Enable Dynamic Client Registration on the OAuth component so MCP clients can register automatically.
  3. Configure the allowed scopes for your deployment. At minimum, include openid profile email.
  4. Deploy your Convex project and note the base URL of your Convex site. It will look like:

Set environment variables

This must be the base URL of your Convex OAuth Provider endpoint, without a trailing slash.

Configure the MCP server

You can also pass the URL directly instead of reading from an environment variable:

Use Convex identity in tools

When a request is authenticated, tools receive the verified Convex identity on ctx.auth.
Use User Context for broader access-control patterns inside tools.

Verify the setup

Run the server and connect with an OAuth-capable MCP client.
Confirm these cases:
  • The client discovers Convex OAuth metadata from your MCP server.
  • The client registers with your Convex deployment.
  • Authenticated tool calls include ctx.auth.user.id.
  • Tool calls without a valid bearer token are rejected.
When using the Inspector, set the Scope to openid profile email if the client does not send a scope by default.

Next steps

Convex OAuth template

Clone or deploy a standalone MCP server with Convex authentication.

Convex OAuth Provider component

Set up the OAuth Provider component in your Convex deployment.

User Context

Use Convex identity data inside tools.