PexpectBLOCK
python + pexpect
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 supporttimeout(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.
6c5f1b491cfaOBSERVED · 2026-10-07Connect
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 mcp add pexpect-mcp -- uvx pexpect-mcp
{
"mcpServers": {
"pexpect-mcp": {
"command": "uvx",
"args": [
"pexpect-mcp"
]
}
}
}Exposed tools (1)
0 read · 1 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
pexpect_tool | write | Execute Python code in a pexpect session. Can spawn processes and interact with them. |
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.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (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)
result = eval(code, {"__builtins__": __builtins__}, local_vars)exec(code, {"__builtins__": __builtins__}, local_vars)Gates applied: no_behavioural_pass.
6c5f1b491cfafull audit observations/trust-audit/mcp-server/mitsuhiko__pexpect.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-07 | 6c5f1b491cfa | BLOCK | D | 69 | first audit |
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.