Python client, based on fastmcp, for connecting to MCP servers through multiple protocols, specifically designed to work with integrated language models.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
MCP LLM client
Python client, based on fastmcp, for connecting to MCP servers through multiple protocols, specifically designed to work with integrated language models.
Table of Contents
- Overview
- Installation
- Implemented Models
- Implemented Transfer Protocols
- System Requirements
- Usage Example
- Version History
- Project Status
- License
Overview
This package provides a Python interface to connect to MCP servers in an easy, intuitive, and configurable way. It offers a modular architecture that allows for easy extension of new transfer protocols and language models. Currently includes support for HTTPStream and GPT-4 mini, with expansion capability for more options in the future.
Installation
To install the MCP client, you can use pip:
pip install mcp-llm-client
Implemented Models
The client currently supports the following language models:
| Model | Technical Description |
|---|---|
| gpt4o-mini | Optimized implementation of the GPT-4 model that provides a balance between computational performance and resource efficiency. This model is specifically designed to operate in environments with memory constraints while maintaining superior predictive quality. |
🚨 CRITICAL CONFIGURATION NOTE Currently, this project only work with
gpt4o-minillm model.
Implemented Transfer Protocols
Protocols for communication with MCP servers:
| Protocol | Status | Technical Characteristics |
|---|---|---|
| HTTPStream | Implemented | Asynchronous HTTP-based protocol that enables continuous data streaming. Characterized by low memory consumption and real-time processing capability for partial responses. |
| SSE (Server-Sent Events) | Not Implemented | Unidirectional protocol that allows the server to send multiple updated events through a single HTTP connection. Designed specifically for applications requiring real-time updates from the server. |
| stdio | Not Implemented | Standard input/output interface that facilitates direct communication between processes. Will provide a lightweight alternative for local environments and unit testing. |
🚨 CRITICAL CONFIGURATION NOTE Currently, this project only work with
HTTPStreamprotocol.
Future Development Planning
Pending Language Models
- Integration of additional language models
- Implementation of dynamic model selection system
- Optimization of model loading and management
Pending Protocols
- Complete implementation of SSE for better real-time event handling
- Development of stdio interface for local environments
- Performance optimization across all protocols
System Requirements
Environmental Configuration
-
.envfile: The.envfile contains the authentication credentials necessary for integration with external services. This file must be created in the project root directory with the following format:# .env # OpenAI Authentication OPENAI_API_KEY=<YOUR OPENAI-API-KEY>
-
config.jsonfile: Theconfig.jsonfile defines the configuration of available MCP servers. It must be created in the project root directory with the following structure:{ "mcp_servers": { "example_public_server": { "transport": "httpstream", "httpstream-url": "http://127.0.0.1:8000/public-example-server/mcp", "name": "example-public-server", "description": "Example public server." }, "example_private_mcp": { "transport": "httpstream", "httpstream-url": "http://127.0.0.1:8000/private-example-server/mcp", "name": "example-private-server", "description": "Example private server with oauth required.", "auth": { "required": true, "server": "http://127.0.0.1:9000", "secrets": { "username": "user", "password": "password" } } } } }
If you need an MCP server to test the code, you can use simple-mcp-server.
Dependencies
Python = ">=3.11"openai = "^1.68.2""mcp[cli]"mcp-oauth
Usage Example
#example1.py
from mcpclient import open_local_chat
open_local_chat()
#example2.py
from mcpclient import Chat
chat: Chat = Chat()
while True:
query = input("> ")
if query == "":
break
for step in chat(query):
print(f"<< {step.json}")
Alternatively, you may test this service using the following template available on GitHub:
# clone repo
git clone https://github.com/rb58853/template_mcp_llm_client.git
# change to project dir
cd template_mcp_llm_client
# install dependencies
pip install -r requirements.txt
# open in vscode
code .
Version History
v0.0.1
- Initial implementation of
Chatclient - Complete integration of
httpstreamprotocol (fasmcp) - Connectivity with multiple servers
- Simplified config.json file for connection management
- Efficient processing of multiple simultaneous requests to tools and resources within a single query
- Simple connection without authorization (compatible only with servers that do not require authentication)
v0.0.4
- Package dependencies are incorporated during its initial installation process.
v0.0.5
- The LLM system is structured in steps, with each step being returned to the client making the query. This approach allows for the identification of the current stage within the query process.
- Efficient language detection has been implemented for queries, enabling responses to be provided based on the detected language.
- The
open_local_chat()function has been added, making it easy to use a local chat.
v0.0.6
- The exposed services have been added to the context of all queries, including those that do not require the use of a specific service. This approach allows for general inquiries regarding the available services.
v0.0.7
- A simple authorization system based on user credential authentication (username and password) was integrated. For further reference, please see mcp-oauth.
v0.0.8
- The prompts for language models (LLMs) were optimized to deliver responses that are more closely aligned with the MCP context.
- The service extraction step was merged with the argument creation step, enabling both services and arguments to be identified in a single stage.
Project Status
⚠️ Important Notice: This project is currently in active development phase. As a result, errors or unexpected behaviors may occur during usage
License
MIT License. See license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_llm_client-0.0.8.tar.gz.
File metadata
- Download URL: mcp_llm_client-0.0.8.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25d9a8c0d1adb8e374b2dae3287065bbb6d05c9973f09749c1148c7839b55ff4
|
|
| MD5 |
3746dbe1e45b8a7fd3021da86904361a
|
|
| BLAKE2b-256 |
3e1f9c531479c4310674b90e6ef9c32039161b57fbbfb2d1e2836e65b7a36c2a
|
File details
Details for the file mcp_llm_client-0.0.8-py3-none-any.whl.
File metadata
- Download URL: mcp_llm_client-0.0.8-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19e0ceaf3a6c299272d343452873c3dafd71460488b15ac408fd818b79928f79
|
|
| MD5 |
cbb63f8ecc30ed6083d184bdcdf968a7
|
|
| BLAKE2b-256 |
6e73b3b55d1192b22ed59ca576d7548364a8b836f752c66d7f2ad3a6dd740d7c
|