Skip to content

AI agents (MCP)

Bring your own agent: Claude Code, Cursor, an IDE assistant or your own program can use Tenax through the Model Context Protocol (MCP). The agent acts as the person who connected it and never with more than that person's role; every call is in the audit log under the person's name and the agent's.

Connect a local agent

tenax mcp is an MCP server over stdio that uses your tenax login credentials. tenax mcp setup connects the common agents:

tenax mcp setup claude-code              # prints: claude mcp add tenax -- tenax mcp
tenax mcp setup cursor --write           # also claude-desktop, windsurf, vscode

Any other MCP client takes the same command in its configuration:

{ "mcpServers": { "tenax": { "command": "tenax", "args": ["mcp"] } } }

--agent <name> names the agent in the audit log; by default it is the name the agent gives.

Connect a remote agent

The endpoint is /mcp on the console's host (Streamable HTTP, JSON-RPC 2.0). Two ways in:

  • OAuth (agents that support it, most do): give the agent the MCP URL. It registers itself, sends you to the console to consent, and gets a token that acts as you with the scope you allowed: tenax:read, tenax:act or tenax:restore, capped by your own role. Tokens last an hour and refresh for 30 days; the Agents page lists every connected agent, and Revoke ends it at once.
  • A Cloudflare Access service token (CF-Access-Client-Id and CF-Access-Client-Secret headers), for your own programs, with the role the role map gives it.

A public MCP host

The console stays behind its login. For agents that cannot pass it, set expose.cloudflared.mcpHostname (for example mcp.tenax.example.com): Tenax publishes that host with an Access bypass, and tenax-api serves only /mcp, the OAuth endpoints and llms.txt there. It accepts only the tokens Tenax issues to agents: a request without one is refused, whatever the console's login.

People consent where they log in, never on the MCP host: on the published console (api.externalURL or consoleHostname) or, when the console is not published, on their own machine: run tenax console (on its default port 8080) before connecting the agent. expose.cloudflared.mcpConsentURL sets another address. With the API on a LoadBalancer instead, the same paths work there once api.networkPolicy.allowFrom admits the traffic.

With Tenax's own login (auth.provider: tenax), an agent never has more than the role its person has now: taking someone's role away, on the Access page or in auth.roles, stops their agents at once.

What an agent can do

Tool What it does
list_targets, get_target Databases, their health, restorable window and last backups
list_backups, get_backup, diff_backups Full backups and what changed between two of them
plan_restore What a restore to a time would use, and whether it is possible; it restores nothing
list_changes, list_incidents, what_changed Recent changes in plain words, unusual changes, everything since a time
get_history, list_restores, get_restore, wait_for_restore, list_sandboxes Restores and sandboxes
recent_activity, get_settings, whoami Activity, stores and their replicas, the agent's own role
backup_now, verify_now, create_sandbox, suspend_target, resume_target, cancel_restore, extend_sandbox, delete_sandbox, expose_sandbox, unexpose_sandbox, query_sandbox, tag_restore_commit, start_ai_run, copy_volumes_now, restore_volume, create_volume_sandbox, extend_volume_sandbox, delete_volume_sandbox, export_volume_files Act, where the rules allow it
request_restore Ask for a restore into a new database, a download or in place; it waits for people
pin_backup, unpin_backup, copy_store, resolve_incident, apply_detector_rule, remove_detector_rule Ask for it: one person with the operation's role approves it on the Agents page, and it runs as them
destroy_target, undo_restore Ask for it: as many people approve as the rules ask for in-place restores, one of them not the person behind the agent
get_request Follow a request: waiting, done, failed, rejected or expired

Read tools are always there. Agents never see database passwords, and never approve anything.

Letting agents act

By default agents only read. A restorer-admin turns on Agents may act on the console's Agents page (or with POST /api/v1/agents/settings). Then agents with the right scope and role can back up, verify, create sandboxes and ask for restores.

A restore an agent asks for is created waiting for approval: nothing is planned, backed up or touched until people approve it under Needs you on the Agents page (the count shows in the sidebar). In-place restores need a restorer-admin, and the rules can require two people for them, at least one of them not the person behind the agent. A restore nobody approves within 24 hours fails; a rejection fails it at once. Sandboxes need no approval: they are new, isolated databases the agent cannot log in to.

Operations beyond the agent's role, and those that change what Tenax keeps or trusts (pins, store copies, incidents, anomaly rules, destroying a target, undoing a restore), become requests. They wait under Needs you like restores; the approval that completes one runs the operation as the approver, with the approver's role, and the agent's request and reason stay in the audit log. A request nobody answers within 24 hours expires. Agents may act by default (chart value agents.write, true); restores and requests still wait for a person. Rules saved on the Agents page win over the chart value; set agents.write: false to start with agents that only read.

Rules and the kill switch

The Agents page (restorer-admin) sets:

  • Stop all agents: every agent call is refused on every replica within seconds, until agents are allowed again.
  • which tools agents may use, and which targets (namespace/name patterns such as shop/*);
  • how many people approve an in-place restore an agent asks for (1 or 2).

The rules live in the ConfigMap <release>-agents in Tenax's namespace, so GitOps can own them too (keys enabled, write, inPlaceApprovals, tools, targets).

Usage

Each person's agent may make 600 calls in 10 minutes per tenax-api replica. Every result says what was used in its _meta (tenax.run/usage), and past 80 % the agent is told in words, so it can ask for less before it is refused.

Audit

Each call is recorded as mcp.<tool> with the user, the agent's name and version, and the target; actions an agent takes are recorded like people's, with the agent's name. The Agents page shows the recent ones; the audit page and GET /api/v1/audit?action=mcp. have them all.

Activity

The Activity tab of the Agents page is the lasting record of what agents did: every tool call with its outcome (ok, refused and why, error), the requests they made, who approved or rejected them and how the approved operation ran, agents connected or revoked, and changes to the rules. It survives restarts and is the same on every tenax-api replica: each replica writes small encrypted batches every few seconds to the backup store, under agents/activity/. Filter by agent, person, tool, outcome, kind, target and time; older entries load as you scroll; Export CSV and Export JSON download what the filters select. You see what your own agents did and the decisions you took; restorer-admins see everyone's.

The record never holds tool results or secrets: arguments are kept as a short summary in which passwords, tokens, keys and SQL text are left out. The same list is at GET /api/v1/agents/activity (filters agent, user, tool, outcome, kind, target, since, until, and before with the next cursor of the previous page).

Chart values: agents.activity.retentionDays (default 90; older days are deleted) and agents.activity.store (the backup store it is kept in; default the first writable one by name). tenax-api reads it with the store's catalog identity; without one, the tab shows only the replica's recent entries and says so.

For agents: llms.txt

/llms.txt tells an agent where the MCP endpoint, the OAuth metadata and the API document are and lists the tools, so an agent given only the address can find its way.