NPCterm: Full PTY Terminal Emulator for AI Agents via MCP

✍️ OpenClawRadar📅 Published: April 15, 2026🔗 Source
NPCterm: Full PTY Terminal Emulator for AI Agents via MCP
Ad

NPCterm is a headless, in-memory full PTY terminal emulator for AI agents, exposed via MCP (Model Context Protocol). It gives AI agents full terminal access, not just bash, allowing them to spawn shells, run arbitrary commands, read screen output, send keystrokes, and interact with TUI applications.

Key Features

  • Full ANSI/VT100 terminal emulation with PTY spawning via portable-pty
  • 15 MCP tools for complete terminal control over JSON-RPC stdio
  • Process state detection – knows when a command is running, idle, waiting for input, or exited
  • Event system – ring buffer of terminal events (CommandFinished, WaitingForInput, Bell, etc.)
  • AI-friendly coordinate overlay for precise screen navigation
  • Mouse, selection, and scroll support for interacting with TUI applications
  • Multiple concurrent terminals with short 2-character IDs
Ad

Example MCP Flow

The source provides a concrete example of using NPCterm to open and quit Vim:

// 1. Create a terminal
// -> terminal_create {}
// <- {"id": "a0", "cols": 80, "rows": 24}

// 2. Open vim // -> terminal_send_keys {"id": "a0", "input": [{"text": "vim"}, {"key": "Enter"}]} // <- {"success": true}

// 3. Read the screen to confirm vim is open // -> terminal_show_screen {"id": "a0"} // <- ~ VIM - Vi IMproved // <- ~ version 9.2.250 // <- ~ by Bram Moolenaar et al. // <- ~ type :q<Enter> to exit // <- ...

// 4. Quit vim // -> terminal_send_keys {"id": "a0", "input": [{"text": ":q"}, {"key": "Enter"}]} // <- {"success": true}

The source includes a warning: "Use with precautions. A terminal is an unrestricted execution environment." This tool is effectively equivalent to giving an AI agent access to a computer.

The project is available on GitHub at github.com/alejandroqh/npcterm.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

Open-Source Ralph Loop Toolkit for Claude Code: Pickle Rick and Mr. Meeseeks Agents
Tools

Open-Source Ralph Loop Toolkit for Claude Code: Pickle Rick and Mr. Meeseeks Agents

An open-source extension for Claude Code implements the Ralph Loop technique with two autonomous agents: Pickle Rick for PRD-driven development and Mr. Meeseeks for code review. Both use tmux with live dashboards and macOS notifications.

OpenClawRadar
RelayPlane Open Source Proxy Shows 73% Cost Reduction with Claude Model Routing
Tools

RelayPlane Open Source Proxy Shows 73% Cost Reduction with Claude Model Routing

RelayPlane, an open source npm-native proxy for the Anthropic API, demonstrated 73.4% cost savings in benchmarks by routing requests to appropriate Claude models based on complexity. The tool reduced cost per 10 requests from $0.0323 to $0.0086 while improving p50 latency from 1.55s to 0.78s.

OpenClawRadar
AI-Setup CLI Tool Automatically Generates AI Configuration Files for Local LLM Stacks
Tools

AI-Setup CLI Tool Automatically Generates AI Configuration Files for Local LLM Stacks

AI-Setup is a CLI tool that scans codebases and automatically generates AI configuration files like .cursorrules and claude.md. It detects your stack to eliminate manual rule writing for each new project.

OpenClawRadar
TUI Studio: Visual Terminal UI Design Tool in Alpha
Tools

TUI Studio: Visual Terminal UI Design Tool in Alpha

TUI Studio is a Figma-like visual editor for designing terminal user interfaces with drag-and-drop components, real-time ANSI preview, and planned export to six frameworks including Ink, BubbleTea, and Textual. Currently in alpha with non-functional exports, it's available for macOS, Windows, and Docker.

OpenClawRadar