MCP Server

Your app's MCP server at /api/mcp: what customers can do with it, how they authenticate (API keys or browser OAuth), and how to turn it on.

Your app ships an MCP server at /api/mcp. Your customers point AI tools and their own code at it, and the tools you register act on their account: a personal account or one organization. API keys also work on your own JSON routes (API Keys in Your Routes).

This is the server your customers use. The makerkit MCP server your coding agent uses to build the app is a different thing (Working with Agents).

API keys and the MCP server are both off by default. Nothing is reachable until you turn them on.

How Customers Get In

CredentialWho creates itSent asAccount it acts on
API keyThe customer, on Settings → API keys (personal) or the organization's API keys pagex-api-key headerThe key's owner. Organization keys outlive the member who made them.
Browser OAuthThe customer approves a client you provisioned, on the consent pageOAuth access token (Bearer or DPoP)The one account they picked on the consent page

Each request carries one credential. The account always comes from the credential, never from tool arguments, cookies or the active organization.

Turn It On

Two boolean environment switches:

VariableTurns on
API_ACCESS_KEYSCreating API keys, and key access to /api/mcp and your key routes
API_ACCESS_MCP/api/mcp, OAuth discovery, consent and the Connect an app panel
  • /api/mcp takes API keys only with both on.
  • Browser OAuth needs only API_ACCESS_MCP.
  • The tables always exist, so switching needs no migration.

Locally, both are already on: pnpm kit:setup creates apps/web/.env from env.example, which sets them to true. A settings file made before that default has them off: ask your agent to set them (it uses kit_env_update), or edit apps/web/.env yourself, then restart pnpm dev:

API_ACCESS_KEYS=true
API_ACCESS_MCP=true

In production, both are off until you set them: every variable is a Worker secret (Environment Variables). Run each in your own terminal and enter true at the prompt, then deploy:

pnpm --filter web exec void secret put API_ACCESS_KEYS
pnpm --filter web exec void secret put API_ACCESS_MCP
  • A change takes effect on the next deploy or restart. The switches apply when the auth instance is built.
  • Turning a switch off keeps existing keys and connections listed and revocable.
  • Turning it back on never un-revokes anything.

Try It in Five Minutes

  1. Turn both switches on and restart.
  2. Sign in, open Settings → API keys, and create a key with account:read. Copy the secret: it's shown once.
  3. Run the client in Connect with an API Key against http://localhost:5173/api/mcp with that key.
  4. It calls account_context and prints your account's id, name, type and scopes.
  5. Revoke the key on the same page and run it again: it now fails with INVALID_API_KEY.

What Ships

  • One tool, account_context: returns the credential's account and effective scopes. Add your own with Adding Tools.
  • One scope, account:read. Your scopes live in apiAccessScopes in apps/web/config/api-access.config.server.ts.
  • Settings pages for personal keys, organization keys and connected apps (API Keys).
  • 20 active keys per account and 120 requests per minute per credential, set in apiAccessLimits in the same file.

Where to Next