Registry / aws / awslabs-core-mcp-server

awslabs-core-mcp-server

JSON →
library1.0.27pypypiunverified

The `awslabs-core-mcp-server` library provides a Python implementation of an AWS Labs Model Context Protocol (MCP) server. It allows for the creation of in-memory MCP servers, facilitating communication and context management for models over WebSockets. The current version is 1.0.27, and releases appear to be driven by the needs of the broader MCP project rather than a fixed schedule.

pip install awslabs-core-mcp-server
INSTALL
IMPORT
SIG · AWSLABS-CORE-MCP-S
A
awslabs-core-mcp-server
awspythonv1.0.27
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InMemoryModelContextProtocolServer
from awslabs_core_mcp_server.model_context_protocol import InMemoryModelContextProtocolServer

This quickstart demonstrates how to instantiate and run an in-memory Model Context Protocol (MCP) server using `asyncio` and `websockets`. The server will listen for WebSocket connections and handle MCP requests. The `initial_data` argument is optional and can be used to pre-populate the server's context.

import asyncio import websockets from awslabs_core_mcp_server.model_context_protocol import InMemoryModelContextProtocolServer async def run_server(): # Example initial data (can be empty or loaded from a file) initial_data = { "context_id_1": {"model_id": "model_A", "context": {"key": "value"}} } # Initialize the in-memory MCP server with optional initial data server_instance = InMemoryModelContextProtocolServer(initial_data=initial_data) # Start the WebSocket server port = 8080 host = "localhost" print(f"Starting MCP server on ws://{host}:{port}") async with websockets.serve(server_instance.handle_request, host, port): await asyncio.Future() # Run forever if __name__ == "__main__": try: asyncio.run(run_server()) except KeyboardInterrupt: print("\nServer stopped gracefully.")
Debug
Known issues
gotchaThe server heavily relies on Python's `asyncio` library. Users unfamiliar with asynchronous programming in Python might face challenges with correctly integrating, starting, and gracefully shutting down the server within their applications.
fix
Ensure a proper `asyncio` event loop is running and managed. Use `asyncio.run()` for simple scripts, and handle `KeyboardInterrupt` for graceful shutdown. For complex applications, integrate the server within an existing event loop.
affects: All versions
gotchaBy default, the quickstart and CLI examples often use a common port (e.g., 8080). This can lead to port contention if another application is already using that port, preventing the MCP server from starting.
fix
Always specify a port that is known to be free for your environment. In programmatic setup, change the `port` variable. If using the CLI, provide `--port <new_port>`.
affects: All versions
Upgrade
Version history
1.0.27latest on PyPI · released Mar 27, 2026
Audit
Dependencies
websocketsrequiredRequired for the underlying WebSocket server implementation.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
2
Resources
awslabs-core-mcp-server — pip install awslabs-core-mcp-server · libregistry