[Docs](/docs) /MCP

# feega MCP

feega exposes a Model Context Protocol server so coding agents (Cursor, Claude, and others) can read and write a brand's canvas, posts and ad campaigns directly — with the same OAuth login as the CLI.

```
Your agent
   │  stdio (local)     →  bun run mcp  /  feega-mcp
   │  HTTPS (remote)    →  https://mcp.feega.app/mcp  + Bearer
   ▼
feega API  (/api/v1/*)
```

**No static API tokens.** Authentication is always OAuth (browser login or Bearer from your session).

## Quick start

Pick a transport: local stdio is simplest on your machine; remote HTTP is for cloud hosts.

## Option A — Local stdio

Best for Cursor and other local agents.

1.  Install Bun and clone the feega repo (or install the CLI binary so feega-mcp is on your PATH).
2.  Authenticate once:
    
    ```
    feega login
    # once, in a terminal — the CLI and the local MCP server share one session
    ```
    
3.  Add to Cursor MCP config (absolute path required when using Bun):
    
    ```
    {
      "mcpServers": {
        "feega": {
          "command": "bun",
          "args": ["run", "/ABS/PATH/to/feega/cli/mcp/stdio.ts"]
        }
      }
    }
    ```
    
    If the binary is on PATH after install:
    
    ```
    {
      "mcpServers": {
        "feega": { "command": "feega-mcp" }
      }
    }
    ```
    
4.  Restart Cursor / reload MCP. Call \`query\` on \`brands\`, then work with a brand\_id.

Session file (shared with the CLI): `~/.config/feega/session.json`.

## Option B — Remote HTTP

1.  Confirm the server is up:
    
    ```
    curl -sS https://mcp.feega.app/health
    ```
    
    Expect a JSON health payload with ok: true and mcp: "/mcp".
    
2.  Cursor MCP config:
    
    ```
    {
      "mcpServers": {
        "feega": {
          "url": "https://mcp.feega.app/mcp"
        }
      }
    }
    ```
    
3.  Clients that speak MCP OAuth (opencode, Claude Code, Cursor, the Inspector…) authenticate on their own: on first connect they open `feega.app`, you approve, and the token is stored by the client. The initial **401** is the start of that handshake, not a crash.

Custom option — if your client cannot do OAuth, attach the token by hand: `Authorization: Bearer <access_token>`, using the Supabase access token that `feega login` saves in `~/.config/feega/session.json`. Static API keys (`feega_…`) are not accepted by the remote server.

## Option C — Local HTTP

```
cd cli
bun install
bun run mcp:http
# → http://localhost:8787/mcp
#    http://localhost:8787/health
```

Auth: Bearer or the local session file.

## Auth rules

| Context | How you authenticate |
| --- | --- |
| Local stdio / local HTTP | feega login → shared session file |
| Remote HTTP | OAuth 2.1 + PKCE, or `Authorization: Bearer <access_token>` |
| Static API key | **Not supported** |

Protected resource metadata: `GET /.well-known/oauth-protected-resource`.

## What to call first

1.  `query({ table: "brands", columns: ["id","slug","name"] })` — — confirm auth and see which brands/orgs this session can see
2.  `query({ table: "posts", columns: ["id","status","caption"], where: [...] })` — a brand's pending posts (add a brand\_id filter once you have one)
3.  Ids from list-derived reads accept short unambiguous prefixes; a \`where\` on \`id\` in \`delete\_row\`/\`update\_row\` needs the full id.

Twelve tools total — the CLI is narrower and brand-scoped, and does not expose the six generic ones below.

## Tool areas

query reaches every table your org can see, as you: Postgres RLS returns exactly what you would see in the app. Always name columns, or the character cap drops whole rows to fit a long answer into a short one.

| Area | Examples |
| --- | --- |
| Reading and writing any table | `query`, `insert_row`, `update_row`, `delete_row`, `describe_node_types` |
| Canvas generation | `run_node_generation` |
| Ad campaigns | `list_ad_campaigns`, `create_ad_campaign`, `approve_ad_campaign` |

Full catalog, with parameters and CLI equivalents: [tools.md](https://github.com/andreabuttarelli/feega/blob/main/cli/skills/feega/references/tools.md).

## Troubleshooting

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| 401 on /mcp | Missing or invalid Bearer on remote | Login locally and pass the access token, or use stdio |
| Tools missing | MCP not connected in the host | Check the Cursor MCP panel and restart the host |
| Auth works in CLI but not MCP | Different machine / no session file | Run feega login on the machine running the MCP server |
| 'conflict' on run\_node\_generation | Stale version — someone else wrote the node since you read it | Re-read the node with query, take its current version, retry |

* * *

## Next

-   [Agent skill](/docs/agents) — install the feega skill so agents know when and how to call MCP or the CLI
-   [CLI](/docs/cli) — terminal commands when MCP is not available
-   [API reference](/docs/api) — REST endpoints the CLI calls
-   [feega](https://github.com/andreabuttarelli/feega) — source, tools map, and development notes

[

← Previous

CLI

](/docs/cli)[

Next →

Agent skill

](/docs/agents)

---
Source: https://oh.feega.app/docs/mcp
