Skip to main content

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

Python MCP Client

License: MIT Version Last commit Commit activity Stars Forks Watchers Contributors

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

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-mini llm 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 HTTPStream protocol.

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

  • .env file: The .env file 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.json file: The config.json file defines the configuration of available MCP servers. It must be created in the project root directory with the following structure:

    {
        "mcp_servers": {
            "example_server": {
                "http": "http://0.0.0.0:8000/server/mcp",
                "name": "Example mcp server",
                "description": "A simple example MCP server"
            }
        }
    }
    

    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]"

Usage Example

#main.py
from mcpclient import open_local_chat
open_local_chat()

Version History

v0.0.1

  • Initial implementation of ClientLLM client
  • Complete integration of httpstream protocol (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.

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


Download files

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

Source Distribution

mcp_llm_client-0.0.5.tar.gz (15.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_llm_client-0.0.5-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_llm_client-0.0.5.tar.gz.

File metadata

  • Download URL: mcp_llm_client-0.0.5.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mcp_llm_client-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6c305856c0c7f8267235e966e457158c6e3db4251cf5ae5493a0504437850bab
MD5 3ca5ee6c379b920adc563c85e468b4db
BLAKE2b-256 34fb923fde3782a035de47e8b07e56948a3e37d8077d4485806d26908fb9f049

See more details on using hashes here.

File details

Details for the file mcp_llm_client-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mcp_llm_client-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mcp_llm_client-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6482d2477671749e64fe931863bfad1191cd47e62b8954c009473d9f4b05e979
MD5 8d0ed9354453554b636b79713d8ceb5e
BLAKE2b-256 fa350bef105ff347ff4f7ffa5aead38a893a4d56ffdc0d90b206cb659ece6e7d

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