Developers

Run Foan from your AI tools.

Foan hosts a Model Context Protocol server. Give Claude Code, Codex, Cursor, claude.ai, ChatGPT or any MCP client one URL, log in when the browser opens, and your agent can build voice agents, buy numbers, load contacts, run campaigns and top up your wallet. You never need to open a dashboard.

Endpoint
https://api.foan.ai/mcp
Auth
OAuth 2.1, browser login. No API key to copy
Transport
Streamable HTTP, stateless, JSON responses
Health
GET /mcp/health, no auth, reports 37 tools
First five minutes

From nothing to a running campaign, without leaving your agent.

Three steps. The only time you see a browser is the login window, and it closes itself once you approve.

1

Add the server

Paste https://api.foan.ai/mcp into your host. For Claude Code that is one command, shown below.

2

Log in or create your account

A browser window opens. Sign in to Foan, or create an account right there, pick your organisation if you have several, and approve. No key to copy anywhere.

3

Ask your agent to do the work

Create an agent, buy a number, add contacts, start a campaign. Anything that spends money or is hard to undo shows you a preview first and waits for a yes.

Connect

One URL. Your host handles the login.

Every host below runs the standard MCP authorization flow: OAuth 2.1 with PKCE and dynamic client registration. It opens a browser window where you log in to Foan and approve. Behind the scenes the host receives a Foan API key created for it and named after it, which you can see and revoke under API keys at any time.

Claude Code

One command, then run /mcp inside Claude Code, pick foan and choose Authenticate. The browser opens. --scope user makes the server available in every project; without it the server is only active in the directory you ran the command in, which is easy to mistake for not installed.

claude mcp add --transport http --scope user foan https://api.foan.ai/mcp

Codex CLI

Codex detects the login flow on first use and opens the browser. codex mcp login foan forces it. The equivalent ~/.codex/config.toml entry is below the command.

codex mcp add foan --url https://api.foan.ai/mcp
[mcp_servers.foan]
url = "https://api.foan.ai/mcp"

Cursor

Install in Cursor with one click. If the browser does not open on its own, click Needs login next to the server in Cursor's MCP settings. Or add this to .cursor/mcp.json yourself.

{
  "mcpServers": {
    "foan": { "url": "https://api.foan.ai/mcp" }
  }
}

claude.ai and Claude Desktop

Settings, then Connectors, then Add custom connector. Paste the URL, leave the OAuth client id and secret fields empty (the connector registers itself), click Connect and log in.

https://api.foan.ai/mcp

ChatGPT

Settings, then Connectors, then Create (developer mode). Paste the URL, set authentication to OAuth, connect and log in.

https://api.foan.ai/mcp

Any other MCP host

Any client that implements the MCP Authorization spec (2025-06-18) works with just the URL. A request without a token gets HTTP 401 with a WWW-Authenticate header pointing at the protected resource metadata, which is how the host discovers the login flow. To see it for yourself:

curl -si https://api.foan.ai/mcp -X POST -H 'Content-Type: application/json' -d '{}' | grep -i www-authenticate
curl -s https://api.foan.ai/.well-known/oauth-protected-resource/mcp
curl -s https://api.foan.ai/.well-known/oauth-authorization-server

Advanced: automation and CI API key

For scripts, CI and anything without a browser, an API key still works. Create one under API keys in your Foan account and send it as a bearer header. Set FOAN_API_KEY in your shell before running these.

# Claude Code
claude mcp add --transport http --scope user foan https://api.foan.ai/mcp \
  --header "Authorization: Bearer $FOAN_API_KEY"

# Codex CLI
codex mcp add foan --url https://api.foan.ai/mcp --bearer-token-env-var FOAN_API_KEY

# Raw JSON-RPC from anything that can POST
curl -s https://api.foan.ai/mcp \
  -H "Authorization: Bearer $FOAN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Cursor takes the same key in .cursor/mcp.json: add "headers": { "Authorization": "Bearer YOUR_FOAN_API_KEY" } next to the URL. OpenClaw and Hermes take a generic HTTP MCP block with the same header; both are written from their docs and not yet verified end to end.

Foan CLI

One package that logs in and wires up your host. Coming this week

A foan command on npm. foan login opens the browser once, and foan mcp add claude registers the server with Claude Code for you. Same login, same tools, no config files to edit.

npm install -g foan-ai
foan login
foan mcp add claude
Tools

37 tools, grouped by what they touch.

Everything a customer can do in Foan is here: agents, campaigns and their contacts, calls and sessions, numbers, the knowledge base, and the wallet. Every tool carries MCP annotations so your host knows what is safe to run on its own. Read-only tools never change anything. Tools marked confirm return a dry-run preview first and only act when called again with confirm: true.

Read-only never changes data Writes creates or edits Destructive hard to undo Confirm two-step, preview then act

Agents

Reads need agents:read, changes need agents:write
agents_listList the agents in an organisationRead-only
agents_getFull configuration of one agentRead-only
agents_createCreate a Gemini voice agent. identity and task are required, and greeting is required for voice agentsWrites
agents_updateEdit fields and get a before and after diff backWrites
agents_deleteDelete an agentDestructive Confirm
agents_duplicateClone an agentWrites
agents_list_voicesList the available text to speech voicesRead-only

Campaigns and contacts

Reads need campaigns:read, create and add contacts need campaigns:write, start, pause and complete need campaigns:control
campaigns_listList campaignsRead-only
campaigns_getConfiguration and current state of a campaignRead-only
campaigns_createCreate an outbound campaign. Calls run 09:00 to 17:00 by defaultWrites
campaigns_contacts_listContacts of a campaign with their call status and an exact totalRead-only
campaigns_contacts_addAppend up to 500 contacts (phone, optional name and variables). Duplicates are skipped and nothing is removedWrites
campaigns_startStart a campaignDestructive Confirm
campaigns_pausePause a campaignWrites
campaigns_completeMark a campaign completeDestructive Confirm
campaigns_statsCampaign performance statisticsRead-only

Calls and sessions

Reads need calls:read, placing a call needs calls:create
calls_listRecent call sessionsRead-only
calls_getOne call sessionRead-only
calls_get_transcriptTranscript by room nameRead-only
calls_searchSearch across transcriptsRead-only
calls_placePlace an outbound call over the Plivo websocket bridgeDestructive Confirm
sessions_getVoice session by idRead-only
sessions_by_agentSessions for an agent, with offset paginationRead-only
sessions_conversationConversation transcript for a sessionRead-only

Numbers

Reads need numbers:read, purchase, assign and unassign need numbers:write
numbers_listTelephony numbers connected to the organisationRead-only
numbers_searchSearch Plivo inventory by country, type, pattern, region or cityRead-only
numbers_purchaseBuy a Plivo number after reviewing the previewDestructive Confirm
numbers_assignRoute a number's inbound calls to an agentDestructive Confirm
numbers_unassignDetach a number from its agentDestructive Confirm

Knowledge base

Reads need knowledge:read, add and delete need knowledge:write
knowledge_listKnowledge documents of the organisationRead-only
knowledge_getOne knowledge document with its ingestion statusRead-only
knowledge_addAdd a document from text and/or a base64 file, up to 4 MBWrites
knowledge_deleteDelete a document and its chunksDestructive Confirm

Account and wallet

Balance needs wallet:read and billing:read, organisations need org:read, top-up needs wallet:write and an owner or admin login
account_balanceWallet balance, billing status and planRead-only
account_orgOrganisations visible to the connectionRead-only
account_topupQuote a wallet top-up. With confirm, create the order and return a checkout link you open to payDestructive Confirm
foan_helpThe bundled usage guide. No scope neededRead-only

Two prompts ship with the server: create_voice_agent walks through building an agent, and launch_campaign reviews a campaign and starts it only after explicit approval.

Safety

Nothing destructive happens on the first call.

Deleting an agent or a document, starting or completing a campaign, placing a call, buying, assigning or unassigning a number and topping up the wallet all use the same gate. The AI host has to show you what is about to happen and ask before it goes through. Errors from Foan's API come back as tool results, never as transport failures, so the host can show them to you in plain text.

1

Call without confirm

The tool returns a dry-run preview of the target and what would change. No action is taken.

2

Review the preview

Check the agent, campaign, number, document, call or top-up amount in the preview.

3

Call again with confirm: true

Only now does the action run. The same rule applies to every tool marked confirm.

Permissions

You grant permissions on the login screen.

When the browser window opens you approve what the host may do. By default it gets every customer permission below; a host may ask for a narrower set. To change what a host can do, disconnect it and connect again, and you will be asked afresh. A tool that needs a permission the connection does not hold returns Foan API 403: Insufficient scope as its result. For API keys used in automation, the same scopes are chosen when the key is created.

ScopeUnlocks
agents:readList and inspect agents, list voices
agents:writeCreate, update, duplicate and delete agents
campaigns:readList and inspect campaigns, contacts and campaign statistics
campaigns:writeCreate campaigns and add contacts
campaigns:controlStart, pause and complete campaigns
calls:readCall history, transcripts, search and voice sessions
calls:createPlace an outbound call
numbers:readList connected numbers and search inventory
numbers:writePurchase, assign and unassign numbers
knowledge:readList and inspect knowledge documents
knowledge:writeAdd and delete knowledge documents
wallet:read, billing:readWallet balance, billing status and plan
wallet:writeTop up the wallet. The logged-in user must also be an owner or admin of the organisation
org:readOrganisations visible to the connection
Good to know

Behaviour worth reading once.

Organisation resolution

Tools that take org_id use it when given. Otherwise the server uses the organisation you picked at login, or the one the API key belongs to. If a connection can see several organisations, pass org_id explicitly.

What the host holds

The token your host stores is a Foan API key created for it and named after it. Foan API keys do not expire; a refresh rotates the key and revokes the old one. You can revoke any host's key under API keys in your account, and it stops working immediately.

Pagination and size

List tools return 20 records by default and cap limit at 100. Use page where supported, offset for sessions_by_agent, and fields to trim each item to the keys you need. Results are cut at roughly 30 KB with a note to narrow the request.

Plivo only, websocket only

Calls always go over the Plivo websocket bridge. SIP is not exposed. Connecting an existing Plivo account is not done through MCP, so your Plivo auth token never passes through an AI host.

Gemini voice agents

Only Gemini voice agents can be created through agents_create. agents_update exposes language_accent, the field Gemini agents act on.

Secrets never reach the model

Every tool result is scrubbed before it leaves the server. Credential-shaped values such as tokens, passwords and API keys, including ones inside URLs, are replaced with [redacted]. The MCP endpoint also has its own rate limit per connection, separate from the REST API.

Build on Foan from the tools you already use.

Add the URL to your host, log in when the browser opens, and ask your assistant to create your first agent.