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., "@pty-mcprun drizzle-kit generate and answer any interactive prompts"
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.
pty-mcp
MCP server that gives AI coding agents a real pseudo-terminal (PTY) for handling interactive CLI prompts. Spawn processes, read their output, and send intelligent responses — no human in the loop.
Why I Built This
I was using Claude Code with Drizzle ORM and hit a wall: drizzle-kit generate asks interactive questions like "Is this table created or renamed?" that Claude Code couldn't answer. It just hung. I wanted something minimal and self-contained, so I built one.
It works for way more than just Drizzle though — any CLI tool with interactive prompts becomes fully autonomous:
Database migrations — Drizzle Kit, Prisma, TypeORM, Knex
Project scaffolding —
npm init,create-next-app,create-vite,npx degitPackage managers —
npm installpeer dep prompts,yarnresolutionsGit operations — interactive rebase, merge conflict resolution,
git add -pCloud CLIs —
aws configure,gcloud init,firebase init,vercelDocker —
docker buildprompts,docker composeconfirmationsSystem tools —
ssh-keygen,gpg --gen-key,certbotLinters/formatters — ESLint
--init, Prettier setup,stylelintconfig
The Problem
AI coding agents like Claude Code can run shell commands, but they can't handle interactive prompts. When a CLI tool asks "Is this table created or renamed?" or "Pick a preset:", the agent gets stuck — it can't read the prompt or type an answer. This blocks any CLI workflow that requires human input — database migrations, project scaffolding, package configuration, and more.
The Solution
pty-mcp gives the agent a real pseudo-terminal via the Model Context Protocol. The agent can:
Spawn a command in a PTY
Read the interactive prompt output
Write an intelligent response
Repeat until the process exits
Setup
Add to your Claude Code MCP settings (~/.claude/settings.json):
{
"mcpServers": {
"pty-mcp": {
"command": "npx",
"args": ["-y", "pty-mcp"]
}
}
}Requirements
Node.js 20+
Build tools for native addon compilation (Python 3, make, g++)
macOS:
xcode-select --installUbuntu/Debian:
sudo apt install build-essential python3Windows: Pre-built binaries included, no extra tools needed
Tools
pty_spawn
Spawn a command in a pseudo-terminal.
Parameter | Type | Default | Description |
| string | (required) | Command to run |
| string[] |
| Command arguments |
| string | server CWD | Working directory |
| object |
| Extra environment variables (merged with system env) |
| number |
| Wait for output to settle before returning |
Returns: { session_id, output, is_running, exit_code }
pty_write
Send input to a running PTY session.
Parameter | Type | Default | Description |
| string | (required) | Session ID from |
| string | (required) | Text to send |
| boolean |
| Append Enter after input |
| number |
| Wait for output to settle before returning |
Returns: { output, is_running, exit_code }
pty_kill
Kill a running session.
Parameter | Type | Default | Description |
| string | (required) | Session ID to kill |
Returns: { success: true }
Example: Handling Interactive Prompts
Agent calls pty_spawn({ command: "npx", args: ["drizzle-kit", "generate"] })
→ Returns output: "Is 'users' table created or renamed from another table? ❯ create / rename"
Agent reads the prompt, understands context, decides "create"
→ Calls pty_write({ session_id: "abc-123", input: "" })
Process continues, agent answers more prompts as needed...
Process exits → agent gets final output with resultsHow It Works
Uses node-pty (Microsoft, powers VS Code's terminal) for real PTY allocation
ANSI escape codes are stripped automatically for clean output
Sessions auto-expire after 5 minutes of inactivity
All sessions are cleaned up on server shutdown
No shell wrapping — commands are spawned directly (no injection risk)
Security
Local only — stdio transport, no network exposure, no ports opened
No shell injection — uses
pty.spawn(command, args)directly, notbash -cNo secrets stored — environment variables are passed through, not logged
Session isolation — each spawn gets its own PTY with a unique session ID
Session limits — max 20 concurrent sessions, 30s max idle timeout per request
Auto-cleanup — idle sessions killed after 5 minutes, graceful shutdown on crash
Trust model: This server grants command execution to the connected MCP client. Only connect it to clients you trust (e.g., Claude Code on your local machine). The server inherits your shell environment — spawned processes have access to the same env vars as your terminal.
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.