Skip to content
mofcloud

MCP and OAuth

Last updated:

MOF is an MCP server. Once it is on, AI clients such as Claude Desktop, Cursor and Dify can query the cost data each user is allowed to see. Access is read-only.

Turn on MCP

Administrator

  1. Open Admin → Settings → MCP access.
  2. Turn on “Allow MCP connections”.
  3. Click “Check connection”. MCP service should show “Connected”.

The MCP container ships with the deployment templates; nothing else to install. If the check fails, make sure the mof-mcp container is running and on the same version as MOF.

Set up OAuth

Administrator · needed for Claude Desktop

With OAuth, users paste one address into their AI client and sign in with their MOF account. Without it, they have to create a token by hand, and Claude Desktop cannot use tokens.

  1. Serve MOF over public HTTPS. Claude connects from its own servers, so the address must be reachable from the internet.
  2. Add two variables to the mof service and recreate it:
compose.yaml · mof.environment
MOF_PUBLIC_URL: "https://mof.example.com"
MOF_MCP_OAUTH_SECRET: "REPLACE_WITH_A_RANDOM_SECRET_AT_LEAST_32_CHARACTERS"
  1. In Admin → Settings → MCP access, click “Check connection” again. OAuth sign-in should show “Configured”.

MOF_PUBLIC_URL is the address users open, with no path. The secret needs at least 32 characters and must be the same on every MOF server. “Configured” only means both are set; the first real sign-in from Claude confirms the public callback works. Environment variables

Connect Claude Desktop

Every user

  1. In MOF, open Settings → MCP connections and copy the Server URL.
  2. In Claude Desktop, open Settings → Connectors → Add custom connector. Enter a name such as MOF and paste the address.
  3. Click Connect, sign in with your MOF account in the browser and approve.
  4. Ask Claude a question, for example “How much did we spend last month, by cloud?”
Clients without OAuth: use a token

In Settings → MCP connections → Manual tokens, enter a name and click “Create token”. Copy it right away; it is shown only once and lasts 90 days. Send it as a request header:

Header
Authorization: Bearer YOUR_TOKEN

Revoke access

Users revoke their own apps and tokens in Settings → MCP connections, under “Connected apps” and “My tokens”. Turning off “Allow MCP connections” in Admin cuts every connection at once.