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-serverVerified import paths — ran on the pinned version, not inferred.
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.
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.
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>`.