# Connect an MCP client

Add the Provenance MCP server to Claude, ChatGPT, Cursor, Claude Code, VS Code or any Streamable HTTP client, starting with the sandbox address.

Add Provenance to your MCP client with one address. Start with the sandbox, `https://sandbox-mcp.provenanceauth.com`; the live server is `https://mcp.provenanceauth.com`. The tools you see depend on who signs in ([who signs in](https://provenanceauth.com/docs/provenance-mcp.md#what-you-see-depends-on-who-signs-in)).

**Before you begin:** to sign in as yourself, set up Provenance with a passkey; to sign in for a business, have a console account; to connect an agent, export a sandbox API key.

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
```

## Claude

1. Open **Settings → Connectors → Add custom connector**.
2. Name it Provenance and paste `https://sandbox-mcp.provenanceauth.com`.
3. Choose **Connect**. Claude opens Provenance: pick who you're connecting as, then confirm.

## ChatGPT

1. Open **Settings → Apps & Connectors → Advanced** and turn on **Developer mode**.
2. Choose **Create**, name it Provenance and paste `https://sandbox-mcp.provenanceauth.com`.
3. ChatGPT opens Provenance: pick who you're connecting as, then confirm.

## Cursor

Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project. Cursor opens the sign-in the first time it calls the server:

```json
{
  "mcpServers": {
    "provenance": {
      "url": "https://sandbox-mcp.provenanceauth.com"
    }
  }
}
```

For an agent, send the key instead of signing in:

```json
{
  "mcpServers": {
    "provenance": {
      "url": "https://sandbox-mcp.provenanceauth.com",
      "headers": { "Authorization": "Bearer ${env:PROVENANCE_KEY}" }
    }
  }
}
```

## Other clients

### Claude Code

```bash norun
claude mcp add --transport http provenance https://sandbox-mcp.provenanceauth.com
```

Run `/mcp` in Claude Code and choose **Authenticate**. For an agent, add `--header "Authorization: Bearer $PROVENANCE_KEY"` and skip the sign-in.

### VS Code

Add the server to `.vscode/mcp.json` in your workspace:

```json
{
  "servers": {
    "provenance": {
      "type": "http",
      "url": "https://sandbox-mcp.provenanceauth.com"
    }
  }
}
```

### Any Streamable HTTP client

Any client that speaks MCP over Streamable HTTP connects with the same address. An agent sends its key as `Authorization: Bearer` or `X-Api-Key`, and each request is one JSON-RPC call:

**curl**

```bash norun
curl https://sandbox-mcp.provenanceauth.com \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0", "id": 1, "method": "tools/call",
    "params": { "name": "authorize_action", "arguments": {
      "action_description": "Pay invoice INV-2041: $450.00 to Brindlecote Supplies",
      "agent_session_id": "sess_mcp_1",
      "device_id": "dev_00000000000000000000000000000001"
    } }
  }'
```

**Node**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(new URL("https://sandbox-mcp.provenanceauth.com"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` } },
});
const client = new Client({ name: "treasury-agent", version: "1.0.0" });
await client.connect(transport);
const result = await client.callTool({
  name: "authorize_action",
  arguments: {
    action_description: "Pay invoice INV-2041: $450.00 to Brindlecote Supplies",
    agent_session_id: "sess_mcp_1",
    device_id: "dev_00000000000000000000000000000001",
  },
});
console.log(result.structuredContent);
```

**Python**

```python
import os
import httpx

key = os.environ["PROVENANCE_KEY"]
result = httpx.post(
    "https://sandbox-mcp.provenanceauth.com",
    headers={"Authorization": f"Bearer {key}", "Accept": "application/json, text/event-stream"},
    json={"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "authorize_action", "arguments": {
        "action_description": "Pay invoice INV-2041: $450.00 to Brindlecote Supplies",
        "agent_session_id": "sess_mcp_1",
        "device_id": "dev_00000000000000000000000000000001",
    }}},
).json()
```

The result carries the API response in `structuredContent`, and the same object after a one-line outcome in the text:

```json
{
  "result": {
    "content": [
      { "type": "text", "text": "Authorized: pass the token to whoever runs the action; they call verify_intent once.\n\n{ … }" }
    ],
    "structuredContent": {
      "object": "intent_authorization",
      "intent_token": "eyJhbGciOiJFUzI1NiIs…",
      "expires_at": "2026-10-24T17:52:36.000Z",
      "biometric_bound": false,
      "idempotency_key": "idem_5b0c2f3e-8d41-4a5e-9c1b-7f2a6d3e9b10"
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}
```

### Check a business with no key

Add `?toolsets=verify` to the address to list only the keyless tools, with no sign-in: `https://sandbox-mcp.provenanceauth.com/?toolsets=verify`. See [cart approvals and business checks](https://provenanceauth.com/docs/provenance-mcp/agent-tools.md#tools-that-need-no-key).

## Run the server locally

The `@provenanceauth/mcp-server` package runs the agent tools over stdio, for a client that starts local servers. The key goes in the environment, never on the command line:

**This package isn't on npm yet.** Until then, every request in these docs runs over HTTP against the [sandbox](https://provenanceauth.com/docs/get-started/sandbox.md).

With access to the private Provenance repository, which your Provenance contact grants, install from it:

```bash
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-rails-1.0.0.tgz ../provenance-packs/provenanceauth-mcp-server-1.0.0.tgz
```

`PROVENANCE_BASE_URL` is optional; it points the server at a different Provenance API, such as the sandbox. Started without `PROVENANCE_API_KEY`, the server lists only the keyless tools.

## Sign in

The first time the client calls the server without a credential, it opens Provenance:

1. The account picker lists **You, personally** when you're signed in with your passkey, and your business account when you're signed in to the console. Pick one.
2. Check the app's name, the website it identifies itself with, and where your browser returns.
3. Confirm. A person confirms with their passkey.

Developer tools ask for the console's developer access on the sandbox; a developer, admin or owner can connect them ([Developer tools](https://provenanceauth.com/docs/provenance-mcp/developer-tools.md)). Add `?as=personal` or `?as=account` to the address to preselect a row on the picker.

## MCP versions

The server speaks both MCP eras. Clients on 2025-11-25 or earlier start with `initialize`. Clients on 2026-07-28 send no `initialize` and no session id: each request carries its protocol version and client capabilities in `params._meta`, and the `MCP-Protocol-Version`, `Mcp-Method` and (for `tools/call`) `Mcp-Name` headers repeat what the body says:

```json
{
  "jsonrpc": "2.0", "id": 1, "method": "tools/call",
  "params": {
    "name": "get_policy", "arguments": {},
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": { "elicitation": { "url": {} } }
    }
  }
}
```

`server/discover` returns the server's capabilities and `supportedVersions`, and every result carries `resultType`. A header that disagrees with the body gets `400` with code `-32020`. A version neither era serves gets `400` with code `-32022`, listing the versions served in `data.supported`, 2026-07-28 first.

## For client builders

The server follows the MCP authorization spec:

| Part | Where |
| --- | --- |
| Protected resource metadata | `/.well-known/oauth-protected-resource` on the server's address, and `/.well-known/oauth-protected-resource/v1/mcp` on the API. It names the server's address as `resource` and lists no scopes. |
| Authorization server metadata | `/.well-known/oauth-authorization-server` on the API |
| Client registration | [`POST /v1/oauth/register`](https://provenanceauth.com/docs/api/mcp-authorization.md#post-v1-oauth-register), or a Client ID Metadata Document |
| Authorization | The code flow with PKCE (S256 only, `state` required, exact redirect URIs) |
| Tokens | [`POST /v1/oauth/token`](https://provenanceauth.com/docs/api/mcp-authorization.md#post-v1-oauth-token) issues 1-hour access tokens and rotating refresh tokens; reusing a rotated refresh token ends the connection |

Every token carries the server's address as its audience. Every `401` from the server carries `WWW-Authenticate: Bearer resource_metadata="…"` with no `scope` parameter, so a client asks only for the scopes of the family it signs in as. A call outside the token's scopes answers `403` with `error="insufficient_scope"` naming scopes of the same family.

A terminal client signs a person in with the device authorization grant (RFC 8628): [`POST /v1/oauth/device_authorization`](https://provenanceauth.com/docs/api/mcp-authorization.md#post-v1-oauth-device-authorization), then [`POST /v1/oauth/token`](https://provenanceauth.com/docs/api/mcp-authorization.md#post-v1-oauth-token) with `grant_type=urn:ietf:params:oauth:grant-type:device_code` returns an assistant key once. To say what a person's assistant will do, add `authorization_details` to the authorization URL: up to 5 `provenance_action` objects (RFC 9396), as in [CIBA and RAR](https://provenanceauth.com/docs/mandate/concepts/ciba-and-rar.md).

### A person's connected tools

For a person, `tools/list` returns the server's own tools and then the services the person gave this client, each named `<service>.<tool>` with the service's own input schema. A call to one is checked and sent to the service, and its result comes back unchanged. A call that isn't allowed returns a tool error with one of these in `structuredContent.reason`:

| Reason | Meaning |
| --- | --- |
| `tool_not_granted` | The person hasn't given this client the tool. |
| `approval_pending` | The call waits for the person (`approval.approve_url`); call again with the same arguments once they approve. |
| `approval_denied` | The person rejected this exact call. |
| `tool_denied_by_rule` | The person's rule, or an open takeover warning, rejects it. |
| `tool_connection_needs_reconnect` | The person needs to reconnect the service. |
| `tool_upstream_unavailable` | The service didn't answer; nothing was done. |
| `tool_call_allowance_reached` | The person's free calls for the month are used. |

Each `initialize` gets an `Mcp-Session-Id`; send it on every later request so the person sees one session per window, and send a `DELETE` with it to end the session. On 2026-07-28 the connection is the session; an assistant that wants one session per window calls `record_session` and sends the handle in `_meta["com.provenanceauth/session"]`. A call from a session the person stopped returns `reason: "session_stopped"`, and one outside the session's limits returns `reason: "session_limit"`.

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `401` with a `WWW-Authenticate` header | No credential, or an expired one | Sign in, or send `Authorization: Bearer` with a valid key. |
| `401` on a developer connection made before the move to one server | Its token names the old address as its audience | Sign in again from your client. |
| A tool you expect isn't listed | The key lacks that product, or you signed in as another family | Use a key with the product, or connect again and pick the other row. |
| A tool result with `isError: true` naming [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope) | The credential lacks the scope the tool needs | Use a key or sign-in that holds it. |
| [`mcp_oauth_not_configured`](https://provenanceauth.com/docs/platform/errors.md#mcp_oauth_not_configured) | This deployment doesn't offer MCP sign-in | Connect with an API key, or use the address Provenance shows. |
| [`invalid_grant`](https://provenanceauth.com/docs/platform/errors.md#invalid_grant) | The code or refresh token was used, expired, or doesn't match | Connect again. |
| `400` with code `-32020` | A 2026-07-28 request's headers don't match its body | Send headers that repeat the body's version, method and tool name. |
| `400` with code `-32022` | The request names a protocol version neither era serves | Use a version from `data.supported`. |

## See also

- [Provenance MCP](https://provenanceauth.com/docs/provenance-mcp.md): who signs in and what each one sees.
- [Agent tools](https://provenanceauth.com/docs/provenance-mcp/agent-tools.md): the tools an API key lists.
- [Connect your assistant](https://provenanceauth.com/help/personal/guides/connect-your-assistant): the same steps for people.
- [Connected apps](https://provenanceauth.com/docs/account/connected-apps.md): see and revoke the apps connected to your account.
