Termsheep Cloud is coming soon.Cloud is coming soon.Join the waitlist →

Connect an agent over MCP

Build the local MCP server and give an agent scoped access with its own identity.

On this page

Use the arrow keys to scroll the table.

Run the local broker

Build termsheep-mcp from the source checkout:

cargo build --locked -p termsheep-mcp

Run the broker on the agent's machine. It keeps the agent's encrypted store and private key there and makes its SSH connections directly. It uses stdio by default. For Streamable HTTP, bind to a loopback address and configure a dedicated bearer token.

The broker signs in with a verified AI-agent key binding. If its vault installation is removed, the earliest verified grant deadline arrives, or the broker observes a definitive coded refusal or a grant end, it closes affected SSH runs. An in-flight run without an observed result is recorded as interrupted. The broker does not run it again. The same SSH limits apply.

Configure the agent

Create an agent principal and give it the vault permissions it needs. Use private files for the API token and the base64 private key. Set these values in the broker's environment, replacing the example URL, ID and paths. The signer uses the same settings for its agent credentials.

TERMSHEEP_SERVER_URL=https://termsheep.example.com
TERMSHEEP_AGENT_ID=<agent-id>
TERMSHEEP_AGENT_TOKEN_FILE=/path/to/private/agent.token
TERMSHEEP_AGENT_PRIVATE_KEY_FILE=/path/to/private/agent.key

For Streamable HTTP only, also set the loopback listener and the path to the separate bearer token file.

TERMSHEEP_MCP_HTTP_LISTEN=127.0.0.1:8765
TERMSHEEP_MCP_HTTP_TOKEN_FILE=/path/to/private/mcp-http.token

Each credential file must be readable only by the account that runs the program. On Unix, the program rejects files with any group or other permission bits set. On macOS, check extended access control lists (ACLs) separately. On Windows, the program checks file ownership and the file's access control list.

The direct environment variables TERMSHEEP_AGENT_TOKEN, TERMSHEEP_AGENT_PRIVATE_KEY and TERMSHEEP_MCP_HTTP_TOKEN are compatibility settings. The program reads them once at startup and removes them from its own environment. Prefer the file settings, which take precedence.

Agents request access, wait for a decision and use granted access. A person with Manage access approves the request and seals its keys in the desktop app. Agents cannot approve or deny requests for themselves or anyone else. The MCP server has no tool for deciding requests.

The MCP tool cancel_request withdraws the agent’s own pending request. After approval, it returns request.closed. To return an active grant, the agent calls DELETE /api/v1/entitlements/{id} on the platform API.

Agents can list hosts and run permitted snippets and commands. The broker requires team-trusted host keys or a trusted host CA. For store settings and HTTP configuration, see the source configuration reference.