Skip to main content

mMCP

Motivation

mmcp is inspired by Anthropic's MCP-based create-python-server with the following changes:

  • Microservices architecture
  • Docker baked-in for immediate deployment
  • CLI tooling for ease-of-use (e.g., mmcp add tool)
  • Added support for Poetry

The purpose of this project is to provide a more streamlined and user-friendly experience for creating SSE-specific MCP servers, foregrounding deployment options in order to make it easier to get started with MCP. In sum, it began and ended as a means to satisfy my own needs from the MCP.

Quickstart

>> pip install mmcp
>> mmcp create-mmcp --name my-mmcp-server
>> cd my-mmcp-server
>> mmcp run server

To add a tool, use the following command:

>> mmcp add tool --name my-tool

Refer to the project structure for more information, where mmcp add tool will add a tool to the tools/ directory.

- MY_MMCP_SERVER/
  - src/
    - my_mmcp_server/
      - prompts/      # Prompt-definition code
      - resources/    # Resource-definition code
      - services/     # Service-layer code
        - __init__.py
        - prompts.py
        - resources.py
        - tools.py
      - tools/        # Tool-definition code
        - __init__.py
        - base.py
        - my_tool.py  # <-- Added by `mmcp add tool --name my_tool`
      - __init__.py
      - app.py
      - server.py
  - tests/
  - .env
  - docker-compose.yml
  - Dockerfile        # Docker image definition
  - pyproject.toml
  - README.md

The services/ layer orchestrates the mcp-specific decorators, employed generically via server.py:

@server.list_tools()
async def handle_list_tools():
    return await tool_service.list_tools()

@server.call_tool()
async def handle_call_tool(name: str, arguments: dict | None):
    return await tool_service.execute_tool(name, arguments or {})

where @server is:

from mcp.server import Server

# Create the server instance
server = Server("my_mmcp_server")

Usage

To run the project, use the following command:

>> mmcp run server

which launches the server via poetry run python -m my_server.server.

A common pattern to route calls to the server via an endpoint.

Suppose your server is running on http://127.0.0.1:8080/sse:

from mcp.client.session import ClientSession
from mcp.client.sse import sse_client
# ...fastapi setup
# ...


@router.get("/mcp-list-tools")
async def mcp_list_tools():
    async with sse_client(url="http://127.0.0.1:8080/sse") as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            tools = await session.list_tools()

            return tools


@router.post("/mcp-call-tool")
async def mcp_call_tool(tool_name: str, parameters: Dict[str, Any]):
    async with sse_client(url="http://127.0.0.1:8080/sse") as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # # Call the fetch tool
            # result = await session.call_tool("fetch", {"url": "https://example.com"})
            result = await session.call_tool(tool_name, parameters)

            return result

Additionally, the tests/test_mcp_list_tools.py file can be run to test the list_tools method, for a sanity check. Just make sure the server is running.

Note: More extensive documentation and usage is on the way.

Development

To run the project, use the following command:

>> poetry install --no-cache
>> poetry shell
>> poetry run mmcp create-mmcp --name my_project

To build and run the project, use the following command:

>> cd path/to/your/mmcp
>> python -m build
>> pip install "path/.../dist/mmcp-0.1.0.whl"

License

This project is licensed under the MIT License. See LICENSE for details.

NOTE

This project is based on create-python-server by Anthropic, PBC.

This project is not affiliated with Anthropic, PBC., and does not reflect my views or opinions on the strengths or weaknesses of Anthropic's MCP.

Metadata

Release files for mmcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmcp 0.1.0
File Size Uploaded
mmcp-0.1.0.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mmcp 0.1.0
File Interpreter ABI Platform
mmcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.4 kB

Release files / mmcp-0.1.0.tar.gz

Download URL mmcp-0.1.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
495679c34080f2c8f7a024c6df559cb2f7795aa5f4adff1cfda80c5fe35a5bb2
BLAKE2b-256 checksum
How to use checksums
0bec6b890a6d068a6a1fcea0f68aba743fba63cc4dda34e4e3b3360b0c7323bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / mmcp-0.1.0-py3-none-any.whl

Download URL mmcp-0.1.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3493d8816eba32cc28cbaacd4be7a3f91cb3178c466c9e3bb44d38538eb98751
BLAKE2b-256 checksum
How to use checksums
582415238abb146468e4344d34591165116d8db7db7e2b02784c7e83963b8cb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page