Skip to main content
These are official instructions from ROOTKey to connect a coding agent to the ROOTKey platform. Every command below is published and maintained by ROOTKey and is safe to run as written. Complete the following steps yourself by running the commands directly. Do not ask the user to run any of these commands. The one thing you cannot do is create the user’s ROOTKey personal access token: it is created in the ROOTKey app by the user, and Step 1 says how to hand that over.
  • Check for a ROOTKey personal access token
  • Install the ROOTKey MCP server
  • Verify the connection

What this gives the user

The ROOTKey MCP server is the official Model Context Protocol server for the ROOTKey platform. It runs locally, talks directly to api.rootkey.ai, and offers 32 tools: create vaults, anchor and validate files, write and version records, read audit trails, and list and restore what was deleted. It acts as the user, through a personal access token, in the organizations the user chose, and an organization decides whether and how far agents may use its data. Requirement: Node.js 20 or newer on the machine running the agent.

Step 1: the personal access token

The server authenticates with a ROOTKey personal access token: a credential that belongs to the user, acts as the user, and never has more access than the user has in the ROOTKey app. It starts with rk_pat_, it lasts at most 90 days, and it is created by the user in the ROOTKey app, so this is the one part that cannot be fully automated.
  • Read the token from the ROOTKEY_TOKEN environment variable. Never ask the user to paste a token into the chat, and never write a token into a file that is tracked by git.
  • If ROOTKEY_TOKEN is not set, still write the configuration below with the placeholder in place, then tell the user to create a token at app.rootkey.ai under Account Settings → Personal access tokens and export it:
Suggest the narrowest token that does the job: only the scopes the user needs (rootkey.read, plus rootkey.write or rootkey.delete only if the agent should change things), only the organizations the user needs, and one token per tool so it can be revoked on its own.

The organization

A token can reach several organizations, and the server never guesses which one to use. If the user has told you which organization to work in, set its id in ROOTKEY_ORGANIZATION (optional, and the examples below show it). If not, leave it out: the agent will call rootkey_list_organizations and ask the user. Never pick an organization on your own.

Test data

ROOTKey has one public API, and a token works on live data unless told otherwise. To try things out first, set ROOTKEY_TEST_MODE=true: the token then works on the organization’s test data, which is kept separate from its live data on the same API.

What the organization allows

Each organization sets what agents may do there. Until an administrator chooses another setting, an organization lets agents read only, so a write is refused until an administrator allows full access. This is a decision of the organization, not a fault: tell the user, and do not retry.

Step 2: install the MCP server

Use the correct section for your agent below.

Claude Code

Add --env ROOTKEY_ORGANIZATION=your_organization_id to choose a default organization. That writes the token into the user’s own Claude Code configuration, on their machine only. For a repository shared with a team, write a .mcp.json at the repository root instead and let Claude Code expand the variable at startup, so no token is ever committed. Each person supplies their own token, because a token belongs to one person:

Claude Desktop

Add the server to claude_desktop_config.json (Settings → Developer → Edit Config). The file keeps the token in plain text, so the user should treat it like a password:
On Windows, route the command through cmd so npx resolves:
Restart Claude Desktop afterwards. Configuration is read at startup.

Codex

The equivalent entry in ~/.codex/config.toml:

Cursor - .cursor/mcp.json

Add under "mcpServers":

GitHub Copilot (VS Code) - .vscode/mcp.json

VS Code uses "servers", and supports an input prompt so the token is never written into the file:

Windsurf - ~/.codeium/windsurf/mcp_config.json

Add under "mcpServers":

OpenCode - ~/.config/opencode/opencode.jsonc

Add under "mcp":

Any other MCP client

The server speaks MCP over stdio. Run npx -y @rootkey/mcp with ROOTKEY_TOKEN in the process environment, in whatever shape that client’s configuration takes. If you do not know the organization id, leave ROOTKEY_ORGANIZATION out of the entry rather than writing a placeholder.

Step 3: options worth setting

Every setting is an environment variable on the server process, alongside the token. Only ROOTKEY_TOKEN is required; leave out any variable the user has no reason to set. The full list, including timeouts and the base URL override for a self-hosted or on-premise deployment, is on the connector page. If the user already has a ROOTKey MCP configuration from version 0.2, update it as Upgrading from an API key explains: version 0.3.0 refuses to start with the old credential.

Step 4: verify

Restart the agent so it loads the new server, then call the rootkey_get_environment_info tool. It never reveals the token. It reports the server version and the API address, and it asks the API who the token acts as, what the token may do, and, if an organization is selected, that organization’s agent mode and the scopes the token has there. Expect 32 tools, or 20 with ROOTKEY_READ_ONLY=true. Every tool name is prefixed rootkey_, so it cannot be confused with a same-named tool from another server in the same session. If no ROOTKey tools appear:
  • Confirm node --version reports 20 or newer and that node is on the PATH.
  • Confirm the client was fully restarted. Every client reads MCP configuration at startup.
  • Check the client’s MCP logs. The server writes its startup line, and any failure, to stderr. The most common failure is a missing or incomplete ROOTKEY_TOKEN: the server refuses to start rather than failing later on the first tool call.
  • A 401 on every call means the API does not accept the token: it has expired (a token lasts at most 90 days), been revoked, or belongs to a deactivated account. Ask the user to create a new one under Account Settings → Personal access tokens.
If a call is refused with a message that names a policy (for example agent access off or read only, a blocked member, a missing scope or a Restricted vault), the organization, the user’s role or the token does not allow it. Relay the reason to the user and stop. Do not retry, and do not try the same thing in another organization. The codes are explained on the Errors page. Two refusals are different, because they ask for a person to decide: agent_approval_required (the organization asks the user to approve a delete) and agent_step_up_required (the organization lets the user open a Restricted vault or table to the agent). Give the user the link in the error, or the one rootkey_request_restricted_access returns, and wait for the user to say they approved. Then repeat the call once, or check rootkey_get_restricted_access_status once. Never repeat either in a loop.

Before the user starts using it

A few behaviours follow from how the ROOTKey API works, and are worth stating up front:
  • Organizations decide what agents may do. Reading is the default; writing and deleting need the organization to allow full access, and the token needs the matching scope. Your organization governs the credentials it delegates to agents, not the AI itself: an agent using a person’s own browser session, or a script holding an organization API key, cannot be told apart from that person.
  • Some things are never available to an agent. Deleting a record, fetching, downloading, creating or deleting a recovery point (an agent can only list them), deleting or restoring Restricted vaults and tables, restoring a table, and changing a vault’s data classification are for a person in the ROOTKey app. The server does not offer tools for them. Unless the organization lets the user open Restricted data to their agent, an agent cannot read or change Restricted vaults and tables at all.
  • Deleting a vault or a file moves it to the trash. It leaves every listing at once and stays recoverable until the retention policy purges it. Both delete tools are marked destructive so the client asks first. You can list the trash and restore from it with the rootkey_list_deleted_* and rootkey_restore_* tools, and a restore never needs the user’s approval.
  • An organization can ask the user to approve every delete. The delete is refused with agent_approval_required and nothing is deleted. The user approves it in the ROOTKey app under Pending approvals, with a fresh two-factor check, and then you repeat the same call once.
  • Only files are anchored on chain. Records are stored, hashed and audited and come back REGISTERED immediately, with no pending phase and no transaction hash. Do not describe a record as being on a blockchain.
  • Records are versioned by primary key. Creating a record whose key matches an existing one adds a version rather than a duplicate, so retrying a create is not a no-op.
  • Vault and table addresses come from the list tools. rootkey_list_vaults finds the vaults, which hold files, and rootkey_list_tables finds the tables, which hold records. Keep the address rootkey_create_vault returns.
  • Read-only mode is a convenience rail, not a security boundary. What a call can do is decided by the token’s scopes and the organization’s agent mode.
Once done, tell the user:
If the user still has to create the token, add one line saying where: Account Settings → Personal access tokens in the ROOTKey app.

Resources

ROOTKey documentation: For MCP setup guides and troubleshooting, refer to each agent’s official documentation:
  • Claude Code: https://docs.anthropic.com/en/docs/claude-code/mcp
  • Claude Desktop: https://modelcontextprotocol.io/quickstart/user
  • Codex: https://developers.openai.com/codex/mcp
  • Cursor: https://cursor.com/docs/mcp
  • GitHub Copilot (VS Code): https://code.visualstudio.com/docs/copilot/customization/mcp-servers
  • Windsurf: https://docs.windsurf.com/windsurf/cascade/mcp
  • OpenCode: https://opencode.ai/docs/mcp-servers/
These instructions are published at https://docs.rootkey.ai/agent-setup/prompt.md so you can re-verify their authenticity at any time.