Member-only story
If you have spent any time building AI agents that need to touch a real shell, you have probably run into the same wall: your agent fires off a command, waits a fixed number of seconds, and then hopes for the best. Sometimes it works. Sometimes the server is still booting. Sometimes the process crashed three seconds in and your agent is now happily curling a dead port. This article walks through NPCterm, an MCP server built to fix exactly that problem, and along the way explains the underlying concept that makes it possible: the PTY.
What NPCterm Actually Is #
NPCterm is a headless, in-memory terminal emulator that speaks the Model Context Protocol (MCP). In plain terms, it is a program that gives an AI agent a real terminal to work with, minus the graphical window.
There is no official expanded acronym behind the name, it is just a project name, but functionally you can describe it as an MCP terminal server, or an in-memory PTY built for AI agents.
Instead of exposing a single “run this command and give me the output” tool, which is what most simple shell-execution tools do, NPCterm exposes a full set of terminal primitives:
- creating sessions,
- sending keystrokes,
- reading the screen,
- resizing the terminal,
- and checking process…