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.

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

Runnable Convex example

Compare your setup with a working mcp-use Convex server.

Convex OAuth Provider component

Set up the OAuth Provider component in your Convex deployment.

User Context

Use Convex identity data inside tools.