Token导航 LogoToken导航TokenDH.com
Template MCP Server In Python Fastmcp logo
运维云端stdio官方级别未说明来源级核验

Template MCP Server In Python Fastmcp

MCP Server

一个基于FastMCP构建的模型上下文协议服务器,提供问候功能,支持多种部署方式。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
CI/CDDockerFastMCPPython

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

cgjdparashar

提供方

cgjdparashar

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install fastmcp-greet-server

详细介绍

FastMCP 欢迎服务器

](https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp/actions/workflows/github-deploy.yml) ![Deploy on Railway](https://railway.app/template/9aI3kR) ![Deploy to Render](https://render.com/deploy?repo=https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp)

一个使用FastMCP构建的模型上下文协议(MCP)服务器,提供问候功能。

🚀 快速部署

一键部署:

您已部署的服务器将在以下地址可用:

ghcr.io/cgjdparashar/template-mcp-server-in-python-fastmcp:latest  # GitHub Container Registry
https://your-app-name.up.railway.app                               # Railway
https://your-app-name.onrender.com                                 # Render

特点/功能

  • 一个简单的问候工具,接收名字并返回个性化的问候语
  • 采用FastMCP构建,便于与MCP客户端集成
  • 支持流式传输和SSE传输模式
  • Docker支持,便于部署
  • 全面的CI/CD(持续集成/持续交付)流水线
  • 用于监控的健康检查端点
  • 可投入生产的配置

安装

从 PyPI(发布时)

pip install fastmcp-greet-server

来自源(或“来源”)

git clone https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp.git
cd template-mcp-server-in-python-fastmcp
uv sync

用法

运行服务器

# Using uv
uv run python greet.py

# Or if installed via pip
python greet.py

服务器将在 http://127.0.0.1:8002 默认情况下。

与MCP客户端配合使用

服务器提供以下工具:

  • greet(name: str) -> str根据给定的名字返回个性化的问候语
  • health() -> str用于监控的健康检查端点

测试已部署的服务器

一旦部署完成,您就可以测试您的服务器:

# Test the greet tool
curl -X POST "https://your-deployed-url/mcp" \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/call", "params": {"name": "greet", "arguments": {"name": "World"}}}'

# Test health check
curl "https://your-deployed-url/health"

Docker 部署

# Build and run with Docker Compose
docker-compose up -d

# Or build and run manually
docker build -t fastmcp-greet .
docker run -p 8002:8002 fastmcp-greet

配置

服务器可以通过环境变量进行配置:

  • HOST绑定地址(默认: 127.0.0.1,使用 0.0.0.0 (用于云部署)
  • PORT端口号(默认: 8002)
  • TRANSPORT传输模式(sse 或者 streamable-http,默认: sse)

发展

设置开发环境

# Clone the repository
git clone https://github.com/cgjdparashar/template-mcp-server-in-python-fastmcp.git
cd template-mcp-server-in-python-fastmcp

# Install with development dependencies
uv sync --all-extras

运行测试

uv run pytest

代码质量

# Linting
uv run ruff check .

# Formatting
uv run ruff format .

# Type checking
uv run mypy .

部署选项

1. 一键部署(推荐)

  • 铁路 - 适合初学者,自动HTTPS
  • 渲染 - 提供免费层级

2. GitHub 容器注册表

该项目包含了GitHub Actions,用于在发布时自动构建并推送Docker镜像到GitHub容器注册表。

docker pull ghcr.io/cgjdparashar/template-mcp-server-in-python-fastmcp:latest

3. 手动云部署

铁路(手册)

  1. 访问 railway.app(可译为“铁路应用”或保持原样作为专有名词)
  2. 连接您的GitHub账户
  3. 从此仓库部署

渲染(手动)

  1. 访问 render.com(注:在中文语境中,网址通常直接保留原样,不进行翻译,因此“render.com”直接作为网址使用,无需翻译。)
  2. 创建一个新的Web服务
  3. 连接这个GitHub仓库

Heroku

heroku create your-app-name
heroku container:push web
heroku container:release web

Fly.io

flyctl launch
flyctl deploy

4. 自托管

使用提供的 docker-compose.yml 用于生产环境部署,配合nginx反向代理。

API 文档

当服务器运行时,它会暴露MCP协议端点。您可以使用任何MCP客户端或提供的测试客户端来测试问候工具。

示例用法

from greetclient import test_greet_tool

# Test the greeting tool
result = test_greet_tool("Alice")
print(result)  # Output: Hello, Alice!

MCP客户端配置

在您的MCP客户端配置中添加以下内容:

{
  "servers": {
    "fastmcp-greet": {
      "type": "http",
      "url": "https://your-deployed-url",
      "transport": "sse"
    }
  }
}

贡献

  1. 为仓库创建分支(或:克隆仓库)
  2. 创建一个特性分支: git checkout -b feature-name
  3. 进行你的更改并添加测试
  4. 运行测试套件: uv run pytest
  5. 提交拉取请求

许可证

这个项目采用MIT许可证授权——详见 许可证 文件中有详细信息。

致谢

支持

______________________________________________________________________

🌟 如果你觉得这个仓库有帮助,请给它加星标!# 最后部署时间:2025年10月10日 20:22:40

目录标签

目录标签

CI/CDDockerFastMCPPython问候工具本地部署MCP服务器Docker部署

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

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

来源信息

继续浏览同类 MCP