clarvis-mcp
Lets Claude inspect and drive tmux windows running Claude Code sessions: list allowed tabs, read conversations, type prompts, answer permission and question menus, switch modes, and open new sessions or windows within the allow-list.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
clarvis-mcp
clarvis-mcp is an MCP server that lets Claude on claude.ai (through a custom connector) read and drive the Claude Code sessions you run in tmux on your own machine. From a chat you can see what each tab is doing, read its conversation, type prompts, answer permission prompts and question menus, switch modes and open new sessions.
Warning: this lets a remote AI type into terminals on your machine. Anything you can type into a Claude Code tab, the connected chat can type too, and Claude Code runs commands. Anyone who gets your passphrase or a valid token can do the same. Read SECURITY.md before you install it, set up the allow-list, and keep the passphrase in a password manager.
Install
You need Python 3.11 or newer, tmux 3.2 or newer, and Claude Code. Install the command with uv or pipx:
uv tool install clarvis-mcp
# or
pipx install clarvis-mcpFrom a checkout of this repository, uv tool install . works too.
Related MCP server: claude-mux.mcp
Quick start
Create the config and the passphrase:
clarvis-mcp init --public-url https://your-host.exampleThis creates
~/.config/clarvis-mcp/(withconfig.toml) and~/.local/state/clarvis-mcp/, both mode 0700, and prints a new passphrase once. Put it in your password manager now.Edit
~/.config/clarvis-mcp/config.toml:public_url: the https address your tunnel or reverse proxy publishes (see Tunnels), without/mcp.[allow]: the tabs and directories clarvis-mcp may touch. It starts empty, and empty allows nothing: every tab tool refuses until you add something here.
Run your Claude Code sessions as windows of a tmux session named
main(or settmux_session), for exampletmux new -s main, thenclaudein each window.Check the install, then start the server:
clarvis-mcp doctor clarvis-mcp serveThe server listens on
http://127.0.0.1:8766and serves MCP at/mcp.doctorchecks the public URL through your tunnel, so that line passes only once the tunnel and the server are both up; runclarvis-mcp doctor --offlineto skip it.
Connect from Claude
Custom connectors are not available on every Claude plan, and where they live in the settings can change; check what your plan offers.
In Claude, open Settings, then Connectors, and add a custom connector.
Give it a name and the URL
https://your-host.example/mcp(yourpublic_urlfollowed by/mcp).Connect it. A sign-in page headed "Authorize Claude to use clarvis-mcp?" opens; enter your passphrase.
Turn the connector on in a chat. The tools listed under Tools appear.
Too many wrong passphrases lock the sign-in page for a while (see [limits] under
Configuration); clarvis-mcp unlock clears a lockout.
Tunnels
clarvis-mcp listens only on 127.0.0.1:8766 by default. Something else has to publish it over https so
claude.ai can reach it. Only these seven paths need to be public: /mcp (the MCP endpoint), /.well-known,
/register, /authorize, /token, /revoke (OAuth) and /consent (the sign-in page).
Tailscale Funnel
Funnel publishes the server at https://<machine>.<tailnet>.ts.net. Publish each of the seven paths and
nothing else:
tailscale funnel --bg --set-path /mcp http://127.0.0.1:8766/mcp
tailscale funnel --bg --set-path /.well-known http://127.0.0.1:8766/.well-known
tailscale funnel --bg --set-path /register http://127.0.0.1:8766/register
tailscale funnel --bg --set-path /authorize http://127.0.0.1:8766/authorize
tailscale funnel --bg --set-path /token http://127.0.0.1:8766/token
tailscale funnel --bg --set-path /consent http://127.0.0.1:8766/consent
tailscale funnel --bg --set-path /revoke http://127.0.0.1:8766/revokeThen set public_url = "https://<machine>.<tailnet>.ts.net" in config.toml. tailscale funnel status
shows what is published.
Cloudflare Tunnel
Create a tunnel for one hostname (cloudflared tunnel login, cloudflared tunnel create clarvis-mcp,
cloudflared tunnel route dns clarvis-mcp clarvis.example.com) and point it at the local server. This
config.yml forwards only the seven paths and answers 404 for everything else:
tunnel: <tunnel-id>
credentials-file: /path/to/<tunnel-id>.json
ingress:
- hostname: clarvis.example.com
path: ^/(mcp|\.well-known|register|authorize|token|consent|revoke)
service: http://127.0.0.1:8766
- service: http_status:404Run it with cloudflared tunnel run clarvis-mcp and set public_url = "https://clarvis.example.com".
Any other HTTPS reverse proxy
Any reverse proxy with a valid certificate works (Caddy, nginx, and so on): forward the seven paths to
http://127.0.0.1:8766 and keep the original Host header. The server accepts requests only for the host
named in public_url (plus 127.0.0.1 and localhost), so public_url must be exactly the address the
proxy serves.
Configuration
Settings live in ~/.config/clarvis-mcp/config.toml (more precisely $CLARVIS_CONFIG_DIR, else
$XDG_CONFIG_HOME/clarvis-mcp, else ~/.config/clarvis-mcp). The file is read every time it is needed, so
most edits (the allow-list, projects, limits, confirm) apply without a restart; public_url, host and
port take effect when serve starts. Unknown keys and wrong types
are refused with a message naming the key, so a typo fails loudly. clarvis-mcp init writes a commented
template; this is every key it accepts:
# The https address the connector uses (your tunnel or reverse proxy), without /mcp. Required by `serve`.
public_url = "https://clarvis.example.com"
# Where the server listens. Keep it on loopback and let the tunnel publish it.
host = "127.0.0.1"
port = 8766
# The tmux session whose windows are the tabs.
tmux_session = "main"
# Project aliases for open_session and run_plan. One table per project; only path is needed to use the alias.
[projects.api]
path = "~/code/api" # the project directory
mode = "plan" # default, plan, auto, accept-edits or bypass
model = "opus" # passed to claude as --model
effort = "high" # low, medium, high, xhigh or max
prompt = "Run the plan at {plan}" # run_plan's first prompt; {plan} becomes the plan path
# Which tabs and directories clarvis-mcp may touch. Empty or missing allows nothing.
[allow]
tabs = ["api", "web-*"] # window names, exact or shell-style globs; never window numbers
dirs = ["~/code"] # a tab whose pane is in one of these is allowed; also where
# open_session, open_window and run_plan may start
# Sign-in limits and token lifetimes (these are the defaults). All must be at least 1.
[limits]
per_address = 5 # wrong passphrases from one address within the window lock it out
global = 20 # wrong passphrases from all addresses within the window lock everyone out
window_seconds = 900 # the counting window
lockout_seconds = 900 # how long a lockout lasts
access_token_seconds = 900 # access token lifetime
refresh_token_days = 30 # refresh token lifetime; the connector must sign in again after this
# Hold every acting call on a tab in bypass-permissions mode until confirm_action gets its code.
[confirm]
bypass_tabs = falseWhat the keys mean:
public_url,host,port,tmux_session: the environment variablesCLARVIS_PUBLIC_URL,CLARVIS_HOST,CLARVIS_PORTandCLARVIS_TMUX_SESSIONoverride them.[projects.<alias>]:path,mode,model,effortandpromptare per-project defaults that theopen_sessionandrun_planarguments override. Tools also accept any absolute directory instead of an alias. IfCLARVIS_PROJECTS_FILEnames a separate TOML file, its[projects]tables are used instead.[allow]: a tab is allowed if its window name matches atabsentry or its working directory is inside adirsentry (~is expanded; symlinks cannot escape). Window numbers are refused because they shift when windows close.rostershows only allowed tabs, plus a count of hidden ones.[limits]:per_address,global,window_secondsandlockout_secondscontrol the sign-in limiter, which survives restarts;access_token_secondsandrefresh_token_daysset token lifetimes.[confirm]: withbypass_tabs = true, an acting tool aimed at a tab in bypass-permissions mode does nothing and returns a six-digit code with a summary of the call (answering a question menu is exempt);confirm_actionwith that code runs the call once, within 120 seconds, from the same chat.
Other files:
Passphrase:
~/.config/clarvis-mcp/passphrase(0600;CLARVIS_PASSPHRASE_FILEoverrides).State, in
~/.local/state/clarvis-mcp/($CLARVIS_STATE_DIR, else$XDG_STATE_HOME/clarvis-mcp):oauth.json(clients and tokens),limiter.json(sign-in failures),audit.jsonl(the audit log;CLARVIS_AUDIT_PATHoverrides) andsummaries/(saved handoffs;CLARVIS_SUMMARIES_DIRoverrides).Artifact registry:
~/.config/clarvis-mcp/artifacts.json(CLARVIS_ARTIFACTS_FILEoverrides).
Commands
clarvis-mcp init [--public-url URL] [--force] [--import-tether]: creates the config and state directories (0700), writes the commentedconfig.tomltemplate unless one exists, and generates the passphrase if there is none, printing it once. Safe to run again.--public-urlfills inpublic_urlwhen the template is written.--forcerewritesconfig.tomlfrom the template; it never touches the passphrase.--import-tethercopies the passphrase and OAuth state from an earlier install under the old name tether ($CLARVIS_TETHER_DIR, default~/.config/tether) when they exist and are not already in place, so the connector stays signed in.clarvis-mcp serve [--insecure-local]: runs the server. It refuses to start, with a message, wheninithas not been run, whenpublic_urlis missing or not https, when the port is taken, or whenCLARVIS_ALLOW_ALL(a test-only switch that allows every tab) is set.--insecure-localallows a missing or httppublic_urlwhenhostis a loopback address, for local testing only.clarvis-mcp doctor [--offline]: prints PASS, WARN or FAIL for: tmux installed and at least 3.2, the tmux session exists, Claude panes found, config valid, passphrase present and 0600, directories 0700,public_urlis https, the port is free or held by clarvis-mcp itself, the allow-list is not empty, and (unless--offline) the public URL answers. Exits 0 only when nothing FAILs.clarvis-mcp passphrase --rotate: writes a new passphrase, prints it once, and revokes every OAuth client and token. Every connector has to sign in again. Use this if the passphrase may have leaked.clarvis-mcp revoke-all: revokes every OAuth client and token and prints how many were removed. The passphrase stays the same.clarvis-mcp unlock: clears every sign-in lockout and failure count and prints what it cleared. (revoke-alldoes not do this.)clarvis-mcp --version: prints the version.
Tools
A tab is a window of the configured tmux session, named by its number or its name. Every tool that touches a tab needs the tab named in the call: there is no current tab and no broadcast. Tools refuse tabs that are not allowed. Tools that act, and the reads that need Claude Code, also refuse panes that are not running Claude Code and screens they cannot read, and say why. Every tool that types, presses keys or opens a window writes a line to the audit log, refusals included.
Read
Tool | What it does |
| Lists the allowed tabs: number, name, directory, whether it runs Claude Code, mode, busy or idle, draft present, tmux pane mode and any open question menu, plus a count of hidden tabs. |
| Returns a tab's recent screen text, cleaned (40 lines by default). |
| Reports a tab's mode, model line, idle or working, draft, pending permission prompt and question menu. |
| Returns the text waiting in a tab's input box, without changing anything. |
| Returns a tab's permission prompt and its options, verbatim. |
| Returns the tab's latest plan file (plan mode), read only from Claude Code's plans folder. |
| Returns the tab's conversation from its Claude Code session file: paged, searchable, optionally back through |
Act
Tool | What it does |
| Types a message into a tab and presses Enter. Refuses if a different draft is waiting in the box. |
| Types text into the input box without submitting, so you can review it. Refuses over an existing draft. |
| Clears the input box and types new text; never submits. |
| Adds text to the end of the existing draft; never submits. |
| Presses Enter only if the box holds exactly the text you reviewed. |
| Empties the input box. |
| Drafts (or with |
| Drafts (or sends) |
| Drafts (or sends) |
| Presses Escape: stops the current turn or cancels a question menu. |
| Answers a permission prompt with allow (Enter) or deny (Escape). |
| Picks an option on a question menu by number, label or free text (toggles it on a multi-select menu). |
| Moves to the next or previous question of a multi-question menu. |
| Moves to the menu's Submit row and opens the review screen; with |
| Switches a tab to |
| Runs a call that |
Open
Tool | What it does |
| Lists the project aliases from |
| Opens a new tmux window in a project (alias or absolute directory) and starts Claude Code there with an optional mode, model and effort. Returns the new tab. |
| Opens a new tmux window with a plain shell in a directory. |
| Opens a session like |
Artifacts
Tool | What it does |
| Lists the registered artifacts: URL, title, source file, last update and description. |
| Returns an artifact's description and its source file's text (up to 20000 characters). |
| Adds an artifact to the registry: URL, title, description and an optional source file (a regular file under your home directory). |
Handoffs
Tool | What it does |
| Saves a markdown summary of the chat (goal, decisions, open items, what each tab is doing, known bugs, recap) plus facts the server adds, so a new chat can pick up. |
| Lists the saved summaries, newest first. |
| Returns a saved summary (the latest by default), paged by characters. |
Running as a service
Templates for both platforms are in deploy/. Each runs clarvis-mcp serve and restarts it on
failure; all settings stay in config.toml. Run clarvis-mcp init and clarvis-mcp doctor first. The install
steps are also in the comments at the top of each file.
Linux, systemd user service (deploy/clarvis-mcp.service):
mkdir -p ~/.config/systemd/user
cp deploy/clarvis-mcp.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now clarvis-mcp
loginctl enable-linger $USER # optional: keep it running while you are logged out
journalctl --user -u clarvis-mcp # its logThe unit expects the command at ~/.local/bin/clarvis-mcp; if which clarvis-mcp says otherwise, change
ExecStart.
macOS, launchd LaunchAgent (deploy/com.clarvis-mcp.plist): launchd does not
expand ~, so first replace YOUR_USER in the file's paths with your account name, check the command path
against which clarvis-mcp, and make sure the PATH entry includes the folder that holds tmux. Then:
cp deploy/com.clarvis-mcp.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.clarvis-mcp.plist
# stop and remove:
launchctl bootout gui/$(id -u)/com.clarvis-mcpIts log is ~/Library/Logs/clarvis-mcp.log.
Supported versions
Operating systems: Linux and macOS.
tmux 3.2 or newer.
Python 3.11 or newer.
Claude Code: tested with Claude Code 2.1.332. clarvis-mcp reads Claude Code's screen, which can change between releases. The screen parser fails closed: on a layout it does not recognise, tools refuse to act and say so rather than guess.
Troubleshooting
Run
clarvis-mcp doctorfirst. It checks tmux, the session, the config, the passphrase, permissions, the port, the allow-list and the public URL, and says what to fix.A tab is "not allowed". Add its window name or its directory to
[allow]inconfig.toml. No restart is needed.A tab was left in tmux copy-mode (for example after scrolling with the mouse wheel). This is handled automatically: text is delivered through tmux buffers, which work in copy-mode, and every key press first leaves copy-mode. If a tmux call hangs, it is stopped after a timeout and the pane is taken out of the mode.
The connector shows no tools. Refresh the chat; if that does not help, remove the connector in Claude's settings and add it again. Check that
serveis running and that the tunnel publishes all seven paths.Lost passphrase. It cannot be shown again. Run
clarvis-mcp passphrase --rotatefor a new one, then sign in again from Claude.Locked out of the sign-in page after wrong passphrases. Wait for
lockout_seconds, or runclarvis-mcp unlock.servewill not start. It prints the reason: runclarvis-mcp init, set an httpspublic_url, or free the port.A tool refuses with "not recognised" on a Claude tab. The screen did not match a layout the parser knows (an unusual state or a newer Claude Code). Look at the tab yourself; clarvis-mcp will not guess.
Development
uv sync
uv run pytest -q # the full suite; tmux tests use a throwaway tmux server, never yours
scripts/smoke.sh # builds the wheel and runs the CLI in a fresh venv with its own HOMETESTING.md describes the test harness. CI runs the suite on Linux (tmux 3.2a and newer) and macOS with Python 3.11 to 3.13, runs the smoke test on the built wheel, and scans the history for secrets.
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
- platform7nDeprecatedtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude Desktop to interact with and view tmux session content, allowing AI assistants to read from, control, and observe terminal sessions.13410 npm307MIT
- AlicenseNot gradedqualityDmaintenanceGives Claude Code terminal control and multi-agent coordination through tmux sessions.4MIT
- AlicenseAqualityDmaintenanceGives Claude Code full control over tmux sessions, windows, and panes, with an optional Sonnet-based safety classifier for destructive commands.11MIT
- AlicenseNot gradedqualityBmaintenanceExposes interactive Claude Code CLI sessions running inside tmux across one or more machines as MCP tools, enabling agents to list, create, read, and drive those sessions over stdio.1MIT