Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview
On this page

Claude Code

Connect Claude Code to Anlyon's MCP server so it calls your production APIs through governed actions, with OAuth sign-in or an API key.

Claude Code is good at production work: filing the GitHub issue, refunding the charge, updating the CRM record. To do it directly, it needs your API tokens in its environment, where any tool it runs can read them, and nothing stops a wrong call from going out.

Connect Claude Code to Anlyon instead. Your workspace’s actions appear as tools. Claude Code names an action and passes input; Anlyon adds the credential at dispatch, so Claude Code never holds one. A risky call waits for an approver before anything is sent, impact limits cap what calls can do, and every call leaves a receipt you can audit.

This covers calls routed through Anlyon. A call Claude Code makes directly, with a token it holds, is not governed by Anlyon.

Connect Claude Code with OAuth

Claude Code connects to Anlyon’s hosted MCP server over streamable HTTP and signs you in with OAuth (“Login with Anlyon”). There is no key to paste.

Add the server

claude mcp add --transport http anlyon https://api.anlyon.com/mcp

This adds it for you in the current project (Claude Code’s default local scope). Add --scope user to use it in every project, or --scope project to write it to the project’s .mcp.json for your team.

Sign in

Inside Claude Code, run:

/mcp

Select anlyon and authenticate. A browser opens. Sign in to Anlyon or create an account, choose the workspace and environment Claude Code acts in, and choose permissions. Actions is on. Approve on your behalf and Switch between your workspaces are off unless you turn them on. From a shell, claude mcp login anlyon does the same.

Check the tools

Run /mcp again. anlyon shows as connected, with its tools. Ask Claude Code “What Anlyon actions can you run?” and it calls list_actions.

To sign out, choose Clear authentication for anlyon in the /mcp menu, or remove the app from the console’s settings.

Connect Claude Code with an API key

Use a key where no browser is available, such as CI, or when the key’s scopes should define exactly what Claude Code can do. Create the key in the console under Settings → API keys with actions:read, actions:invoke and approvals:read (all in the Standard preset). Add approvals:write if Claude Code should call request_approval.

Put it in a project’s .mcp.json, read from the environment so the key never lands in the repository:

{
  "mcpServers": {
    "anlyon": {
      "type": "http",
      "url": "https://api.anlyon.com/mcp",
      "headers": {
        "Authorization": "Bearer ${ANLYON_API_KEY}"
      }
    }
  }
}

Claude Code expands ${ANLYON_API_KEY} when it starts. A url entry needs "type": "http".

Or add it from the command line. The shell expands the variable now and Claude Code stores the value in your local configuration:

claude mcp add --transport http anlyon https://api.anlyon.com/mcp \
  -H "Authorization: Bearer $ANLYON_API_KEY"

A key belongs to one environment, so list_workspaces and select_workspace do not apply.

Act as one of your users

To test what your product’s agent does for one of your users, in that user’s own connected accounts, add the Anlyon-End-User header. It works with an API key only.

{
  "mcpServers": {
    "anlyon-as-user": {
      "type": "http",
      "url": "https://api.anlyon.com/mcp",
      "headers": {
        "Authorization": "Bearer ${ANLYON_API_KEY}",
        "Anlyon-End-User": "user_123"
      }
    }
  }
}

Every call then uses user_123’s connections, limits and approvals. See Act for one of your users.

Run the server as a local process

The npm package runs the same tools over stdio, with the key in its environment:

claude mcp add --env ANLYON_API_KEY=$ANLYON_API_KEY --transport stdio anlyon -- npx -y @anlyonhq/mcp-server

Add --end-user user_123 after @anlyonhq/mcp-server to act for one user.

Use the tools

Tool What it does
action_<name> One tool per enabled action, with its own input schema. A new action appears within 30 seconds
list_actions Lists the actions and says which need approval
invoke_action Invokes an action by name
request_approval Asks a person to decide something that is not an action
check_approval Reads an approval’s status once
wait_for_approval Waits for the decision, 60 seconds by default, 120 at most. Returns the still-pending approval when time runs out
list_pending_approvals, decide_approval Review approvals. With OAuth, shown only with Approve on your behalf. With a key, needs approvals:decide
list_workspaces, select_workspace See and switch the workspace. OAuth only. Switching needs Switch between your workspaces

With OAuth, Claude Code sees only the tools the permissions you granted cover. See Tools for the full reference.

Call an action that needs approval

Ask Claude Code:

Set ticket T-1042 to priority high. If it needs approval, wait for the decision and tell me what happened.
  1. Claude Code calls action_update-ticket-priority with { "ticketId": "T-1042", "priority": "high" }.
  2. The action is gated, so nothing is sent. The tool answers Awaiting human approval. Call wait_for_approval with approvalId=apr_....
  3. Claude Code calls wait_for_approval. An approver decides in the console, in Slack or from their own MCP connection.
  4. The tool returns the approval with "status": "approved", who decided, and payload.invocationId. Anlyon has run the exact request that was reviewed. If the status is still pending, Claude Code calls wait_for_approval again. If it is denied or expired, nothing was sent.

The outcome of the call is on the invocation, in the console’s invocation log. An outcome of unknown means the request may have reached the destination. Claude Code should not call the action again; you check the destination and resolve it. See When the outcome is unknown.

Review approvals from Claude Code

With Approve on your behalf granted, list_pending_approvals and decide_approval let you review from Claude Code. Your decision is recorded against your name, with your reason as the note, and counts as one user toward an approval that needs several approvers.

You can never decide an approval that your own agent requested, whether Claude Code or any other app signed in as you, or a key you created. A teammate decides it. If nobody else in the environment can decide approvals, decide it yourself in the console or in Slack.

Connect one integration only

Each integration has its own MCP server, which serves that integration’s actions plus check_approval and wait_for_approval, and nothing else from your workspace:

claude mcp add --transport http anlyon-github https://api.anlyon.com/mcp/github

Then run /mcp to sign in. See One integration’s MCP server for every address.

Tell Claude Code how this project uses Anlyon

Add a block to CLAUDE.md at the project root:

## Anlyon
- Production calls go through Anlyon actions, not direct API calls. Find them with the Anlyon `list_actions` tool and call one through its `action_<name>` tool.
- Never ask for, print or store a provider credential. Anlyon adds it when the call is sent.
- If an action needs approval, call `wait_for_approval` with the `apr_` id and report the decision.
- An invocation with status `unknown` may have taken effect. Do not retry it; tell me so I can reconcile.
- Docs: https://docs.anlyon.com/llms.txt

To set a project up to call Anlyon from its own code, paste the agent setup prompt into Claude Code instead.

Fix connection errors

What you see Why What to do
anlyon shows “needs authentication” No sign-in yet, or the sign-in was cleared or disconnected Run /mcp, select anlyon, authenticate
A browser opens although you configured a key The key was refused with 401, so Claude Code fell back to OAuth Check the key is set in the environment Claude Code started from, and that it is not revoked or expired
API key is missing required scope: actions:invoke The key lacks that scope Add the scope to the key
This authorization is missing required scope: ... The OAuth grant lacks that permission group Clear authentication and sign in again, granting the group
400 END_USER_HEADER_NOT_ALLOWED Anlyon-End-User was sent with an OAuth sign-in Act for a user with an API key
400 END_USER_REQUIRED The key requires an end user and no Anlyon-End-User was sent Add the header
"status": "connect_required" The end user has not connected the integration. Nothing was sent Open connectUrl as that user, then ask again
Unknown tool: ... The tool is not served to this connection Grant its permission group, or use https://api.anlyon.com/mcp rather than one integration’s server

See Fix a refused connection or call for the full list.

  • MCP servers: the full reference for the hosted server, integration servers and the npm package
  • Cursor and Codex: the same server in other tools
  • Actions: define what Claude Code can call
  • Approvals: policies and approvers
  • Anlyon CLI: list actions, invoke them and decide approvals from a shell

Was this page helpful?