- Explore MCP Servers
- python-mcp-server-sample
Python Mcp Server Sample
What is Python Mcp Server Sample
python-mcp-server-sample is a sample Python project designed to create and run an MCP Server, demonstrating the use of the MCP SDK.
Use cases
Use cases for python-mcp-server-sample include building a simple calculator server, creating a data processing server for educational purposes, or developing a custom API server for specific applications.
How to use
To use python-mcp-server-sample, first install uv using the provided curl command. Then, create a new Python project with ‘uv init mcp-server-demo’. After that, navigate to the project directory and install the MCP SDK with ‘uv add “mcp[cli]”’. Create a server file named ‘server.py’ and implement your MCP server logic. Finally, register the server in the Cline project MCP file and run it.
Key features
Key features of python-mcp-server-sample include easy setup with uv, the ability to create custom tools for the MCP server, and the option to run the server in different transport modes.
Where to use
python-mcp-server-sample can be used in various fields such as software development, educational projects, and any application requiring a custom server for processing data or executing commands.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Python Mcp Server Sample
python-mcp-server-sample is a sample Python project designed to create and run an MCP Server, demonstrating the use of the MCP SDK.
Use cases
Use cases for python-mcp-server-sample include building a simple calculator server, creating a data processing server for educational purposes, or developing a custom API server for specific applications.
How to use
To use python-mcp-server-sample, first install uv using the provided curl command. Then, create a new Python project with ‘uv init mcp-server-demo’. After that, navigate to the project directory and install the MCP SDK with ‘uv add “mcp[cli]”’. Create a server file named ‘server.py’ and implement your MCP server logic. Finally, register the server in the Cline project MCP file and run it.
Key features
Key features of python-mcp-server-sample include easy setup with uv, the ability to create custom tools for the MCP server, and the option to run the server in different transport modes.
Where to use
python-mcp-server-sample can be used in various fields such as software development, educational projects, and any application requiring a custom server for processing data or executing commands.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
uvのインストール
curl -LsSf https://astral.sh/uv/install.sh | sh
Pythonプロジェクトを作成
# mcp-server-demoというPythonプロジェクトを作成 uv init mcp-server-demo
MCP SDKのインストール
# mcp-server-demoプロジェクト配下に移動 cd mcp-server-demo # mcp-server-demoプロジェクトにmcp sdkをインストール uv add "mcp[cli]"
MCPサーバの構築
server.pyファイルの作成(ファイル名はなんでもよい)
mv main.py server.py
server.pyに以下のように記述
from mcp.server.fastmcp import FastMCP # Create an MCP server with debug enabled mcp = FastMCP("Demo", debug=True) # Add an addition tool @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers""" return a + b # Add this part to run the server if __name__ == "__main__": # stdioトランスポートを使用 print("Starting MCP server in stdio mode") mcp.run(transport="stdio")
ClineへのMCPサーバの登録
ClineのプロジェクトMCPファイルを以下のように編集
{ "mcpServers": { "mcp-demo-server": { "command": "uv", "args": [ "--directory", <path to mcp-server-demo>, "run", "server.py" ], "alwaysAllow": [ "add" ], "disabled": false } } }
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










