Connect an agent (MCP)
Connect Claude Code, Claude.ai, ChatGPT, Cursor or Codex to Prefera over MCP, with a browser sign-in or an API key.
Prefera runs an MCP server. Connect your own AI agent to it and the agent can read your answers, losses and facts, write fixes with its own model, and record what went live. The API and MCP server come with every paid plan.
The server URL#
The MCP server lives at:
https://prefera.si/api/mcp
It speaks Streamable HTTP and takes POST requests only. A browser or a GET request gets a 405. You can copy the same URL, with a copy button, from API & MCP in the app.
Two ways to sign in#
| Way | Use it for | What you do |
|---|---|---|
| Sign in with Prefera (OAuth) | Claude Code, Claude.ai, Claude Desktop, ChatGPT, Cursor, Codex | Approve in your browser. No key to copy. |
| API key | Scripts, servers, automations (n8n, Zapier, CI) and the REST API | Create a key, send it as a Bearer token. |
Sign in with Prefera is the main path. On the approval screen you pick the workspaces, the access level and, under Advanced: limit to areas, which areas the app may use. You can tick several workspaces. See Permissions, approvals and limits.
Claude Code#
Run this once in a terminal. It adds the server for every folder.
claude mcp add --transport http --scope user prefera https://prefera.si/api/mcp
Then in Claude Code type /mcp, pick prefera, choose Authenticate and approve in the browser.
Claude.ai and Claude Desktop#
Both use the same connector list.
- Open Customize, then Connectors.
- Click + Add, then Add custom connector.
- Name it Prefera and paste
https://prefera.si/api/mcp, then Continue. - Under OAuth client choose Register automatically, then Add and sign in with Prefera.
ChatGPT#
- Open ChatGPT Plugins (
chatgpt.com/plugins), click the + button, then Add custom MCP server. - Name it Prefera and paste
https://prefera.si/api/mcp. - Under Authentication choose OAuth, accept the warning, then click Create.
- Sign in with Prefera and approve.
Cursor#
On API & MCP, choose the Cursor tab and click Add to Cursor. Cursor opens, adds Prefera and asks you to sign in.
Codex#
Run two commands in a terminal. The second opens the browser to sign in.
codex mcp add prefera --url https://prefera.si/api/mcp
codex mcp login prefera
Use an API key instead#
Use a key when a client has no browser sign-in, or for a script.
- Open API & MCP in the app.
- Under API keys, for scripts and automations, click Create key. Only an owner or editor can.
- Name it after the tool that will use it, and copy the key. It is shown once.
- Save the key as the environment variable
PREFERA_API_KEY, so it never sits in a config file.
Then connect your client. For Claude Code, save this as .mcp.json in your project, restart Claude Code and check it with /mcp:
{
"mcpServers": {
"prefera": {
"type": "http",
"url": "https://prefera.si/api/mcp",
"headers": { "Authorization": "Bearer ${PREFERA_API_KEY}" }
}
}
}
For Cursor, add this to .cursor/mcp.json (this project) or ~/.cursor/mcp.json (everywhere), then reload Cursor:
{
"mcpServers": {
"prefera": {
"url": "https://prefera.si/api/mcp",
"headers": { "Authorization": "Bearer ${env:PREFERA_API_KEY}" }
}
}
}
For Codex, add this to ~/.codex/config.toml:
[mcp_servers.prefera]
url = "https://prefera.si/api/mcp"
bearer_token_env_var = "PREFERA_API_KEY"
A key belongs to one workspace and acts as the person who made it. Each workspace can have 10 active keys. Revoke a key any time from the same list.
Choose a workspace and brand#
A key reaches one workspace. A Sign in with Prefera connection can reach every workspace you ticked.
- Ask the agent to call
list_brands. It returns each brand with its id, its domain and, for a connection to several workspaces, its workspace. - Pass
brand(the brand id or its domain) to every other tool.
With a single brand you can leave brand out. If a connection reaches several workspaces and you leave it out, the tool answers brand_required and lists the brands.
Check the connection#
Ask your agent: "Call list_brands and tell me the brand names." If it answers, you are connected. Then try losing_questions to see where AI answers do not name you.
Connected apps appear under API & MCP in Connected apps. Revoke there cuts the app off at once.