Token导航 LogoToken导航

MCP Server · AI代理

Reference MCP Server

一个基于FastMCP的极简HTTP MCP服务器参考实现,展示如何用现代Python工具快速构建MCP服务器。

stdio官方级别未说明来源级核验工具 3
微服务PythonClaudeHTTP服务器Claude Desktop

快速开始

作者 / 组织
jefferyharrell
提供方
jefferyharrell

工具数量

3

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

0

仓库热度

收录来源

1 个

MCP World

选型结论

Reference MCP Server 属于AI代理类 MCP Server,公开资料标注 3 个工具,通过stdio 本地进程接入,适配 Claude Desktop、Claude,有可以直接复制的安装命令;接入前先确认权限范围。

分类

AI代理

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

pip install -e .

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 对应的运行时,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 3 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

参考MCP服务器

使用FastMCP的远程HTTP MCP服务器的干净、最少的参考实现。这个项目展示了使用现代Python工具构建MCP服务器是多么简单。

ˇ突破

整个MCP服务器基本上是 10行代码:

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("Reference Server", stateless_http=True)

@mcp.tool()
def hello_world(message: str) -> str:
    """Say hello to the world"""
    return f"Hello, {message}!"

if __name__ == "__main__":
    mcp.run(transport="streamable-http")

That's it! FastMCP handles HTTP server setup, MCP protocol implementation, routing, error handlingeverything.

=€ Quick Start

Prerequisites

  • Python 3.11+
  • uv (recommended) or pip

Installation

# Clone or create the project
git clone 
cd reference-mcp-server

# Install dependencies with uv (recommended)
uv sync

# Or with pip
pip install -e .

Running the Server

# Default: streamable-http transport on localhost:8000
uv run python -m reference_mcp.server

# Or use the installed script
uv run reference-mcp-server

# Use SSE transport instead
MCP_TRANSPORT=sse uv run reference-mcp-server

=运输方式

此参考服务器支持以下两种MCP传输类型:

流式HTTP(默认)

  • 现代化、高效的交通
  • 新实现的默认选项
  • 在流媒体中使用HTTP/1.1
  • 更好的性能和可靠性
# Explicit streamable-http
MCP_TRANSPORT=streamable-http uv run reference-mcp-server

服务器发送事件(SSE)

  • 回退传输以实现兼容性
  • 对服务器发送的事件使用HTTP
  • 更广泛的客户支持
# Use SSE transport
MCP_TRANSPORT=sse uv run reference-mcp-server

='配置

服务器使用环境变量进行配置:

变量默认值描述
MCP_TRANSPORTstreamable-http运输类型: sse 或 streamable-http
MCP_HOSTlocalhost服务器主机(用于文档)
MCP_PORT8000服务器端口(用于文档)

创建一个 .env 示例中的文件:

cp .env.example .env
# Edit .env with your preferences

=集成示例

克劳德桌面

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "reference-server": {
      "command": "uv",
      "args": [
        "run", 
        "--directory", 
        "/path/to/reference-mcp-server", 
        "reference-mcp-server"
      ]
    }
  }
}

使用mcp远程适配器

真正的功能来自mcp远程适配器,它处理兼容性:

{
  "mcpServers": {
    "reference-server": {
      "command": "mcp-remote",
      "args": ["http://localhost:8000"]
    }
  }
}

码头工人

FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install uv && uv sync
EXPOSE 8000
CMD ["uv", "run", "reference-mcp-server"]

="开发

项目结构

reference-mcp-server/
�� pyproject.toml           # Modern Python packaging
�� README.md                # This file
�� .env.example             # Environment template
�� src/
   �� reference_mcp/
       �� __init__.py
       �� server.py        # Main server (the magic 10 lines!)
       �� config.py        # Configuration handling
�� examples/
    �� configuration/       # Integration examples

添加新工具

只需添加更多 @mcp.tool() 装饰功能:

@mcp.tool()
def greet_user(name: str, greeting: str = "Hello") -> str:
    """Greet a user with a custom greeting"""
    return f"{greeting}, {name}! Welcome to our MCP server!"

@mcp.tool()
def calculate_sum(numbers: list[int]) -> int:
    """Calculate the sum of a list of numbers"""
    return sum(numbers)

FastMCP自动处理:

  • 使用Pydantic进行类型验证
  • 用于工具发现的JSON模式生成
  • 错误处理和响应
  • HTTP路由和MCP协议

运行测试

# Start the server
uv run reference-mcp-server &

# Test the hello_world tool (example with curl)
curl -X POST http://localhost:8000/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool": "hello_world", "arguments": {"message": "World"}}'

关键设计决策

为什么选择FastMCP?

  • 零样板:无需手动设置HTTP服务器
  • 完全符合MCP:自动处理协议
  • 类型安全性:内置Pydantic验证
  • 双重运输:SSE和可流式传输的http支持
  • 生产就绪:Uvicorn驱动的HTTP服务器

为什么是无状态HTTP?

  • 简洁:不需要会话管理
  • 可扩展性:易于负载平衡和缩放
  • 可靠性:没有要丢失的连接状态
  • mcp远程兼容性:与适配器完美配合

为什么两种运输方式?

  • 流式HTTP:现代、高效、首选
  • SSE: Fallback for broader compatibility
  • Future-proof: Supports both current and legacy clients

=Ú What This Demonstrates

This reference implementation proves that building MCP servers can be:

  1. Stupidly Simple: 10 lines for a complete server
  2. Well-Architected: Modern tooling, clean structure
  3. Production Ready: Real HTTP server, proper error handling
  4. Highly Compatible: Works with all MCP client implementations

=. Next Steps

Use this as a template for:

  • Custom MCP servers: Add your domain-specific tools
  • Learning MCP: Understand the protocol without complexity
  • Prototyping: Quick proof-of-concepts for new tools
  • Production services: Scale up with additional tools and logic

The revolution is that MCP servers are no longer complex infrastructure projectsthey're just Python functions with decorators.

\<× Architecture Notes

This server leverages:

  • FastMCP: Complete MCP server framework
  • Uvicorn: Production ASGI server
  • Pydantic: Automatic validation and schemas
  • mcp-remote compatibility: Works with adapter out of the box

The combination means you get enterprise-grade MCP servers with toy-project simplicity.

______________________________________________________________________

*Built with d as part of Project Alpha*

工具与能力

工具数量

3

资源数量

0

提示词数量

0

能力标签

MCP协议Python本地部署Python开发HTTP服务器快速原型微服务

支持客户端

Claude DesktopClaude

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

多步任务编排

把拆解、检索、执行串成一条链,模型按步骤调用工具。

长期上下文

把会话、笔记和知识放到外部存储,换个会话还能接着做。

接自有流程

把内部系统和模型连起来,让助手调用已有的工作流。

选择建议

值得选的地方

  • 只提供 3 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Claude Desktop、Claude,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 运行环境,换机器要重新装一遍。
  • 公开摘要偏短,具体能力和限制要回到仓库确认。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在AI代理场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Reference MCP Server

MCP World · 本页

3stdio有1 个2026-05-17
Everything Claude Code

MCP World

0stdio有1 个2026-05-17
Filesystem 560c4363

MCP World

13未说明未标注2 个2026-05-17
Time 7365cb6d

MCP.so

2SSE有2 个2026-05-17
Server Everything (everything)

MCP World

11stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Reference MCP Server 怎么安装?

公开资料给出的安装命令是 pip install -e .,运行环境为 未标注。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Reference MCP Server 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 未标注;保存后完全退出客户端再打开,配置才会生效。

Reference MCP Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Reference MCP Server 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Reference MCP Server 支持哪些客户端?

公开资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP