pexpect-mcp
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.
Metadata
Release files for iflow-mcp_mitsuhiko-pexpect-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0.tar.gz | 8.1 kB | Without provenance | Details for iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0.tar.gz
| Download URL | iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2f2f6b2dea1677dae9c1d934dcd512f119d24a511790b789faf2eddea3cd348
|
|
BLAKE2b-256 checksum How to use checksums |
9dc508443f39bda5d9dcd18e9cbac61e96b615f103a23a0cfe035279cd011cea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0-py3-none-any.whl
| Download URL | iflow_mcp_mitsuhiko_pexpect_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93a6968c1c499cc2b5f81b40d632cf2fd866fb507e1cd884470f0d7218fd0d77
|
|
BLAKE2b-256 checksum How to use checksums |
6585a5395690773da0922f270217154eed84b7cbf00aaeee04b6c79c442a1214
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for iflow-mcp_mitsuhiko-pexpect-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.