AnyMCP
An adapter library for Model Context Protocol (MCP) SSE servers to connect as stdio.
Overview
AnyMCP provides a bridge between SSE-based (Server-Sent Events) MCP servers and standard input/output (stdio). It allows you to connect to remote model servers that implement MCP over SSE and interact with them using traditional stdio interfaces.
Features
- Connect to MCP servers via SSE endpoints
- Bridge SSE communication to standard input/output
- Maintain persistent connections with automatic reconnection
- Support for authentication via bearer tokens
- Comprehensive logging with adjustable verbosity
- Configurable timeouts and heartbeat intervals
This package is meant to be used with Arcee AnyMCP. Arcee AnyMCP makes it super easy to deploy your own MCP servers.
Installation
Using pip
pip install anymcp
From source
git clone https://github.com/arcee-ai/anymcp.git
cd anymcp
pip install -e .
Usage
Command Line Interface
Connect to an SSE-based MCP server:
anymcp connect http://localhost:8000/sse
With authentication:
anymcp connect http://localhost:8000/sse --token YOUR_AUTH_TOKEN
Add custom headers:
anymcp connect http://localhost:8000/sse --header "X-Custom-Header=Value"
Enable debug logging:
anymcp connect http://localhost:8000/sse --debug
Python API
Use AnyMCP in your Python applications:
import asyncio
from anymcp import connect_sse_as_stdio
async def main():
async with connect_sse_as_stdio(
sse_url="http://localhost:8000/sse",
token="YOUR_AUTH_TOKEN",
timeout=5.0,
sse_read_timeout=300.0
) as (reader, writer):
# Now your application can communicate with the MCP server
# through reader and writer streams
pass
if __name__ == "__main__":
asyncio.run(main())
Development
Setup
# Install in development mode
pip install -e ".[dev]"
Running Tests
make test
Code Quality
# Format code
make style
# Check code quality
make quality
Building
# Build package
make pip
# Upload to PyPI
make pip-upload
Docker
# Build Docker image
make docker-buildx
# Build and push Docker image
make docker-buildx-push
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Release files for anymcp 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anymcp-0.0.4.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anymcp-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.5 kB
Release files / anymcp-0.0.4.tar.gz
| Download URL | anymcp-0.0.4.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bfdafe3ca51f996a131b45ba56e47981191a61d038cc287f748f37f1c54871c
|
|
BLAKE2b-256 checksum How to use checksums |
ccf665c8a2d596ed86301763bbb33024b21b7855038f5cabf1580d283b58483f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / anymcp-0.0.4-py3-none-any.whl
| Download URL | anymcp-0.0.4-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e476e03f578fd07c964425a3d08ed1d18d5229a50130f21a25723180e7add1b3
|
|
BLAKE2b-256 checksum How to use checksums |
83d7f9b2924eaccb51f5c8c186b2c45273e7ed3420c56963e283806f8009a1f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|