MCP
Enabling & Configuring MCP
Turn on the local MCP server and connect an AI agent to it.
Enable the server
Go to Settings → MCP and toggle Enable MCP server. Ternux will:
- Generate a random bearer token (if one doesn't exist yet).
- Start listening on
127.0.0.1on the configured port (default7823).
| Field | Description |
|---|---|
| Enable MCP server | Starts/stops the local server. Only sessions open at call time are reachable — nothing is exposed while disabled. |
| Port | Local port the endpoint listens on (1024–65535). Can't be changed while the server is running — disable first. |
| Bearer token | Required on every request as Authorization: Bearer <token>. Use Copy to grab it, Regenerate to invalidate the old one and issue a new one. |
| Status | Shows Running on 127.0.0.1:<port> or Stopped. |
Regenerating the token immediately invalidates the old one — any connected agent will need the new token to keep working.
Connect an MCP client
Point your MCP client at the local endpoint and supply the bearer token. For example, with Claude Code:
claude mcp add --transport http ternux http://127.0.0.1:7823/mcp \
--header "Authorization: Bearer <token>"Once connected, the client will see two tools — list_open_connections and run_command — described in Available Tools.
Disabling
Toggle Enable MCP server off in Settings → MCP. The server stops immediately and the endpoint stops accepting connections; already-open SSH tabs in Ternux are unaffected.