Python library for interacting with multiple LLMs using mcp.run tools and seamless API integration
mcpx-py is a Python library designed to facilitate interaction between AI applications and LLMs (Large Language Models) using the Model Context Protocol (MCP). MCP serves as a universal adapter, allowing AI applications such as Claude Desktop, Continue, Cursor, and others to connect seamlessly with specific data sources and tools through a standardized protocol. This server enhances AI application integration by providing a robust framework for communication between these tools.
mcpx-py supports a wide range of AI providers, including those supported by PydanticAI. The library offers flexible usage options, enabling developers to easily switch between different LLMs like Claude-3-5-Sonnet-Latest, GPT-4o, Ollama, and Gemini. Users can define the result_type
parameter for structured output, making it easier to handle responses from these models.
Mcpx-py implements the MCP protocol by providing tools and APIs that enable seamless integration between AI applications and LLMs. This implementation ensures that the server is compatible with various MCP clients, enhancing the overall user experience. The library supports installation through both pip
and uv
, making it accessible to a broad audience.
To get started with mcpx-py, users need to install the necessary dependencies. For Python installations, they can use pip:
pip install mcpx-py
Alternatively, using uv for tool management is also supported:
uv add mcpx-py
uv tool install .
If you are working with git repositories, installation through uvx
or command-line tools is also feasible. This versatility ensures that developers can easily integrate mcpx-py into their projects.
mcpx-py serves as a critical component in various AI workflows, including content generation, data processing, and tool integration. For instance, when integrating with a natural language processing (NLP) task like text summarization, developers can use mcpx-py to seamlessly connect their application with the LLMs supported by MCP.
from mcpx_py import Chat
llm = Chat("claude-3-5-sonnet-latest")
response = llm.send_message_sync(
"summarize the contents of example.com"
)
print(response.data)
In this workflow, mcpx-py enables developers to leverage the power of LLMs for content generation by providing a straightforward API that abstracts away the complexities of interfacing with the Model Context Protocol.
Mcpx-py is compatible with several MCP clients, including Claude Desktop, Continue, Cursor, and others. This compatibility matrix highlights which clients are fully supported:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
Developers can integrate mcpx-py into their applications by setting environment variables and using the provided APIs. This seamless integration ensures a smooth user experience across different AI tools.
Mcpx-py's performance and compatibility make it an ideal choice for developers looking to enhance their AI applications with MCP support. The library ensures that applications can communicate effectively with various LLMs, providing robust and reliable integrations.
The following Mermaid diagram illustrates the flow of communication between an AI application, mcpx-py, a data source/tool, and the Model Context Protocol:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
This diagram demonstrates the seamless interaction between components, highlighting the importance of mcpx-py in connecting different parts of an AI application.
Mcpx-py provides advanced configuration options for developers to tailor their integrations according to specific requirements. Users can set environment variables and define custom configurations using JSON:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
These configurations ensure that the server is secure and meets the needs of different AI applications.
result_type
, developers can receive more structured responses, facilitating easier processing and integration.Contributions to mcpx-py are welcome from experienced developers who wish to enhance its features and functionality. Developers interested in contributing should familiarize themselves with the project’s codebase, testing environment, and contribution guidelines available on GitHub.
Mcpx-py is part of a broader MCP ecosystem, offering resources for developers looking to integrate AI applications effectively. These include documentation, community support, and detailed guides that outline best practices for MCP integration.
By leveraging mcpx-py, developers can create powerful and flexible AI applications that seamlessly integrate with various LLMs and MCP clients, driving innovation in the field of AI development.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods