Here we will explore the building of local mcp servers and remote servers
概览
A lightweight, robust, and extensible server built with Python and FastMCP. This project demonstrates how to expose native Python functions as tools directly to AI assistants like Claude Desktop, Cursor, and other MCP-compatible clients. The is an open standard that enables AI models to safely interact with local data sources, APIs, and computation tools. This repository provides a clean starter template using , an intuitive framework for writing MCP servers in Python. It includes: - with automatic schema generation from Python docstrings and type hints. - with uv. - transport for easy integration with desktop and CLI LLM hosts. The server registers the following tools automatically: - : Version 3.10 or higher (>= 3.12 / 3.14 recommended). - (Recommended): Modern, ultra-fast Python package installer and runner (Install uv). Alternatively, standard pip and Python venv work as well. 2.
README
以下为原文 README 节选,完整内容请查看原文。
🚀 FastMCP Demo Server
A lightweight, robust, and extensible Model Context Protocol (MCP) server built with Python and FastMCP. This project demonstrates how to expose native Python functions as tools directly to AI assistants like Claude Desktop, Cursor, and other MCP-compatible clients.
📋 Table of Contents
- Overview
- Architecture
- Available Tools
- Project Structure
- Prerequisites
- Installation & Setup
- Running & Testing
- Connecting to MCP Clients
- Extending the Server
- Troubleshooting
- License
🌟 Overview
The Model Context Protocol (MCP) is an open standard that enables AI models to safely interact with local data sources, APIs, and computation tools.
This repository provides a clean starter template using FastMCP, an intuitive framework for writing MCP servers in Python. It includes:
- Type-safe tools with automatic schema generation from Python docstrings and type hints.
- Fast, modern dependency management with
uv. - Standard input/output (stdio) transport for easy integration with desktop and CLI LLM hosts.
🏛 Architecture
flowchart LR
subgraph Client["AI Client (Host)"]
LLM["Claude Desktop / Cursor / IDE"]
end
subgraph Transport["Communication Layer"]
STDIO["Standard I/O (JSON-RPC)"]
end
subgraph Server["MCP Server (FastMCP)"]
Core["FastMCP Instance\n('My mcp server demo')"]
T1["generate_random_int"]
T2["add_three_numbers"]
end
LLM |Requests & Responses| STDIO
STDIO Core
Core --> T1
Core --> T2
🛠 Available Tools
The server registers the following tools automatically:
| Tool Name | Parameters | Return Type | Description |
|---|
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"mcp-demo-server": {
"command": "uv",
"args": [
"--directory",
"E:\\MCP-demo",
"run",
"python",
"my_server.py"
]
}
}
}