# MCPAPI auth.md

How an AI agent or MCP client gets access to MCPAPI. MCPAPI turns APIs and MCP servers into three MCP tools (`search_tools`, `get_tool_details`, `execute_tool`); every call runs as one workspace member, with that member's access.

## Audience

AI agents and MCP clients (Claude, ChatGPT, Cursor, Claude Code, any client that speaks MCP over streamable HTTP), and scripts that call the management API.

## Resources

- MCP endpoint: `https://mcpapi.one/mcp`
- Management API: `https://mcpapi.one/v1` (OpenAPI: `https://mcpapi.one/v1/openapi.yaml`)
- Protected resource metadata: `https://mcpapi.one/.well-known/oauth-protected-resource`
- Authorization server metadata: `https://mcpapi.one/.well-known/oauth-authorization-server` (issuer `https://ycwhplbjkurjtlrdmehm.supabase.co/auth/v1`)

## Method 1: OAuth 2.1 (MCP clients)

1. Read the protected resource metadata. Its authorization server is `https://ycwhplbjkurjtlrdmehm.supabase.co/auth/v1`.
2. Register the client with dynamic client registration (RFC 7591) at the authorization server's `registration_endpoint`. No pre-shared client ID is needed.
3. Run the authorization code flow with PKCE (S256). A person signs in with their email (a sign-in link, no password), picks the workspace and approves the client.
4. Call `https://mcpapi.one/mcp` with `Authorization: Bearer <access_token>`. Refresh with the refresh token when it expires.

The token acts as the person who approved it, in the workspace they chose. They can disconnect the client at any time from the dashboard's Agents page.

## Method 2: API key

1. A workspace member creates a key on the dashboard's Agents page (`https://mcpapi.one/agents`), optionally read-only, with a monthly run limit or a fixed connection per API. Agents cannot create keys themselves.
2. Call `https://mcpapi.one/mcp` or `https://mcpapi.one/v1` with `Authorization: Bearer <key>`.

A key acts as the member who made it. Revoke it on the same page.

## Not supported

Agents cannot create MCPAPI accounts or workspaces on their own: a person signs up at `https://mcpapi.one/login` and approves every client or key. There is no anonymous access.
