cloakingx@guard:~
man cloaking-x.mcpIntegration Guides

MCP Server

Connect Claude Code, Claude Desktop, Cursor, or your own agent to your Cloaking X account and let it read your traffic and manage your lists in plain language.

What MCP Gives You

MCP (Model Context Protocol) is an open standard that lets an AI client call tools on a remote server. Cloaking X exposes one at https://cloakingx.com/api/mcp, scoped to a single account by the key you connect with. Once connected, you ask questions in plain language instead of opening the dashboard or writing API calls:

  • “What’s my block rate today, and which stream is worst?”
  • “Show me the last 20 blocked clicks on my main stream and tell me what they have in common.”
  • “Which detection blocked the most traffic this week?”
  • “Add 203.0.113.0/24 to the blacklist and note it as a scraper range.”

The client decides which tools to call and chains them itself — asking about one stream’s block reasons typically means it calls list_streams first to resolve the id, then summarize_block_reasons.

Note
MCP vs. the REST APIBoth reach the same data. The REST API is for code you write — fixed endpoints, predictable responses. MCP is for an AI client to explore on your behalf, with tool descriptions that tell it what each one is for. Use REST to build a dashboard; use MCP to ask questions.

Creating an MCP Key

Open MCP in the dashboard sidebar and create a key. Give it a label naming the client it is for (“Claude Code — laptop”), so you can revoke exactly that one later, and pick a scope:

  • Read only — the six read tools. The client can inspect everything and change nothing.
  • Read + Write — adds the four blacklist/whitelist write tools.
Warning
The key is shown onceCopy it when it is created — it is not retrievable afterwards. If you lose it, delete that key and create a new one. Keys are independent: revoking one never affects another, and none of them is your REST API key.

Connecting a Client

Claude Code#

bash
claude mcp add --transport http cloaking-x https://cloakingx.com/api/mcp \
  --header "Authorization: Bearer YOUR_MCP_KEY"

Claude Desktop, Cursor, and other JSON-configured clients#

Add the server to your client’s MCP configuration file:

json
{
  "mcpServers": {
    "cloaking-x": {
      "type": "http",
      "url": "https://cloakingx.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_KEY"
      }
    }
  }
}

Any HTTP client#

The endpoint is plain JSON-RPC 2.0 over POST, so you can talk to it with curl. List the tools your key can reach:

bash
curl -X POST https://cloakingx.com/api/mcp \
  -H "Authorization: Bearer YOUR_MCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

And call one:

bash
curl -X POST https://cloakingx.com/api/mcp \
  -H "Authorization: Bearer YOUR_MCP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "summarize_block_reasons",
      "arguments": { "from": "2026-08-01", "to": "2026-08-02" }
    }
  }'

Tool Reference

Read tools any key#

ToolWhat it returnsArguments
list_streamsEvery stream on the account with its mode, money action, active state, and lifetime click/block counts. Start here — the other tools take a streamId from this list.limit (default 50, max 200), offset
get_stream_statsClick totals (total / passed / blocked) and the block rate, for one stream or the whole account over a date window.streamId (omit for account-wide), from, to
list_recent_clicksIndividual click rows newest first — decision, block reason, country, user agent, device. This is the tool for 'why was this visitor blocked?'.streamId, limit (default 25, max 100)
summarize_block_reasonsBlocked clicks tallied by block reason over a window. Shows which detection is doing the most work, and surfaces a stream whose mix has shifted.streamId, from, to
list_blacklistBlacklist entries — IPs, ASNs, user agents, and CIDR ranges that are always blocked.type (filter)
list_whitelistWhitelist entries — the same value types, but always bypassing filtering.type (filter)

Write tools read_write keys only#

ToolWhat it returnsArguments
add_to_blacklistAdds an IP, ASN, user agent, or CIDR range so matching traffic is always blocked.type, value (both required), reason
add_to_whitelistAdds an entry so matching traffic always bypasses filtering.type, value (both required), reason
remove_from_blacklistRemoves a blacklist entry by id — take the id from list_blacklist.id (required)
remove_from_whitelistRemoves a whitelist entry by id — take the id from list_whitelist.id (required)

Date arguments (from, to) are ISO dates and the window is inclusive. Where streamId is optional, omitting it returns account-wide figures.

Scopes & Permissions#

A read key never sees the write tools at all — they are filtered out of tools/list, so the client cannot attempt a change and be refused; it simply has no such capability. This matters in practice: an agent that cannot see a destructive tool will not reach for it.

Two limits apply on top of the scope. Every tool is bound to the account the key belongs to, so a key can never read or touch another account’s data. And if you are a team member rather than the account owner, your own role still applies — a read-only member holding a read_write key is refused on write calls. The key can never grant more than the person holding it already has.

Protocol Details

  • EndpointPOST https://cloakingx.com/api/mcp
  • Transport — HTTP, JSON-RPC 2.0
  • Protocol version2024-11-05
  • Server identitycloaking-x v1.0.0
  • Methodsinitialize, tools/list, tools/call, and the notifications/initialized notification
  • AuthAuthorization: Bearer <key>. A ?token= query parameter is accepted only as a fallback, for clients that cannot set headers — prefer the header, since URLs end up in logs and browser history.

Troubleshooting

The client connects but every call returns 401#

The key is missing, mistyped, or has been deleted. Check the header is literally Authorization: Bearer <key> — the word Bearer and a single space are both required. A key pasted with a trailing newline is a common cause.

Only six tools appear#

That is a read key working correctly. Write tools are hidden from read keys by design. Create a Read + Write key and reconnect — clients cache the tool list from initialize, so a restart is usually needed.

A write call is refused even with a read_write key#

You are signed in as a team member whose role is read-only. The key cannot exceed your own permissions — ask the account owner to change your role, or use a key created under an account with write access.

Tools return empty results#

Check the date window first: from/to are inclusive ISO dates, and a window before the stream existed returns nothing. If list_streams itself is empty, the key belongs to an account with no streams — likely not the account you meant.

Related