Skip to content

MCP servers and sign-in ​

Every environment of a project is an MCP server with your API's tools. Any MCP client can connect: Claude (web, desktop, mobile, Claude Code), ChatGPT, Cursor, or a client you write. Each person who connects signs in to your product, and their tool calls run as them.

Addresses ​

AddressEnvironment
https://<project id>.mcp.frege.io/mcpProduction
https://<project id>.mcp.frege.io/staging/mcpStaging
https://<your domain>/mcp, https://<your domain>/staging/mcpWith a verified custom domain
https://mcp.frege.io/mcp/<environment id>The older form; it keeps working
  • Production answers only once it is published (POST /v1/projects/{id}/mcp/publish, confirmed with an emailed code). Staging needs no publishing.
  • The transport is MCP's Streamable HTTP, stateless. There is no SSE endpoint.
  • The doors answer browsers too (CORS): any origin, methods GET, POST, DELETE, OPTIONS.
  • The same address serves your documentation: someone who is not your customer, when the environment's public docs are open, gets a search_docs tool over the documents you published.

GET /v1/projects/{id} shows the environment's current address as mcp_url.

Connecting a client ​

Claude ​

  1. In claude.ai or Claude Desktop, open Settings → Connectors and choose Add custom connector.
  2. Paste the address and name it.
  3. Claude opens a sign-in window: the customer signs in with their account in your product, then allows the connection.

In Claude Code:

bash
claude mcp add --transport http shop https://<project id>.mcp.frege.io/mcp

Then run /mcp and choose the server to sign in.

Other clients ​

Any client that supports remote MCP servers over HTTP with OAuth works the same way: add the address and sign in when asked. Clients discover the sign-in from the server; there is nothing to configure. A project API key does not open an MCP server.

How sign-in works ​

The MCP servers use OAuth 2.1 with discovery, so a client finds everything from the address alone:

  1. The client calls the address with no token. The server answers 401 with WWW-Authenticate: Bearer realm="mcp", resource_metadata="<url>".
  2. The protected resource metadata (RFC 9728) at <url> names the authorization server. For https://<project id>.mcp.frege.io/mcp it is at https://<project id>.mcp.frege.io/.well-known/oauth-protected-resource/mcp.
  3. The authorization server's metadata is at <issuer>/.well-known/oauth-authorization-server (also /.well-known/openid-configuration). The issuer is https://mcp.frege.io, or your own domain when it hides Frege.
  4. The client registers itself (RFC 7591) at POST <issuer>/oauth/register, then sends the person to <issuer>/oauth2/auth with PKCE.
  5. The person signs in through your sign-in recipe and allows the connection.
  6. The client exchanges the code at POST <issuer>/oauth2/token.
SettingValue
Grant typesauthorization_code, refresh_token
PKCErequired, S256
Client authenticationnone (a public client), client_secret_basic (the default) or client_secret_post
Redirect URIs1 to 10; https, http only to localhost, or a custom scheme
Scopesopenid profile email offline_access
Access tokenan ES256 JWT, valid for one hour
Refresh token30 days, rotated on every use; with offline_access

Every sign-in makes the person a customer of the environment, listed by GET /v1/projects/{id}/clients.

What a connected client may do ​

  • Write policy. Writes run, are refused, or (ask) wait for a person. An MCP client that can show a form puts the approval in front of the person; elsewhere a write under ask is refused.
  • Scopes. A customer's grants (PUT /v1/projects/{id}/clients/{clientID}/grants) narrow the tools they get.
  • Redaction. Sensitive data is removed from answers before the model sees them.
  • Audit. Every call is in the audit log.

Errors ​

The server answers at the HTTP level before MCP starts:

StatusBodyWhen
401{"error": "unauthorized", "hint": "..."}No token, or one that does not verify. Follow WWW-Authenticate.
402billing_suspendedThe organization's billing is suspended.
403{"error": "connect_required", "connect_url": "...", ...}The person signed in but has not connected their account in your product, or it expired and cannot be renewed.
404No such address, or Production is not published.
429too many requestsToo many requests; wait and try again.

A tool that fails answers as a tool result with isError: true, not as a JSON-RPC error. Its text is JSON with an error_class, a reason and a hint, and retry_after_seconds when waiting helps:

error_classWhat happened
invalid_argumentsThe arguments do not fit the tool's schema.
deniedA rule of the environment refused the call, such as the write policy, a guardrail or the wallet.
rate_limitedA limit refused it; see retry_after_seconds.
busyThe environment's share of calls to your API is in use; try again shortly.
upstream_unavailableYour API keeps failing, so Frege stopped calling it for a short while.
no_credentialThe call has no usable credential: the customer must sign in again, or the sign-in setup is incomplete.
transportAny other failure of the call to your API.

Other classes (missing_slots, photo_unavailable, injected_value, chain_refused, step_unusable) come from photos and intent tools.

Extensions ​

Besides tools, the servers advertise three MCP extensions: io.modelcontextprotocol/events (Events), io.modelcontextprotocol/tasks (long tool calls) and io.modelcontextprotocol/skills (the environment's skills).

Your own domain ​

Serve the MCP servers and the sign-in pages at a hostname you own:

bash
curl -X POST "https://api.frege.io/v1/projects/$PROJECT/domain" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"domain": "mcp.example.com"}'

Then publish two DNS records:

TypeHostValue
CNAMEmcp.example.comdomains.frege.io
TXT_frege-challenge.mcp.example.comthe token in the answer

POST /v1/projects/{id}/domain/verify checks the TXT record; it always answers 200, so read verified and last_check_error. Once verified, the addresses move to https://mcp.example.com/mcp and /staging/mcp, and Frege gets the HTTPS certificate itself on the first connection. A project holds one domain at a time.

PUT /v1/projects/{id}/domain/white-label with {"enabled": true} hides Frege: the domain becomes an authorization server of its own (issuer https://mcp.example.com), and no Frege address appears in the sign-in. Add google_client_id and google_client_secret to have Google's screen name your app for docs readers; its redirect URI is https://mcp.example.com/oauth/docs/complete. Clients connected before a change sign in again.