Pexpect MCP Server
Enables execution of Python code with pexpect functionality for interactive process control and debugging sessions with command-line tools like LLDB and GDB
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Pexpect MCP Serverdebug the demo-buggy program with lldb and show me the backtrace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: MCP GDB Server
Installation
uv tool install git+https://github.com/mitsuhiko/pexpect-mcpUsage
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 crashRequirements
Python ≥ 3.12.1
pexpect ≥ 4.9.0
mcp ≥ 1.13.0
License
See LICENSE file for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceProvides an interactive Python REPL environment that maintains persistent session state, allowing users to execute Python code and access session history.Last updated54
- AlicenseBqualityCmaintenanceProvides GDB debugging functionality for use with Claude or other AI assistants, allowing users to manage debugging sessions, set breakpoints, examine variables, and execute GDB commands through natural language.Last updated16132154MIT
- Alicense-qualityAmaintenanceProvides a stateful Django shell environment that allows AI assistants to execute Python code directly against Django projects. Maintains persistent session state between calls, enabling iterative exploration of models, queries, and debugging.Last updated40MIT
- Flicense-qualityDmaintenanceProvides stateful, interactive terminal access for LLMs to spawn and maintain persistent processes like SSH sessions, debuggers, and REPLs with continuous input/output interaction across commands.Last updated7
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mitsuhiko/pexpect-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server