mmcp


Namemmcp JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryCreate a low-code, SSE-transport-enabled Model Context Protocol server project from a template, packaged with Docker for easy deployment and orchestration.
upload_time2025-01-14 23:45:39
maintainerRichard Scheiwe
docs_urlNone
authorRichard S.
requires_python>=3.10
licenseMIT
keywords mcp llm automation sse server template low-code microservice api generative-ai ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```bash
>> 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:

```bash
>> 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`:

```python
@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:

```python
from mcp.server import Server

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

## Usage

To run the project, use the following command:

```bash
>> 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`:

```python
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:

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

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

```bash
>> 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](LICENSE) for details.

**NOTE**

This project is based on [create-python-server](https://github.com/modelcontextprotocol/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.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mmcp",
    "maintainer": "Richard Scheiwe",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "rscheiwe.dev@gmail.com",
    "keywords": "mcp, llm, automation, sse, server, template, low-code, microservice, api, generative-ai, ai",
    "author": "Richard S.",
    "author_email": "rscheiwe.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0b/ec/6b890a6d068a6a1fcea0f68aba743fba63cc4dda34e4e3b3360b0c7323bb/mmcp-0.1.0.tar.gz",
    "platform": null,
    "description": "# mMCP\n\n## Motivation\n`mmcp` is inspired by Anthropic's MCP-based `create-python-server` with the following changes:\n\n- Microservices architecture\n- Docker baked-in for immediate deployment\n- CLI tooling for ease-of-use (e.g., `mmcp add tool`)\n- Added support for Poetry\n\nThe 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.\n\n## Quickstart\n\n```bash\n>> pip install mmcp\n>> mmcp create-mmcp --name my-mmcp-server\n>> cd my-mmcp-server\n>> mmcp run server\n```\n\nTo add a tool, use the following command:\n\n```bash\n>> mmcp add tool --name my-tool\n```\n\nRefer to the project structure for more information, where `mmcp add tool` will add a tool to the `tools/` directory.\n\n```\n- MY_MMCP_SERVER/\n  - src/\n    - my_mmcp_server/\n      - prompts/      # Prompt-definition code\n      - resources/    # Resource-definition code\n      - services/     # Service-layer code\n        - __init__.py\n        - prompts.py\n        - resources.py\n        - tools.py\n      - tools/        # Tool-definition code\n        - __init__.py\n        - base.py\n        - my_tool.py  # <-- Added by `mmcp add tool --name my_tool`\n      - __init__.py\n      - app.py\n      - server.py\n  - tests/\n  - .env\n  - docker-compose.yml\n  - Dockerfile        # Docker image definition\n  - pyproject.toml\n  - README.md\n```\n\nThe `services/` layer orchestrates the `mcp`-specific decorators, employed generically via `server.py`:\n\n```python\n@server.list_tools()\nasync def handle_list_tools():\n    return await tool_service.list_tools()\n\n@server.call_tool()\nasync def handle_call_tool(name: str, arguments: dict | None):\n    return await tool_service.execute_tool(name, arguments or {})\n\n```\n\nwhere `@server` is:\n\n```python\nfrom mcp.server import Server\n\n# Create the server instance\nserver = Server(\"my_mmcp_server\")\n```\n\n## Usage\n\nTo run the project, use the following command:\n\n```bash\n>> mmcp run server\n```\n\nwhich launches the server via `poetry run python -m my_server.server`.\n\nA common pattern to route calls to the server via an endpoint. \n\nSuppose your server is running on `http://127.0.0.1:8080/sse`:\n\n```python\nfrom mcp.client.session import ClientSession\nfrom mcp.client.sse import sse_client\n# ...fastapi setup\n# ...\n\n\n@router.get(\"/mcp-list-tools\")\nasync def mcp_list_tools():\n    async with sse_client(url=\"http://127.0.0.1:8080/sse\") as (read, write):\n        async with ClientSession(read, write) as session:\n            await session.initialize()\n\n            tools = await session.list_tools()\n\n            return tools\n\n\n@router.post(\"/mcp-call-tool\")\nasync def mcp_call_tool(tool_name: str, parameters: Dict[str, Any]):\n    async with sse_client(url=\"http://127.0.0.1:8080/sse\") as (read, write):\n        async with ClientSession(read, write) as session:\n            await session.initialize()\n\n            # # Call the fetch tool\n            # result = await session.call_tool(\"fetch\", {\"url\": \"https://example.com\"})\n            result = await session.call_tool(tool_name, parameters)\n\n            return result\n```\n\n\nAdditionally, 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.\n\n**Note:** More extensive documentation and usage is on the way.\n\n## Development\n\nTo run the project, use the following command:\n\n```bash\n>> poetry install --no-cache\n>> poetry shell\n>> poetry run mmcp create-mmcp --name my_project\n```\n\nTo build and run the project, use the following command:\n\n```bash\n>> cd path/to/your/mmcp\n>> python -m build\n>> pip install \"path/.../dist/mmcp-0.1.0.whl\"\n```\n\n## License\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n**NOTE**\n\nThis project is based on [create-python-server](https://github.com/modelcontextprotocol/create-python-server) by Anthropic, PBC.\n\nThis project is not affiliated with Anthropic, PBC., and does not reflect my views or opinions on the strengths or weaknesses of Anthropic's MCP.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Create a low-code, SSE-transport-enabled Model Context Protocol server project from a template, packaged with Docker for easy deployment and orchestration.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/rscheiwe/mmcp",
        "Repository": "https://github.com/rscheiwe/mmcp"
    },
    "split_keywords": [
        "mcp",
        " llm",
        " automation",
        " sse",
        " server",
        " template",
        " low-code",
        " microservice",
        " api",
        " generative-ai",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "582415238abb146468e4344d34591165116d8db7db7e2b02784c7e83963b8cb3",
                "md5": "b8484abfb21ee141db1b7c6257165632",
                "sha256": "3493d8816eba32cc28cbaacd4be7a3f91cb3178c466c9e3bb44d38538eb98751"
            },
            "downloads": -1,
            "filename": "mmcp-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8484abfb21ee141db1b7c6257165632",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 17623,
            "upload_time": "2025-01-14T23:45:37",
            "upload_time_iso_8601": "2025-01-14T23:45:37.674540Z",
            "url": "https://files.pythonhosted.org/packages/58/24/15238abb146468e4344d34591165116d8db7db7e2b02784c7e83963b8cb3/mmcp-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bec6b890a6d068a6a1fcea0f68aba743fba63cc4dda34e4e3b3360b0c7323bb",
                "md5": "c6649889b2dd43ebbd77d648e059eeb9",
                "sha256": "495679c34080f2c8f7a024c6df559cb2f7795aa5f4adff1cfda80c5fe35a5bb2"
            },
            "downloads": -1,
            "filename": "mmcp-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c6649889b2dd43ebbd77d648e059eeb9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 14737,
            "upload_time": "2025-01-14T23:45:39",
            "upload_time_iso_8601": "2025-01-14T23:45:39.095398Z",
            "url": "https://files.pythonhosted.org/packages/0b/ec/6b890a6d068a6a1fcea0f68aba743fba63cc4dda34e4e3b3360b0c7323bb/mmcp-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-14 23:45:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rscheiwe",
    "github_project": "mmcp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mmcp"
}
        
Elapsed time: 0.60296s