Async MCP Transport layer for queue and async based systems
Project description
asyncmcp - Async transport layers for MCP
Overview
A regular MCP Server but working over queues :
Quoting from the official description :
MCP is an open protocol that standardizes how applications provide context to LLMs.
But a lot of this context is not always readily available and takes time for the applications to process - think batch processing APIs, webhooks or queues.
In these cases, the MCP server would have to expose a light-weight polling wrapper in the MCP layer to wait for the tasks to be done.
asyncmcp explores supporting these async transport layer implementations for MCP clients and servers, beyond the officially supported stdio and HTTP Streamable transports.
The whole idea of an MCP server with async transport layer is that it doesn't have to respond immediately to any requests. It can choose to direct them to internal queues for processing and the client doesn't have to stick around for the response.
Current capabilities
Transport layer : sns-sqs
- Server : Transport layer that listens to a queue for MCP requests and writes the responses to a topic
- Client : Transport layer that writes requests to a topic and listens to a queue for responses
Installation and Usage
# Using uv (recommended)
uv add asyncmcp
# Using pip
pip install asyncmcp
Basic server setup
Note : we don't support FastMCP yet. The examples in this repo uses the basic way of creating MCP servers and client
Here’s a basic example of implementing an MCP server which supports sns-sqs as the transport layer:
import boto3
from asyncmcp.sns_sqs.server import sns_sqs_server, SnsSqsTransportConfig
# Configure transport
config = SnsSqsTransportConfig(
sqs_queue_url="https://sqs.region.amazonaws.com/account/service-queue",
sns_topic_arn="arn:aws:sns:region:account:mcp-responses",
sqs_client=boto3.client('sqs'),
sns_client=boto3.client('sns')
) # more configurable params available.
async def main():
async with sns_sqs_server(config) as (read_stream, write_stream):
# Your MCP server logic here
pass
Basic client setup
Here’s a basic example of implementing an MCP client which supports sns-sqs as the transport layer:
import boto3
from asyncmcp.sns_sqs.client import sns_sqs_client
from asyncmcp import SnsSqsTransportConfig
# Configure transport
config = SnsSqsTransportConfig(
sqs_queue_url="https://sqs.region.amazonaws.com/account/client-queue",
sns_topic_arn="arn:aws:sns:region:account:mcp-requests",
sqs_client=boto3.client('sqs'),
sns_client=boto3.client('sns')
) # more configurable params available.
async def main():
async with sns_sqs_client(config) as (read_stream, write_stream):
# Your MCP client logic here
pass
You can check full examples at /examples/website_server.py and /examples/website_client.py.
Read more at /examples/README.md
Limitations
- Message Size: For SQS - message size limits are applicable (256KB standard, 2MB extended)
- Response Handling: Async nature means responses may not be immediate
- Session Context: Storage mechanism handled by server application, not transport
- Ordering: Standard SQS doesn't guarantee message ordering
Testing
Unit Tests
uv run pytest
Contributing
We welcome contributions and discussions about async MCP architectures!
Development Setup
git clone https://github.com/bharatgeleda/asyncmcp.git
cd asyncmcp
uv sync
License
Apache License 2.0 - see LICENSE file for details.
Links
- MCP Specification: https://spec.modelcontextprotocol.io
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncmcp-0.1.1.tar.gz.
File metadata
- Download URL: asyncmcp-0.1.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4af704ae4950395fd04655b73800abab2caf880269cba0bf24da348c7f092e6
|
|
| MD5 |
61971ff91701fd35a9c683d241f88815
|
|
| BLAKE2b-256 |
78dadd590f74f4da17fed89a730a2ff473426bb66d2bd37419ce902033175410
|
File details
Details for the file asyncmcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: asyncmcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9755bc0e351ab9b3636d7c226a57fbfe58bca33e86f9efe7c54a4f28dec628ee
|
|
| MD5 |
12ee21fe3d3a70ffbb3e9b040c86ad7b
|
|
| BLAKE2b-256 |
475256bd657fef4dfcf20f70248cd68733d4e26874086aabcefe5f4e84c23c53
|