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
| Credential | Who creates it | Sent as | Account it acts on |
|---|---|---|---|
| API key | The customer, on Settings → API keys (personal) or the organization's API keys page | x-api-key header | The key's owner. Organization keys outlive the member who made them. |
| Browser OAuth | The customer approves a client you provisioned, on the consent page | OAuth 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:
| Variable | Turns on |
|---|---|
API_ACCESS_KEYS | Creating 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/mcptakes 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=trueAPI_ACCESS_MCP=trueIn 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_KEYSpnpm --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
- Turn both switches on and restart.
- Sign in, open Settings → API keys, and create a key with
account:read. Copy the secret: it's shown once. - Run the client in Connect with an API Key against
http://localhost:5173/api/mcpwith that key. - It calls
account_contextand prints your account'sid,name,typeandscopes. - 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 inapiAccessScopesinapps/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
apiAccessLimitsin the same file.
Where to Next
- Connecting Clients: API-key and OAuth clients, revoking access.
- Adding Tools: register a read tool, add a scope, write tools.
- API Keys in Your Routes: accept keys on your own
/apiendpoints. - Customer API Access reference: every rule, limit, error code, cleanup and audit event.