MCP.so
登录

MCP Server Demo in python

@Perteghella

基本信息

分类

其他

传输方式

stdio

作者

Perteghella

关于 MCP Server Demo in python

Simple implementation of a Model Communication Protocol (MCP) server using Python over the network using sse transport

MCP Server Demo in python 配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "MCP-Server-python": {
      "command": "python3",
      "args": [
        "-m",
        "venv",
        ".venv"
      ]
    }
  }
}

MCP Server Demo in python 工具

工具列表暂未提供

当前收录暂时没有可展示的工具列表,不代表服务没有工具。请查阅项目文档了解支持的能力。

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is MCP Server Demo in python?

The MCP Server Demo in python is a basic demonstration implementation of a Model Communication Protocol (MCP) server using Python. It is designed for testing and development purposes, running by default with uvicorn on port 8000 and supporting both stdio (default) and sse transports for network exposure.

How to use MCP Server Demo in python?

Create and activate a virtual environment, install dependencies from requirements.txt, then start the server with python3 server.py. Verify it is running on port 8000 using curl http://0.0.0.0:8000/sse. To integrate with tools like Cursor or Claude, configure a mcp.json file with transport "sse" and URL "http://localhost:8000/sse".

Key features of MCP Server Demo in python

  • Adds and subtracts numbers via add() and subtract()
  • Provides a greeting endpoint get_greeting()
  • Input validation and type error handling
  • Handles edge cases with large numbers
  • Exposes SSE transport for network access
  • Includes a comprehensive pytest test suite

Use cases of MCP Server Demo in python

  • Testing the basic functionality of an MCP server
  • Demonstrating how to expose an MCP server over a network
  • Integrating with MCP clients like Cursor or Claude
  • Developing and debugging MCP client implementations
  • Learning MCP server setup and configuration

常见问题

1

What transports does the server support?

By default it uses `stdio` transport. To expose it over the network, configure it to use `sse` transport.

2

How do I expose the server over the network?

Set the transport to `sse` (for example, in the `mcp.json` configuration) so the server listens on port 8000 with uvicorn.

3

How can I verify the server is running?

Use `curl http://0.0.0.0:8000/sse` to test the SSE endpoint, or check active connections with `netstat -n | grep 8000`.

4

How do I run the test suite?

After installing dependencies, run `pytest -v` or `pytest --cov=.` for verbose output or coverage report.

5

How do I integrate this server with Cursor or Claude?

Create a `mcp.json` file with an `mcpServers` entry using `"transport": "sse"` and `"url": "http://localhost:8000/sse"`.

评论

其他 分类下的更多 MCP 服务器