coterm
Allows creation of terminal sessions that connect to a running Docker container via docker exec, enabling AI agents to run commands and interact with the container's shell.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cotermcreate a local shell session and run 'git status'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CoTerm — AI Native Terminal Runtime
English | 中文
The runtime layer between AI and the terminal.
CoTerm isn't another terminal emulator. It's a programmable shared terminal session runtime for Humans, AI Agents, and MCP tools.
Shared Terminal Session | Human + AI Collaboration | SSH / PowerShell / WSL / Docker |
MCP Native | Session API | Prompt Detection |
Screen Buffer | Multi-Agent | Session Replay |
CoTerm is a headless runtime that manages PTY-backed shell sessions and exposes them to humans and AI through a unified Session API and MCP (Model Context Protocol) server. Any terminal, AI agent, or IDE plugs into the same shared session.
Human (Tabby / WezTerm / VS Code)
│
▼
┌─────────────────────────────────────┐
│ CoTerm Runtime │
│ Session ─ PTY ─ Prompt ─ Screen │
│ Intelligence ─ Recording ─ Workspace│
│ Input Arbitration (Human > AI) │
└──────────┬──────────────┬───────────┘
│ │
Session API MCP (stdio)
(in-process) (AI agents)What CoTerm IS
Shared Session | One terminal session, safely shared by a Human, multiple AI agents, and MCP tools — not a new terminal per consumer |
Terminal Runtime | Owns the PTY, screen buffer, prompt detection, and session lifecycle |
AI Native | Agents operate a structured Session API / MCP, not raw keystrokes |
MCP Native | 23 terminal + workspace tools over the standard Model Context Protocol |
What CoTerm is NOT
❌ A terminal emulator | Rendering is delegated to Tabby / WezTerm / VS Code / Windows Terminal |
❌ An SSH client | SSH is just one connector — same as PowerShell, WSL, Docker |
❌ A shell | The shell runs inside CoTerm-managed sessions |
❌ An AI coding agent | CoTerm is the runtime agents plug into |
Why CoTerm?
Every AI coding tool (Claude Code, OpenHands, Cline, Roo Code…) re-implements the same plumbing:
PTY lifecycle management
Output parsing and prompt detection
Session state and Ctrl+C handling
Timeouts and error handling
CoTerm solves this once. Any MCP-compatible agent connects and gets a shared, long-lived terminal session — it never re-logins, never re-initializes the environment, and never pollutes the human's terminal.
Windows ConPTY built in — the platform most terminal-sharing tools ignore.
Enterprise SSH flows (VPN → bastion → OTP → SSH) stay alive inside the session; AI attaches, it doesn't authenticate.
Human always wins — priority-based input arbitration means the human can interrupt any AI command instantly.
Related MCP server: TermPipe MCP
Features
Session Management
Full lifecycle:
created → starting → running → active → paused → closedCreate / attach / detach / close, ownership model (Human owns, AI collaborates)
Connectors
Connector | Target | Command |
| Local shell (PowerShell / CMD / bash) |
|
| Remote host via SSH |
|
| WSL distribution |
|
| Running container |
|
Input Arbitration
Human input always has priority; AI input is queued
Human can interrupt any AI command with Ctrl+C (
session:interrupted)Real-time lock/unlock state with events
Session Intelligence (L3)
Current directory tracking (error-aware, via
cdparsing — nopwdprobe)Toolchain detection (node / python / git / docker…) via PATH scan — no subprocess
Full-screen app detection (
vim,top,less) via ANSI alternate-screen sequencesCommand graph — every command with requester, duration, error heuristic, and output preview
AI Runtime (L4)
Multi-AI attach — several agents share one session with distinct identities
Session recording — JSONL event log (output, prompts, commands, interrupts)
Snapshot / restore — capture config + screen + history, recreate a session with continuity
Workspace (L5)
Group sessions into named workspaces (e.g. a deploy workspace of Linux / Redis / MySQL / K8s)
Run commands across all members in parallel
Integration
MCP server over stdio — 23 terminal + workspace tools
Session API — programmatic TypeScript interface for terminal renderers
CLI — full session lifecycle and inspection commands
Windows standalone — a single
coterm.exe, no Node.js or bun required
Tech Stack
Layer | Choice |
Language | TypeScript (strict) |
Dev runtime | bun (bundler, test runner) |
Production runtime | Node.js (via |
PTY |
|
AI protocol |
|
CLI |
|
Validation |
|
Logging |
|
Note: On Windows,
node-ptyConPTY writes are unreliable under the bun runtime. CoTerm runs the PTY layer under Node (dev viatsx, distribution viapkg). The CLI warns when launched via bun.
Quick Start
Requirements: bun (dev), Node.js 18+.
bun install
# Type-check and run tests
bun run typecheck
bun testActivate the environment (conda-activate style)
coterm # starts the daemon (if not running) and activates the shared environment
coterm activate # same, explicit
# Now every command acts on the shared environment's default session
coterm run --command "kubectl get pods" # runs in the native shell session (no session id needed)
coterm status # cwd, toolchains, command graph
coterm list # all sessions
coterm env # environment status
coterm stop # deactivate (stops the daemon)Commands pick the first running session when you omit a session id. To target a specific session, pass it: coterm status <sessionId>.
Configuration (~/.config/coterm.json)
The daemon reads its MCP port/host and shell defaults from a config file. CLI flags always override it.
coterm config # show config path + effective MCP endpoint
coterm config-set mcp_server_port 9000 # change the MCP port
coterm config-set defaultShell cmd.exe{
"mcp_server_port": 8377,
"defaultShell": "powershell.exe",
"defaultCwd": "C:\\work"
}Create sessions with connectors
coterm create --connector ssh --host jump.company.com --user admin --port 22
coterm create --connector wsl --distro Ubuntu
coterm create --connector docker --container webConnecting an AI Agent (MCP)
Multiple agents sharing one daemon (recommended)
Run a single daemon, then any number of agents connect over HTTP and share the same sessions:
{
"mcpServers": {
"coterm": {
"type": "http",
"url": "http://127.0.0.1:8377/mcp"
}
}
}Agent A creates a session; Agent B sees and attaches to it — one process, one shared session registry.
Single agent over stdio (ad-hoc)
{
"mcpServers": {
"coterm": {
"command": "coterm",
"args": ["mcp"]
}
}
}Terminal tools
Tool | Description |
| Create a session (local / ssh / wsl / docker) |
| List active sessions |
| Attach an AI (with an optional agent id) |
| Detach an AI |
| Read last N lines of output |
| Write raw input (arbitrated) |
| Run a command and wait for the next prompt |
| Wait for command completion |
| Resize the PTY |
| Send Ctrl+C |
| Close a session |
| Structured session intelligence + presence |
| Recorded command graph |
| Start / stop session recording |
| Replay recorded events (JSONL) |
| Capture a session snapshot |
| Restore a session from a snapshot |
Workspace tools
Tool | Description |
| Create a named session group |
| Add a session to a workspace |
| Remove a session from a workspace |
| List workspaces |
| Run a command across all members |
| Show member state / presence / cwd |
Session API (for terminal renderers)
CoTerm exposes an in-process TypeScript API so terminal frontends (Tabby, WezTerm, VS Code) can embed the runtime:
import { SessionAPI } from './src/api/session-api.js';
const api = new SessionAPI();
const sessionId = await api.createSession({ shell: 'powershell.exe' });
await api.runCommand(sessionId, 'git pull', 'ai');
await api.waitForPrompt(sessionId);
console.log(api.readText(sessionId));
const unsub = api.onPromptDetected(sessionId, (prompt) => {
console.log('command finished at', prompt);
});
await api.close(sessionId);Standalone Executables (Windows / Linux / macOS)
Package self-contained binaries — no Node.js or bun needed on the target machine:
bun run package:windows # -> coterm.exe
bun run package:linux # -> coterm
bun run package:macos # -> cotermPushing a v* tag runs the release workflow on all three platforms (windows-latest / ubuntu-latest / macos-latest) and publishes one GitHub Release with coterm-windows-x64.exe, coterm-linux-x64, and coterm-macos-x64. Each binary embeds the Node.js runtime, all code, and node-pty's native binaries (ConPTY on Windows, forkpty on POSIX).
Shell integration (prompt prefix + shorthand commands)
After coterm activate, the shell prompt shows a (coterm) prefix and shorthand commands
(list, status, run, stop, ...) work without the coterm prefix. It is auto-installed
on first activation — or manually:
Platform | Command | Effect |
PowerShell (Windows) |
| writes |
bash / zsh (Linux/macOS) |
| writes |
# any platform
coterm # auto-starts daemon (hidden) + activates; prompt gains "(coterm) "
list # shorthand — no "coterm" prefix needed
run --command "echo hi"
status
stop # deactivates; prompt reverts
readandhistoryshorthands are omitted on bash/zsh to avoid clashing with shell builtins (usecoterm read/coterm history).
Distribution
Ship only the single binary — it is fully self-contained. On each target machine just run it:
coterm activates (and auto-installs the shell integration on first use). Restart the shell
(or source ~/.bashrc / . $PROFILE) to see the (coterm) prompt.
Optional per-user config lives at ~/.config/coterm/config.json (mcp_server_port, defaultShell). Everything else is auto-generated at runtime.
Claude skill
A ready-to-use Claude skill lives at skills/coterm/SKILL.md —
it drives CoTerm as a pure HTTP client (calls the daemon's /cli endpoint via curl;
no MCP client config needed). Install by copying it into your agent's skills directory:
mkdir -p ~/.claude/skills && cp -r skills/coterm ~/.claude/skills/The skill only calls the running daemon — start it first with
coterm.
Project Structure
src/
├── index.ts # CLI entry
├── main.ts # Runtime bootstrap
├── api/session-api.ts # Programmatic Session API
├── core/ # types, event-bus, session, session-manager
├── pty/ # PTY adapters (Windows / POSIX) + factory
├── connectors/ # local / ssh / wsl / docker
├── buffer/ # screen buffer, prompt detector
├── queue/ # command queue, input scheduler (arbitration)
├── intelligence/ # cwd, toolchains, screen mode, command graph
├── ai/ # multi-AI, recorder, snapshot/restore
├── workspace/ # session groups
├── mcp/ # MCP server + tools
└── cli/ # CLI commandsRoadmap
L1 Session / PTY / Prompt detection / Connectors
L2 Input arbitration + Presence
L3 Session Intelligence (cwd, toolchains, command graph, full-screen detection)
L4 AI Runtime (multi-AI, recording, snapshot)
L5 Workspace (session groups, batch commands)
Plugin ecosystem (recorder, metrics, notification)
CI/CD cross-platform builds
Desktop UI (Tauri + React) as a renderer frontend
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables AI agents to interact with terminal environments through multiple concurrent PTY sessions. Supports cross-platform terminal operations including command execution, session management, and real-time communication.Last updated443MIT
- Alicense-qualityDmaintenanceProvides AI assistants with direct terminal access to execute commands, manage files, and run persistent REPL sessions. It features automated installation scripts that educate AI assistants on its capabilities for seamless integration.Last updatedMIT
- AlicenseBqualityFmaintenancePiloTY is an MCP server that provides AI agents with a persistent, interactive terminal, enabling long-running commands, log monitoring, and stateful shell interactions across tool calls.Last updated1743Apache 2.0
- AlicenseAqualityFmaintenanceMCP server that gives AI agents real interactive terminal sessions for running REPLs, SSH, database clients, and any interactive CLI with clean text output and smart completion detection.Last updated79718MIT
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Shared long-term memory vault for AI agents with 20 MCP tools.
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/our16/coterm'
If you have feedback or need assistance with the MCP directory API, please join our Discord server