> ## Documentation Index
> Fetch the complete documentation index at: https://docs.preceptai.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Up the MCP Server

> Connect Precept's MCP server to Claude (web, desktop and Claude Code), ChatGPT, Cursor, Codex or a custom AI agent built with the MCP SDK.

## Before you start

* **Hosted connectors** (Claude web & desktop, ChatGPT, Claude Code over HTTP) sign you in to Precept with OAuth 2.1. There's no API key to copy: Precept creates one for the connector, and new accounts start on the free Starter trial (no card needed).
* **Local setups** (`npx`, for Claude Code, Cursor, Codex, Claude Desktop local mode or your own agent) need an API key. Sign in at [app.preceptai.co.uk](https://app.preceptai.co.uk/auth), open the [Developer page](https://app.preceptai.co.uk/developer), click **Generate New API Key** and copy it (keys start with `pt_`). The server reads it from the `PRECEPT_API_KEY` environment variable.

## Connect your client

> [tab] Claude (web & desktop)
>
> Uses the hosted server. Once added, the connector is available on Claude web, desktop and mobile.
>
> 1. In Claude, open **Settings → Connectors → Add custom connector** and fill in:
>
>    * **Name:** `Precept AI`
>    * **MCP server URL:** `https://precept-mcp-server-production.up.railway.app/mcp`
>
>    Click **Continue**.
> 2. Leave the options Claude detects (**Sign in now**, **Use your own OAuth client**) as they are, enter the OAuth client ID `claude`, leave the client secret blank, and click **Add**.
> 3. Click **Connect** next to Precept AI and sign in to Precept (or create a free account) in the window that opens. It closes once you're connected.
>
> Step-by-step screenshots: [preceptai.co.uk/mcp/claude](https://www.preceptai.co.uk/mcp/claude).

> [tab] Claude Code
>
> Run the server locally with your API key:
>
> ```bash theme={null}
> claude mcp add --env PRECEPT_API_KEY=pt_your_api_key_here precept -- npx -y @preceptai/mcp-server
> ```
>
> Add `--scope user` to make Precept available in every project, or `--scope project` to save it to the project's `.mcp.json`.
>
> Or use the hosted server and sign in with OAuth:
>
> ```bash theme={null}
> claude mcp add --transport http precept https://precept-mcp-server-production.up.railway.app/mcp
> ```
>
> Then run `/mcp` inside Claude Code and sign in to Precept.

> [tab] ChatGPT
>
> Uses the hosted server.
>
> 1. Go to [chatgpt.com/plugins](https://chatgpt.com/plugins), click **Add**, then **Add custom MCP server**.
> 2. Fill in:
>    * **Name:** `Precept AI`
>    * **Server URL** (under Connection): `https://precept-mcp-server-production.up.railway.app/mcp`
>    * **Authentication:** `OAuth`
> 3. Open **Advanced OAuth settings**, choose **User-Defined OAuth Client** as the registration method and **none** as the token auth method, and enter the client ID `chatgpt`. Tick **I understand and want to continue**, then click **Create as a plugin**.
> 4. Click **Connect Precept AI** and sign in to Precept (or create a free account) in the window that opens.
>
> Step-by-step screenshots: [preceptai.co.uk/mcp/openai](https://www.preceptai.co.uk/mcp/openai).

> [tab] Cursor
>
> Add Precept to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "precept": {
>       "command": "npx",
>       "args": ["-y", "@preceptai/mcp-server"],
>       "env": {
>         "PRECEPT_API_KEY": "pt_your_api_key_here"
>       }
>     }
>   }
> }
> ```
>
> Or add it in **Settings → MCP → Add new MCP server** with the command `npx -y @preceptai/mcp-server` and the `PRECEPT_API_KEY` environment variable. When the server shows a green dot, it's ready.

> [tab] Codex
>
> ```bash theme={null}
> codex mcp add precept --env PRECEPT_API_KEY=pt_your_api_key_here -- npx -y @preceptai/mcp-server
> ```

> [tab] Claude Desktop (local)
>
> If you prefer running the server on your machine instead of the hosted connector, add this to `claude_desktop_config.json` and restart Claude Desktop:
>
> * **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
> * **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "precept": {
>       "command": "npx",
>       "args": ["-y", "@preceptai/mcp-server"],
>       "env": {
>         "PRECEPT_API_KEY": "pt_your_api_key_here"
>       }
>     }
>   }
> }
> ```

## Use it from your own agent

Any MCP client can call Precept's tools directly, with or without an LLM in the loop. This example uses the official TypeScript SDK (`npm install @modelcontextprotocol/sdk @preceptai/mcp-server`):

```typescript theme={null}
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const transport = new StdioClientTransport({
  command: "node",
  args: ["node_modules/@preceptai/mcp-server/dist/index.js"],
  env: { ...process.env, PRECEPT_API_KEY: process.env.PRECEPT_API_KEY! },
});

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

// Start a lead search: returns an enrichment_id immediately
const started = await client.callTool({
  name: "precept_search_leads",
  arguments: {
    query: "Heads of RevOps at B2B SaaS companies in the UK",
    limit: 20,
  },
});

// Then poll precept_get_job_status with that enrichment_id until it completes
console.log(started.structuredContent);

await client.close();
```

To give an LLM these tools, pass the result of `client.listTools()` into its tool definitions and forward its tool calls to `client.callTool()`. A full agent-loop example with the Claude API is on [preceptai.co.uk/mcp/code](https://www.preceptai.co.uk/mcp/code).

## Check it works

Ask your assistant:

> Check my Precept credits.

It should call `precept_check_credits` and reply with your balance. Then try a real request, for example *"Find 10 Heads of Growth at Series A fintechs in London"*.

## Troubleshooting

| Problem | Fix |
| :- | :- |
| Tools don't appear | Restart the client after editing its config. For `npx` setups, check that Node.js is installed (`node -v`). |
| `401` / authorization errors | Hosted: disconnect and reconnect the connector to sign in again. Local: generate a new key on the [Developer page](https://app.preceptai.co.uk/developer) and update `PRECEPT_API_KEY`. |
| Outdated tools or parameters | Use `npx -y @preceptai/mcp-server@latest`, or ask the assistant to run `precept_check_version`. |
| Fewer results than requested | Precept caps a job at what your credit balance covers. Check with `precept_check_credits`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.