MCPServer (FastMCP)
A minimal Model Context Protocol server built with FastMCP that provides basic utility tools including user greetings, number addition, and file listing operations. Includes examples of exposing tools, resources, and prompts for MCP-aware clients.
README
MCPServer (FastMCP) – Ubuntu Setup and GitHub Guide
This repository contains a minimal Model Context Protocol (MCP) server built with FastMCP from the mcp package. It exposes:
- Tools:
greet_user(name),add_numbers(a,b),list_files(directory)inserver.py - Example server with resources and prompts in
main.py(add,greeting://{name}, andgreet_userprompt)
The project is configured with a pyproject.toml that depends on mcp[cli] and includes an optional mcp_settings.json for MCP-aware clients.
Requirements
- Ubuntu (tested on 22.04+)
- Python 3.12+
- Git
Optional:
uvfor faster Python dependency management (you can also usepip)
Quickstart (Ubuntu)
- Install system prerequisites
sudo apt update
sudo apt install -y python3.12 python3.12-venv git
- Create and activate a virtual environment
python3.12 -m venv venv
source venv/bin/activate
3a) Install dependencies with pip
pip install --upgrade pip
pip install "mcp[cli]>=1.25.0"
3b) Or install with uv (optional)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv venv
source venv/bin/activate
uv pip install "mcp[cli]>=1.25.0"
Running the server
You have two entry points. Pick the one that matches your use case.
- Minimal tool server (
server.py)
source venv/bin/activate
python server.py
This exposes tools:
greet_user(name: str) -> stradd_numbers(a: int, b: int) -> intlist_files(directory: str = ".") -> str
- Example server with resources and prompts (
main.py)
source venv/bin/activate
python main.py
This exposes:
- Tool:
add(a: int, b: int) - Resource:
greeting://{name} - Prompt:
greet_user(name: str, style: str = "friendly")
The example runs with transport="streamable-http" (see main.py).
MCP client settings (optional)
If your MCP client supports a settings file (e.g., Windsurf, IDEs), you can point it to your server via mcp_settings.json:
{
"mcpServers": {
"my-mcp-server": {
"command": "/absolute/path/to/your/project/venv/bin/python",
"args": [
"/absolute/path/to/your/project/server.py"
]
}
}
}
Note: In this repo, mcp_settings.json is configured with an absolute path under this user's home directory. You should update the paths to match your machine if you use it locally.
Project layout
server.py– Minimal FastMCP server exposing three toolsmain.py– Demo FastMCP server with a tool, a resource, and a promptpyproject.toml– Project metadata and dependency onmcp[cli]mcp_settings.json– Example MCP client configuration (absolute paths; edit for your machine).gitignore– Ignoresvenv/and build artifacts
Development tips
- Keep your virtual environment out of Git:
.gitignorealready excludes.venvandvenv/. - When moving the project to another machine, recreate the venv and install
mcp[cli]. - If you want to package this repo later, consider adding a proper module and entry points in
pyproject.toml.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。