Connect a client
Use a client that supports Streamable HTTP. Choose an API bearer token for an agent on your own server, or OAuth for a client where each person signs in separately.
For guided setup, see Use with Claude or Use with ChatGPT. The protocol sections below are for developers building or configuring an MCP client.
POST https://app.archive.com/api/v2/mcp Option 1: Bearer token
For an agent running on your own server, create an API token in Archive’s Integration tab.
Send it in the Authorization header. The same token works with GraphQL at /api/v2.
{
"mcpServers": {
"archive": {
"type": "http",
"url": "https://app.archive.com/api/v2/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
} This example shows the required URL and header. Check your client’s configuration format for the exact key names. If it cannot send a static header, use OAuth.
Option 2: OAuth 2.1
Use OAuth when each person should sign in and authorize their own connection. Archive provides the authorization server. A client that supports discovery can start with only the endpoint URL:
- The client calls the endpoint without credentials and gets HTTP 401 with a
WWW-Authenticatechallenge naming the protected-resource metadata URL. - It fetches that metadata (RFC 9728), then the authorization-server metadata (RFC 8414).
- It registers itself if needed via Dynamic Client Registration
(RFC 7591) at
POST /oauth/register. - It sends the person to
/oauth/authorize. They log in and consent, choosing whether to grant the optional write scope. - It exchanges the authorization code at
/oauth/tokenfor an access token and uses that as the bearer credential.
Archive issues opaque tokens. The client sends the token without decoding it.
Verify the connection
Call getWorkspaces first to test the connection. It does not require a workspace argument.
Its response lists the workspace IDs you can use in subsequent calls.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "getWorkspaces",
"arguments": {}
}
} HTTP 401 means authentication failed. HTTP 200 with isError: true means authentication passed,
but the tool failed. Read the message for the cause.
What tools/list returns
tools/list advertises only the tools your credential can call. Two things narrow the
list:
- Write capability. An OAuth connection without the write scope sees read tools only.
- Alpha gating. Tools behind an alpha feature are omitted unless the request opts in via the
X-Archive-Alpha-Featuresheader, and calling one without opting in returns the same response as calling a tool that doesn’t exist. See Alpha features.
If a documented tool is missing, check the connection’s write scope and any required alpha header.
Workspace roles do not change the list. An OAuth connection acts as the person who authorized it, so
a tool whose action their role denies in a workspace stays listed. Calling it there returns
isError: true with the role’s denial message. Nothing is written and no credits are spent, but the
call still counts against the rate limit. The webhook tools need the role to allow managing
webhooks, addTrackedHashtag, addMentionSources and removeTrackedSource need it to allow managing
sources, and
refetchEngagementBulk needs it to allow spending credits. API bearer tokens are not subject to
workspace roles.
Selecting a workspace
Most tools act on one workspace. Pass its UUID or numeric app ID as workspaceId, or send a
WORKSPACE-ID header. The argument takes precedence over the header.
You can omit both when your credential can access exactly one workspace.
With several workspaces, the response asks you to choose one and lists the available options.
On protocol revision 2026-07-28, clients that support input forms can receive a structured
input request instead.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "searchItems",
"arguments": {
"workspaceId": "6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a",
"limit": 20
}
}
} When a workspace is rejected
Without input-form support, an inaccessible or ambiguous workspace returns isError: true with
two text blocks. The first explains the problem. The second contains JSON with an error object:
code:not_authorized(the workspace isn’t accessible) orambiguous_workspace(no workspace was chosen).retryable: alwaysfalse. Repeating the same call returns the same rejection.workspaces: the workspaces your credential can access, as{ id, name }, newest first, capped at 25. Every listedidis one a call can use asworkspaceId. An empty list means the credential can’t act on any workspace.truncated:truewhen more than 25 are accessible. CallgetWorkspacesfor the full list.
Retry with one of the listed id values as workspaceId.
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "Workspace not found or not accessible for these credentials. Call getWorkspaces to list accessible workspaces."
},
{
"type": "text",
"text": "{\"error\":{\"code\":\"not_authorized\",\"retryable\":false,\"workspaces\":[{\"id\":\"6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a\",\"name\":\"Acme\"}],\"truncated\":false}}"
}
],
"isError": true
}
} Request headers
Send one JSON-RPC message per HTTP POST. Include these headers when building your own client:
| Header | Send | If it is wrong |
|---|---|---|
Content-Type | application/json | 415 Unsupported Media Type |
Accept | application/json, text/event-stream | 406 Not Acceptable when it is missing or accepts no application/json |
Both header errors return JSON-RPC code -32000 with id: null.
For requests that require authentication, a missing credential returns the 401 challenge before
these header checks. ping and notifications do not require authentication.
Archive returns application/json and does not open an event stream.
It also accepts Accept: application/json alone.
Use a string or integer for the request id. null, fractional numbers, and exponent notation
(1.5, 1.0, 1e3) return -32600 Invalid Request.
Protocol version
Archive supports two ways to declare the protocol version:
- Handshake revisions
2025-03-26and2025-06-18— youinitializeonce, then send calls. - Per-request revision
2026-07-28— no handshake; every request carries its own version inparams._meta.
A request with a version in params._meta uses the per-request protocol.
Requests without it use the handshake protocol.
Handshake revisions (2025-03-26, 2025-06-18)
initialize negotiation (the protocolVersion parameter). The server echoes back the version
it will speak:
| You send | Server responds with |
|---|---|
| A supported version | That same version |
| An unsupported version | The newest version it supports (2025-06-18) — it does not fail |
| Nothing | The oldest supported version (2025-03-26), the most compatible choice |
Use the protocolVersion returned by initialize for subsequent requests.
The MCP-Protocol-Version HTTP header. After initialize, send the returned version in this header.
Accepted values are 2025-03-26, 2025-06-18, and 2026-07-28.
Other values return HTTP 400 with JSON-RPC error -32000; data.supported lists the accepted versions.
An omitted or empty header defaults to 2025-03-26.
initialize negotiates through its body, so this header check does not apply to it.
The per-request protocol instead checks that the header matches the version in params._meta.
The per-request revision (2026-07-28)
Each request declares its version in params._meta. No handshake or session is needed.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {
"_meta": { "io.modelcontextprotocol/protocolVersion": "2026-07-28" }
}
} Required headers on 2026-07-28
Send these headers with values matching the request body. This lets proxies route the request using the same method and tool name that Archive executes.
| Header | Value | Required on |
|---|---|---|
MCP-Protocol-Version | The same string as params._meta["io.modelcontextprotocol/protocolVersion"] | Every request that carries a _meta version |
Mcp-Method | The JSON-RPC method | Every request |
Mcp-Name | params.name | tools/call |
Header names are compared case-insensitively; header values are compared byte-for-byte, so
TOOLS/LIST does not match tools/list. Values must contain only visible ASCII, space, or tab.
A Mcp-Name that cannot be expressed in that character set — or that would itself look like the
sentinel — is sent Base64-encoded as =?base64?<base64 of the UTF-8 name>?=. The markers are
lowercase and case-sensitive. The server decodes the value before comparing it, so
Mcp-Name: =?base64?Z2V0V29ya3NwYWNl?= matches a body name of getWorkspace.
POST /api/v2/mcp HTTP/1.1
Content-Type: application/json
Accept: application/json, text/event-stream
Authorization: Bearer <token>
WORKSPACE-ID: <workspace uuid>
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: getWorkspace
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "getWorkspace",
"arguments": {},
"_meta": { "io.modelcontextprotocol/protocolVersion": "2026-07-28" }
}
} When header enforcement is enabled, a missing, mismatched, or invalid header returns HTTP 400
with JSON-RPC error -32020:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32020,
"message": "Header mismatch: Mcp-Name header value 'getWorkspaces' does not match body value 'getWorkspace'"
}
} Results on this revision carry resultType: "complete" and an
_meta["io.modelcontextprotocol/serverInfo"] object. tools/list additionally carries
ttlMs: 3600000 and cacheScope: "private" — the listing is per-credential, so cache it per
credential, for at most an hour. tools/call results carry no cache hints.
Discovering support without a credential. Call server/discover before authorization to check
which per-request revisions Archive supports. It does not require authentication.
Its result has cacheScope: "public" and the same one-hour ttlMs.
{
"jsonrpc": "2.0",
"id": 1,
"method": "server/discover"
} {
"jsonrpc": "2.0",
"id": 1,
"result": {
"supportedVersions": ["2026-07-28"],
"capabilities": { "tools": {} },
"instructions": "Archive's workspace-scoped social-content API. …",
"resultType": "complete",
"_meta": {
"io.modelcontextprotocol/serverInfo": {
"name": "archive-sellable-api",
"title": "Archive",
"version": "0.2.0"
}
},
"ttlMs": 3600000,
"cacheScope": "public"
}
} Authentication, workspace selection, and rate limits work the same way as in the handshake protocol.
An unauthenticated tools/list or tools/call request returns the same HTTP 401 discovery challenge.
These responses differ from the handshake protocol:
| Situation | Response |
|---|---|
| A required request-metadata header is missing or disagrees with the body | With enforcement enabled: 400 with JSON-RPC error -32020, naming the header |
_meta names a version the server does not serve | 400 with JSON-RPC error -32022, whose data.supported lists what it does serve |
A method the server does not implement (including initialize and ping, which belong to the handshake revisions) | 404 with JSON-RPC error -32601 |
You send Mcp-Session-Id or Last-Event-ID | Ignored. No session id is ever issued or echoed on this revision |
Answering an input request
If your client declares that it can render an elicitation form, two situations answer with
resultType: "input_required" instead of prose: a call that did not name a workspace when your
credential can reach several (see Selecting a workspace), and a
refetchEngagementBulk batch large enough to need cost confirmation.
Declare the capability in params._meta. An empty elicitation object means form mode; a client
that declares only { "url": {} } is never sent a form.
{
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": { "elicitation": { "form": {} } }
}
} The result contains inputRequests, keyed by IDs assigned by the server, and an opaque requestState.
Return requestState unchanged with your answer.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"resultType": "input_required",
"inputRequests": {
"workspace": {
"method": "elicitation/create",
"params": {
"mode": "form",
"message": "Multiple workspaces are accessible; pass a 'workspaceId' argument …",
"requestedSchema": {
"type": "object",
"properties": {
"workspaceId": {
"type": "string",
"title": "Workspace",
"description": "The workspace this call should act on.",
"oneOf": [
{ "const": "6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a", "title": "Acme" },
{ "const": "b1d0c2a4-1f3e-4c7b-8a29-77c1f0e4d5b6", "title": "Acme EU" }
]
}
},
"required": ["workspaceId"]
}
}
}
},
"requestState": "<opaque>"
}
} Re-send the same call with requestState and inputResponses on params — siblings of name
and arguments, not inside them. Use a fresh JSON-RPC id.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "getWorkspace",
"arguments": {},
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": { "elicitation": { "form": {} } }
},
"requestState": "<the value from the input_required result>",
"inputResponses": {
"workspace": {
"action": "accept",
"content": { "workspaceId": "6ccefa76-e8ba-5ab0-9c60-e48a9e235a4a" }
}
}
}
} Archive checks that you can access the selected workspace, just as it checks a workspaceId argument.
A cost confirmation applies only to the quoted batch. Changing itemIds requires another confirmation
if the new batch still exceeds the threshold.
| What you send back | What you get |
|---|---|
action: "accept" with a usable value | The normal resultType: "complete" result |
action: "decline" or "cancel" | The prose result a client without the capability would have received — never a second ask |
| Missing, altered, expired (10 minutes), or mismatched state | Archive ignores the answer and re-evaluates the call. It returns a fresh input_required if input is still needed; otherwise it completes |