pymcp-sse
by rvirgilli
pymcp-sse is a lightweight and flexible Python library implementing the Model Context Protocol (MCP), specializing in robust HTTP/SSE transport. It provides tools for building MCP servers and clients with features like tool registration, server push, and LLM integration.
Last updated: N/A
What is pymcp-sse?
pymcp-sse is a Python library that provides a modular framework for implementing the Model Context Protocol (MCP) over HTTP/SSE. It includes base classes for servers and clients, along with features like tool registration, server push notifications, and LLM integration.
How to use pymcp-sse?
To use pymcp-sse, install the library using pip. Then, you can create MCP servers and clients using the provided base classes and decorators. The README provides examples for creating simple servers, servers with background tasks, single clients, and multi-server clients. Refer to the documentation in the docs/
directory for more detailed instructions.
Key features of pymcp-sse
Modular Framework
HTTP/SSE Transport
Concurrent Task Execution
Tool Registration & Discovery
Server Push
LLM Integration
Flexible Logging
Use cases of pymcp-sse
Building microservices that communicate using MCP
Creating real-time data streaming applications
Integrating LLMs into existing systems
Developing applications that require server-initiated push notifications
FAQ from pymcp-sse
What is MCP?
What is MCP?
MCP stands for Model Context Protocol. It's a protocol for communication between applications, particularly useful in contexts where models or agents need to interact.
What is SSE?
What is SSE?
SSE stands for Server-Sent Events. It's a simple protocol for a server to push data updates to a client over HTTP.
How do I install pymcp-sse?
How do I install pymcp-sse?
You can install it locally for development using pip install -e .
in the directory containing pyproject.toml
. Once published, it will be available via pip install pymcp-sse
.
How do I register a tool on a server?
How do I register a tool on a server?
You can register a tool using the @server.register_tool()
decorator. This allows clients to dynamically query the server for available tools and their parameters.
How do I handle server push notifications?
How do I handle server push notifications?
pymcp-sse includes built-in support for server-initiated push notifications. You can use the NotificationScheduler
helper class to schedule notifications and define a handler on the client side to process them.