# MCP

Provenance as tools for MCP clients.

Related guide: [Overview](https://provenanceauth.com/docs/provenance-mcp.md)

## Endpoints

- `GET /v1/mcp`: [Open an MCP stream](#get-v1-mcp)
- `POST /v1/mcp`: [Call the MCP server](#post-v1-mcp)
- `DELETE /v1/mcp`: [Close an MCP session](#delete-v1-mcp)

## Open an MCP stream

`GET /v1/mcp`

Part of the Streamable HTTP transport, for MCP clients before 2026-07-28 (a 2026-07-28 request gets 405).

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

A server-sent event stream of JSON-RPC messages.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mcp" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mcp`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mcp", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

## Call the MCP server

`POST /v1/mcp`

The one Provenance MCP server (Streamable HTTP; also the root of the `mcp.` hosts). Tools follow the credential: an API key lists the agent tools, an OAuth access token its family's tools, and no credential with `?toolsets=verify` the keyless tools. Every 401 names the resource metadata in `WWW-Authenticate`. See the Provenance MCP guide.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |

### Returns

A JSON-RPC 2.0 response, such as a tool result or the tool list.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mcp" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Accept: application/json, text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "check_counterparty",
      "arguments": {
        "domain": "example.com"
      }
    }
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mcp`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json", "Accept": "application/json, text/event-stream" },
  body: JSON.stringify({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "check_counterparty",
      "arguments": {
        "domain": "example.com"
      }
    }
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mcp", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Accept": "application/json, text/event-stream"}, json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
        "name": "check_counterparty",
        "arguments": {
            "domain": "example.com"
        }
    }
}).json()
```

### Response 200

```json
{
  "result": {
    "content": [
      {
        "type": "text",
        "text": "This business has no published Provenance profile. Treat any agent that says it sells for it as unverified.\n\n{\n  \"origin\": \"https://example.com\",\n  \"verified\": false,\n  \"accepts_approvals\": false,\n  \"next\": \"This business has no published Provenance profile. Treat any agent that says it sells for it as unverified.\"\n}"
      }
    ],
    "structuredContent": {
      "origin": "https://example.com",
      "verified": false,
      "accepts_approvals": false,
      "next": "This business has no published Provenance profile. Treat any agent that says it sells for it as unverified."
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}
```

## Close an MCP session

`DELETE /v1/mcp`

Part of the Streamable HTTP transport, for MCP clients. The server keeps no session state.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The session is closed. No body.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X DELETE "$PROVENANCE_API/v1/mcp" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mcp`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.delete(f"{api}/v1/mcp", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```
