Atlas / MCP servers / mitsuhiko / Pexpect

PexpectBLOCK

mcp/mitsuhiko/pexpect

python + pexpect

Verdict
BLOCK
Grade
D
Trust score
69 /100
Exposed tools
1 0r · 1w · 0d
Transport
—
License
Apache-2.0
Stars
74
01

Overview

From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.

An MCP (Model Context Protocol) server that provides remote pexpect session control for debugging and process interaction.

Overview

This MCP server enables AI assistants to execute Python code with pexpect functionality, allowing for interactive debugging sessions with tools like LLDB, GDB, and other command-line utilities that require programmatic interaction.

In some sense this is less of a pexpect MCP as one that is just maintaining a stateful Python session.

Installation

uv tool install git+https://github.com/mitsuhiko/pexpect-mcp

Usage

As an MCP Server

Add to your Claude Code configuration:

{
"mcpServers": {
"pexpect": {
"command": "pexpect-mcp"
}
}
}

Tool Usage

The server provides a single tool: pexpect_tool

Parameters:

  • code (string): Python code to execute with pexpect support
  • timeout (optional int): Timeout in seconds (default: 30)

Example Usage:

# Start a debugging session
child = pexpect.spawn('lldb ./my-program')
child.expect('(lldb)')

# Run the program
child.sendline('run')
child.expect('(lldb)')
print(child.before.decode())

# Get backtrace
child.sendline('bt')
child.expect('(lldb)')
print(child.before.decode())

Demo

The repository includes a demo with a buggy C program (demo-buggy.c) that can be debugged using LLDB through the pexpect interface. This demonstrates the server's capability for interactive debugging sessions.

The program `./demo-buggy` crashes when executed. Use LLDB to:

- Start the program under the debugger
- Identify where and why it crashes
- Examine variables, memory, and call stack
- Report the root cause of the crash

Requirements

  • Python ≥ 3.12.1
  • pexpect ≥ 4.9.0
  • mcp ≥ 1.13.0

License

See LICENSE file for details.

Read from source at commit 6c5f1b491cfaOBSERVED · 2026-10-07
Advertisement
02

Connect

Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control.

claude-code
claude mcp add pexpect-mcp -- uvx pexpect-mcp
claude-desktop
{
  "mcpServers": {
    "pexpect-mcp": {
      "command": "uvx",
      "args": [
        "pexpect-mcp"
      ]
    }
  }
}
03

Exposed tools (1)

0 read · 1 write · 0 destructive.

ToolRiskDescription
pexpect_toolwriteExecute Python code in a pexpect session. Can spawn processes and interact with them.
04

Trust audit

BLOCKgrade D · trust 69/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.

LayerWhat it checksResult
L0Provenance & inventoryPASS
L1Static analysis of the codeFAIL
L2Instruction surface (what it tells the agent)PASS
L3Class-specific surfacePASS
L4Behavioural (sandbox)SKIPPED

What the source does

Filesystem
none-observed
Network
none-observed
Shell
declared (2 observation(s))
Dependencies
pinned
Secrets in source
none-found

Findings (2)

HIGHCode injection · code.eval_exec · CWE-78, CWE-94, CWE-95
src/pexpect_mcp/server.py:104
result = eval(code, {"__builtins__": __builtins__}, local_vars)
Why it matters. evaluates text as code
Fix. remove; use a parser or a dispatch table
HIGHCode injection · code.eval_exec · CWE-78, CWE-94, CWE-95
src/pexpect_mcp/server.py:113
exec(code, {"__builtins__": __builtins__}, local_vars)
Why it matters. evaluates text as code
Fix. remove; use a parser or a dispatch table

Gates applied: no_behavioural_pass.

Audited 2026-10-07 · audit v0.4.1 · source sha 6c5f1b491cfafull audit observations/trust-audit/mcp-server/mitsuhiko__pexpect.json · Report an issue / request a re-scan
05

Audit history

Every audit this server has had. A grade with a past is a grade somebody is still checking.

DateSourceVerdictGradeScoreChange
2026-10-076c5f1b491cfaBLOCKD69first audit
06

Questions

What is the Pexpect MCP server?

python + pexpect

What tools does Pexpect expose?

1 in total: 0 read-only, 1 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.

Is Pexpect safe to connect to an agent?

No — not without reading the findings first. The audit graded it D (69/100) and found 2 critical or high issues in the source. Each one is listed on this page with the file and line it is on.

What credentials does Pexpect need?

No credential environment variables were found in its source, so it appears to need none.

How current is this page?

The grade is for one exact copy of the source (6c5f1b491cfa), read on 2026-10-07. The repository is watched and re-audited when it changes.

Advertisement