---
title: "Cursor"
description: "Connect Cursor to Anlyon's MCP server so its agent calls your production APIs through governed actions, with OAuth sign-in or an API key."
icon: "mouse-pointer"
---

Cursor's agent can do production work, such as opening the issue, updating the deal or refunding the charge, but only with your API tokens in its reach, and nothing checks a call before it goes out.

Connect Cursor to Anlyon instead. Your workspace's actions appear as tools. The agent names an action and passes input; Anlyon adds the credential at dispatch, so Cursor never holds one. A risky call waits for an approver before anything is sent, [impact limits](/execution/impact-limits) cap what calls can do, and every call leaves a receipt.

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

## Connect Cursor with OAuth

Cursor connects to Anlyon's hosted MCP server and signs you in with OAuth ("Login with Anlyon"). There is no key to paste.

1. **Add the server**

    Create `.cursor/mcp.json` in your project for that project only, or `~/.cursor/mcp.json` for every project:

    ```json
    {
      "mcpServers": {
        "anlyon": {
          "url": "https://api.anlyon.com/mcp"
        }
      }
    }
    ```

    You can also add the same URL from Cursor's MCP settings.

2. **Sign in**

    Cursor shows that `anlyon` needs a sign-in. Start it, and a browser opens. Sign in to Anlyon or create an account, choose the workspace and environment Cursor acts in, and choose permissions. **Actions** is on. **Approve on your behalf** and **Switch between your workspaces** are off unless you turn them on. Cursor registers itself with Anlyon and refreshes the token for you.

3. **Check the tools**

    Cursor's MCP settings list `anlyon` with its tools. Ask the agent "What Anlyon actions can you run?" and it calls `list_actions`.

## Connect Cursor with an API key

Use a key where no browser sign-in is possible, or when the key's scopes should define exactly what Cursor can do. Create it in the [console](https://console.anlyon.com) under **Settings → API keys** with `actions:read`, `actions:invoke` and `approvals:read` (all in the **Standard** preset). Add `approvals:write` if the agent should call `request_approval`.

Read the key from the environment, so it never lands in a committed file:

```json
{
  "mcpServers": {
    "anlyon": {
      "url": "https://api.anlyon.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:ANLYON_API_KEY}"
      }
    }
  }
}
```

Cursor resolves `${env:NAME}` in `url`, `headers`, `command`, `args` and `env`. Set `ANLYON_API_KEY` in the environment Cursor starts from.

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 `Anlyon-End-User`. It works with an API key only:

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

See [Act for one of your users](/agents/mcp-servers#act-for-one-of-your-users).

### Run the server as a local process

The npm package runs the same tools over stdio:

```json
{
  "mcpServers": {
    "anlyon": {
      "command": "npx",
      "args": ["-y", "@anlyonhq/mcp-server"],
      "env": { "ANLYON_API_KEY": "${env:ANLYON_API_KEY}" }
    }
  }
}
```

Add `"--end-user", "user_123"` to `args` 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, Cursor sees only the tools the permissions you granted cover. See [Tools](/agents/mcp-servers#tools) for the full reference.

## Call an action that needs approval

Ask the agent:

```text
Set ticket T-1042 to priority high. If it needs approval, wait for the decision and tell me what happened.
```

1. The agent 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. The agent 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 it is still `pending`, the agent calls `wait_for_approval` again. If it is `denied` or `expired`, nothing was sent.

The outcome is on the invocation, in the console's invocation log. An outcome of `unknown` means the request may have reached the destination: do not call the action again. See [When the outcome is unknown](/execution/when-the-outcome-is-unknown).

## Review approvals from Cursor

With **Approve on your behalf** granted, `list_pending_approvals` and `decide_approval` let you review from Cursor. Your decision is recorded against your name, with your reason as the note.

You can never decide an approval that your own agent requested, whether Cursor 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 with that integration's actions plus `check_approval` and `wait_for_approval`:

```json
{
  "mcpServers": {
    "anlyon-github": {
      "url": "https://api.anlyon.com/mcp/github"
    }
  }
}
```

See [One integration's MCP server](/agents/mcp-servers#one-integrations-mcp-server) for every address.

## Tell Cursor how this project uses Anlyon

Add a rule file such as `.cursor/rules/anlyon.mdc`:

````markdown
## 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](/agents/prompt) into Cursor instead.

## Fix connection errors

| What you see | Why | What to do |
| --- | --- | --- |
| `anlyon` asks you to sign in | No sign-in yet, or the app was disconnected in the console | Sign in again from Cursor's MCP settings |
| A sign-in prompt although you configured a key | The key was refused with `401`, so Cursor fell back to OAuth | Check `ANLYON_API_KEY` is set where Cursor starts, and that the key 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 | Sign in again and grant 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 |

See [Fix a refused connection or call](/agents/mcp-servers#fix-a-refused-connection-or-call) for the full list.

## Related

- [MCP servers](/agents/mcp-servers): the full reference
- [Claude Code](/agents/claude-code) and [Codex](/agents/codex): the same server in other tools
- [Actions](/execution/actions): define what Cursor can call
- [Approvals](/trust-control/approvals): policies and approvers
