- MCP Connect Client CLI
MCP Connect Client CLI
MCP Connect Client CLI
MCP Connect is a versatile command-line interface (CLI) client designed to connect to various Model Context Protocol (MCP) servers using stdio transport. It provides seamless integration with OpenAI models and supports dynamic tool and resource management across multiple servers.
Features
- Stdio Transport: Connects to MCP servers using efficient stdio transport.
- OpenAI Integration: Leverages OpenAI models for advanced processing.
- Multi-Server Support: Connects to multiple MCP servers simultaneously.
- Dynamic Tool Discovery: Automatically discovers and lists available tools.
- Resource Management: Accesses and manages resources across servers.
Architecture Overview
Client-Side Components
- Command Parser: Interprets user commands and routes them to the appropriate handlers.
- Tool Manager: Manages tool execution requests and interactions with servers.
- Resource Manager: Handles resource access requests.
- OpenAI Integration: Processes data using OpenAI models for enhanced capabilities.
- Response Formatter: Formats responses for user-friendly output.
Server-Side Components
- MCP Servers: Each server provides specific tools and resources, accessible via stdio transport.
Getting Started
Prerequisites
- Python 3.12 or later
- Virtual environment setup
- OpenAI API Key
Installation
-
Clone the Repository:
git clone https://github.com/Abiorh001/mcp_connect.git cd mcp_connect -
Set Up Virtual Environment:
uv venv or python -m venv .venv source .venv/bin/activate -
Sync Dependencies with
uv:uv sync -
Configure Environment Variables: Create a
.envfile in the root directory with the following content:OPENAI_API_KEY=your_openai_api_key -
Update the
servers_config.json: Ensure yourservers_config.jsonis correctly configured to define the MCP servers you wish to connect to and the LLM configuration. Here is an example configuration:{ "LLM": { "model": "gpt-4o-mini", "temperature": 0.5, "max_tokens": 1000, "top_p": 0, "frequency_penalty": 0, "presence_penalty": 0 }, "mcpServers": { "server-name": { "command": "python", "args": ["mcp-server.py"], "env": { "API_KEY": "value" } } } }
Running the Client
-
Start the MCP Servers: Use
uvto run your MCP servers. For example:uv run main.py -
Run the MCP Connect Client:
python mcp_client.py
Usage
- List Available Tools:
/tools - List Available Resources:
/resources - Read a Resource:
/resource:<uri> - Toggle Debug Mode:
/debug - Refresh Capabilities:
/refresh - Exit the Application:
quit
Contributing
We welcome contributions! Please fork the repository and submit a pull request with your changes.
License
This project is licensed under the MIT License.
Contact
For questions or support, please contact [abioladedayo1993@gmail.com] or open an issue on GitHub.