Skip to main content

Simplified MCP client wrapper for efficient server interactions

Project description

mcpconn: The Missing Connector for AI

mcpconn is a Python library that provides a simple and efficient way to connect your applications to AI models using the Model Context Protocol (MCP). It acts as a wrapper around the mcp library, offering a streamlined client interface for seamless integration with various AI providers and transport protocols.

PyPI version License: MIT Documentation Tests

Table of Contents

✨ Features

  • Simplified Client Interface: A high-level MCPClient for easy interaction with MCP servers.
  • Multi-provider Support: Out-of-the-box support for Anthropic and OpenAI models. Note: OpenAI only supports remote MCP endpoints (not local/stdio/localhost). See: https://platform.openai.com/docs/guides/tools-remote-mcp
  • Flexible Transports: Connect to servers using STDIO, SSE, or Streamable HTTP. OpenAI only supports remote MCP endpoints.
  • Built-in Guardrails: Protect your application with content filtering, PII masking, and injection detection.
  • Conversation Management: Easily manage conversation history, context, and persistence.
  • Asynchronous by Design: Built with asyncio for high-performance, non-blocking I/O.
  • Extensible: Easily add new LLM providers, transports, or guardrails.

🚀 Getting Started

Installation

pip install mcpconn

Quick Start

Here's a simple example of how to use mcpconn to connect to an MCP server and interact with an AI model:

import asyncio
from mcpconn import MCPClient

async def main():
    # Connect to a local server using STDIO (Anthropic only)
    client = MCPClient(llm_provider="anthropic")
    await client.connect("python examples/simple_server/weather_stdio.py")

    # ---
    # OpenAI usage example (remote MCP only):
    # client = MCPClient(llm_provider="openai")
    # await client.connect("https://mcp.deepwiki.com/mcp", transport="streamable_http")
    # ---

    # Note: OpenAI does NOT support local/stdio/localhost servers. See: https://platform.openai.com/docs/guides/tools-remote-mcp

    # Start a conversation
    conversation_id = client.start_conversation()
    print(f"Started conversation: {conversation_id}")

    # Send a message and get a response
    response = await client.query("Hello, world!")
    print(f"AI: {response}")

    # Disconnect from the server
    await client.disconnect()

if __name__ == "__main__":
    asyncio.run(main())

📚 Documentation

For full details on all features and the complete API reference, please visit our documentation site.

The documentation is automatically generated from the main branch and includes:

  • A full Getting Started guide.
  • In-depth tutorials and examples.
  • The complete API Reference.

🗺️ Roadmap

  • Add support for more LLM providers.
  • Implement a more comprehensive test suite.
  • Add more examples and tutorials.
  • Improve documentation and type hinting.

🤝 Contributing

Contributions are welcome! If you'd like to contribute to mcpconn, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and add tests.
  4. Ensure that the tests pass.
  5. Submit a pull request with a clear description of your changes.

📄 License

mcpconn is licensed under the MIT License.

⚠️ Disclaimer

This project is under active development and may undergo significant changes.

Code of Conduct

We are committed to providing a welcoming and inclusive environment for everyone. Please read and follow our Code of Conduct.

🛡️ Security

If you discover a security vulnerability, please report it to us by emailing 2796gaurav@gmail.com. We will address all reports promptly.

🌟 Showcase

Have you built something cool with mcpconn? Written an article or created a video? We'd love to see it! Please open a pull request to add your project to this list.

💬 Support

If you have questions or need help, please open an issue in the issue tracker.

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

mcpconn-0.1.2.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

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

mcpconn-0.1.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file mcpconn-0.1.2.tar.gz.

File metadata

  • Download URL: mcpconn-0.1.2.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for mcpconn-0.1.2.tar.gz
Algorithm Hash digest
SHA256 009e2bd36151fb9a411a2440d8e84640ba569c754db5c738f39116366df60bf7
MD5 3e25284fc0f42b16627d5242db2052df
BLAKE2b-256 7485296ab0a14d593d890ece87ca4099a06d7aa3cb90c57efb3c9981e0fae8e5

See more details on using hashes here.

File details

Details for the file mcpconn-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mcpconn-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for mcpconn-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4dac19f4be27acb1762902587221d78fa9bfcf2f69bf9c317afb0aa4861dbbfe
MD5 d40fcf7428cdb8a1851e677cd6ceebe5
BLAKE2b-256 34a7582f3395fd88469d5533cd67a0b4326043796c76f80c17057c14d6664c64

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