Skip to main content
Artifacts exposes an MCP server at /mcp. MCP clients can authenticate, discover tools, and call the same domain services used by the REST API and CLI.
This page covers connecting and using MCP. For every tool and its input schema, see the MCP reference.

Endpoint

When running locally:
The Next.js app rewrites /mcp to the Hono API, so MCP clients use the same public origin as browser OAuth.

Discovery metadata

The protected resource document advertises:
  • Resource: PUBLIC_APP_URL
  • Authorization server: BETTER_AUTH_URL
  • Supported scopes: openid, profile, email
  • Bearer method: header

How a client connects

MCP auth is powered by Better Auth’s MCP plugin:
1

Discover metadata

The client fetches the protected resource metadata.
2

Register

The client dynamically registers, if it supports dynamic registration.
3

Consent

The user completes browser consent and Google sign-in.
4

Exchange a token

The client exchanges the authorization code for a bearer token.
5

Call tools

The client calls /mcp with authorization: Bearer ....

Tools

Every tool takes structured JSON and returns domain objects, validated with the same Zod schemas as the REST and CLI paths.

Examples

Which surface should an agent use?

MCP reference

Endpoint metadata, the full tool list, and input schemas.