About Fastmcp Sd Inspector
Fastmcp Sd Inspector is an MCP server in the Content category: fastMCP 2.0 MCP Server for Stable Diffusion image analysis - Tools, Resources & Prompts.
Install
git clone https://github.com/2799662352/fastmcp-sd-inspectorThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Fastmcp Sd Inspector
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
FastMCP 2.0 官方标准最小可行版本
这是一个完全按照 FastMCP 2.0 官方文档 构建的 MCP (Model Context Protocol) 服务器,展示了 FastMCP 的所有核心功能。
🚀 特性
核心功能
- 8个工具 (Tools): 数学计算、文本处理、文件操作、LLM集成等
- 6个资源 (Resources): 配置信息、用户数据、服务器统计、文件内容等
- 4个提示 (Prompts): 数学助手、调试助手、代码审查、系统提示生成器
- Context 集成: 日志记录、进度报告、LLM采样等高级功能
技术特性
- 完全符合 FastMCP 2.0 官方标准
- 异步支持和错误处理
- 类型注解和文档完整
- 支持 Cursor IDE 集成
- 生产级代码质量
📦 安装
前置要求
- Python 3.8+
- pip
安装步骤
- 克隆项目
git clone <repository-url>
cd mcp2d
- 创建虚拟环境
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
- 安装依赖
pip install -r requirements.txt
🎯 使用方法
启动服务器
# 方法1: 使用启动脚本
python run_server.py
# 方法2: 直接运行
python fastmcp_minimal/server.py
# 方法3: 使用 FastMCP CLI
fastmcp-minimal
Cursor IDE 集成
-
配置 MCP 连接
- 打开 Cursor 设置
- 添加 MCP 服务器配置
- 使用提供的配置文件之一:
mcp_config.json(推荐)mcp_config_simple.json(备选)mcp_config_batch.json(Windows批处理)
-
验证连接
- 重启 Cursor
- 检查 MCP 连接状态
- 测试工具和资源访问
🛠️ 功能详解
工具 (Tools)
| 工具名称 | 功能描述 | 示例用法 |
|---|---|---|
add_numbers |
数字相加 | add_numbers(5, 3) → 8 |
multiply_numbers |
数字相乘 | multiply_numbers(4, 7) → 28 |
calculate_circle_area |
计算圆的面积和周长 | calculate_circle_area(5) → {area: 78.54, ...} |
reverse_string |
反转字符串 | reverse_string("hello") → "olleh" |
get_current_time |
获取当前时间 | 返回多种时间格式 |
process_with_context |
Context 演示 | 展示日志记录和进度报告 |
analyze_text_with_llm |
LLM 文本分析 | 情感分析、摘要、关键词提取 |
list_files_in_directory |
列出目录文件 | 文件列表和统计信息 |
资源 (Resources)
| 资源 URI | 功能描述 | 返回内容 |
|---|---|---|
config://app |
应用配置信息 | 完整配置数据 |
config://version |
版本信息 | 当前版本号 |
users://{user_id}/profile |
用户资料 | 指定用户的详细信息 |
users://list |
用户列表 | 所有用户和统计信息 |
stats://server |
服务器统计 | 运行状态和性能指标 |
files://{file_path} |
文件内容 | 文件内容和元数据 |
提示 (Prompts)
| 提示名称 | 功能描述 | 参数 |
|---|---|---|
math_helper |
数学问题求解助手 | problem: 数学问题描述 |
debug_assistant |
编程调试助手 | error_message, context, code |
code_review |
代码审查助手 | code, language, focus |
system_prompt_generator |
系统提示生成器 | task, role, style |
🔧 开发
项目结构
mcp2d/
├── fastmcp_minimal/
│ ├── __init__.py
│ └── server.py # 主服务器文件
├── run_server.py # 启动脚本
├── requirements.txt # 依赖列表
├── pyproject.toml # 项目配置
├── README.md # 项目文档
├── .env.example # 环境变量示例
├── mcp_config.json # Cursor 配置
└── .cursorrules # Cursor 规则
代码质量
项目使用以下工具确保代码质量:
- Black: 代码格式化
- isort: 导入排序
- mypy: 类型检查
- ruff: 代码检查
- pytest: 单元测试
# 运行代码检查
black fastmcp_minimal/
isort fastmcp_minimal/
mypy fastmcp_minimal/
ruff check fastmcp_minimal/
# 运行测试
pytest
📚 官方文档
- FastMCP 官方网站: https://gofastmcp.com
- GitHub 仓库: https://github.com/jlowin/fastmcp
- MCP 协议规范: https://modelcontextprotocol.io
🤝 贡献
欢迎贡献代码!请遵循以下步骤:
- Fork 项目
- 创建功能分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 创建 Pull Request
📄 许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
🆘 故障排除
常见问题
-
Cursor 连接失败
- 检查 Python 路径是否正确
- 确认虚拟环境已激活
- 尝试不同的配置文件
-
依赖安装失败
- 升级 pip:
pip install --upgrade pip - 使用国内镜像:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
- 升级 pip:
-
服务器启动失败
- 检查端口是否被占用
- 确认所有依赖已正确安装
- 查看错误日志获取详细信息
获取帮助
注意: 这个项目完全按照 FastMCP 2.0 官方文档构建,确保与最新版本的兼容性和最佳实践。
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.