Skip to main content

Minimal MCP Agent REPL interface

Project description

MCPx - MCP Agent REPL Interface

A command-line REPL (Read-Eval-Print Loop) interface for interacting with AI agents powered by the Model Context Protocol (MCP) framework.

Version

0.0.1

Features

  • Command-line interface for interacting with AI agents
  • Persistent conversation history across sessions
  • Web browsing capabilities via Playwright
  • Customizable system prompts and configuration
  • Command history navigation
  • Rich terminal output with markdown rendering
  • Real-time tool usage streaming during agent thinking

Installation

Using uv (recommended)

uv tool install .

Using pip

pip install .

Usage

Once installed, you can use the mcpx command:

# Start the REPL interface
mcpx run

# Open the configuration directory
mcpx config

# Edit the configuration file directly
mcpx edit

# Edit the system prompt 
mcpx prompt

Chat Commands

While in the REPL interface, you can use the following chat commands:

  • /clear - Clear the conversation history
  • /help - Show available commands
  • /tools - List all available MCP tools (with robust detection across various agent structures)
  • /fix - Fix corrupted conversation history by removing empty messages
  • /init - Re-initialize the agent and MCP servers (useful when tools stop working or you've started new servers)

These commands support tab-completion.

Real-time Tool Usage Streaming

MCPx displays real-time information about what tools the agent is using while it's thinking. This helps you:

  • See which tools are being called and with what inputs
  • Understand the agent's reasoning process
  • Monitor progress during longer tasks
  • Debug when tools are failing or giving unexpected results

The tool usage is displayed inline during the "thinking" phase with the following information:

  • Tool name and sequence number
  • Tool input (truncated for readability)
  • Tool result or error (if any)
  • Final tool usage count

Configuration

Configuration is stored in the user's config directory:

  • macOS: ~/Library/Application Support/mcp-agent-x/
  • Linux: ~/.config/mcp-agent-x/
  • Windows: C:\Users\<username>\AppData\Roaming\mcp-agent-x\

The following files are available in the configuration directory:

  • config.json - Main configuration for MCPx including LLM and agent settings
  • system_prompt.md - System prompt that controls the agent's behavior

Requirements

  • Python 3.11+
  • Google API key (for Gemini model)
  • Node.js (for Playwright)

Environment Variables

Create a .env file in your project directory with:

GOOGLE_API_KEY=your_google_api_key

Development

Running Tests

To run the tests:

# Install development dependencies
uv tool install -e ".[dev]"

# Run tests
python run_tests.py

# Or directly using pytest
pytest -v tests

The test suite includes:

  • Configuration management tests
  • Conversation history tests
  • REPL functionality tests

Debugging

If you encounter issues with conversation history, check the following:

  • Use the /fix command to repair corrupted history with empty messages
  • Ensure the history file is properly formatted JSON
  • Check file permissions for the config directory
  • Review the error messages for specific issues

If MCP tools stop working:

  • Use the /init command to reconnect to MCP servers and refresh available tools
  • Check that required servers (like Playwright) are running
  • Verify your internet connection

Error Messages

The application provides helpful error messages for common issues:

  • Empty message content: If this error occurs, run the /fix command to remove empty messages from your conversation history.
  • API rate limit exceeded: Wait a moment and try again.
  • Agent not properly initialized: Use the /init command to re-initialize the agent.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_agent_x-0.0.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_agent_x-0.0.1-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_agent_x-0.0.1.tar.gz.

File metadata

  • Download URL: mcp_agent_x-0.0.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mcp_agent_x-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e5968a004d04bb7dc9a6a231d86df1279c5622e4b115397c343066f179119f2e
MD5 a8d3142847f4537276667ea041f655d7
BLAKE2b-256 c03b99b6d608a627f0b59f5da8f611f1041102900c46cd6a2d204d545bcfa6bd

See more details on using hashes here.

File details

Details for the file mcp_agent_x-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_agent_x-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mcp_agent_x-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97483d15f08cae1a8037aad7dad62c5f7921d63e34aeabd279510c888335f3d8
MD5 c74d9605985abd3ada7ded9245a06307
BLAKE2b-256 66130801429e4fb6c1d2fad8c28bb8189a992fbf61cce3a436a6db3901767e7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page