Skip to main content

A feature-rich MCP (Model Context Protocol) Server with 16 utility tools

Project description

MCP Utility Server

PyPI Python License

一个功能丰富、易于扩展的 MCP (Model Context Protocol) 服务器实现,提供16个实用工具。

✨ 特性

  • 🌤️ 天气查询 - 支持多城市天气查询
  • 🔍 网页搜索 - 模拟搜索引擎
  • 🧮 数学计算 - 安全表达式计算
  • 🔄 单位转换 - 长度/重量/温度/字节等
  • 时间获取 - 多时区支持
  • 💬 每日名言 - 励志语录
  • 📝 笔记系统 - 创建和管理笔记
  • 提醒系统 - 设置提醒
  • 🔗 URL处理 - 短链接生成/展开
  • 🔐 密码生成 - 安全随机密码
  • 🎲 随机选择 - 选项随机抽取
  • 📅 倒计时 - 目标日期倒计时

🛠️ 安装

pip install mcp-utility-server

🚀 快速开始

命令行启动

# 标准版 (6个工具)
mcp-server

# Pro版 (11个工具)
mcp-server-pro

# 企业版 (16个工具)
mcp-server-enterprise

Python代码启动

# 标准版
from mcp_utility_server import main
main()

# Pro版
from mcp_utility_server.main_pro import main
main()

# 企业版
from mcp_utility_server.main_enterprise import main
main()

服务默认运行在:

  • 标准版: http://localhost:8000
  • Pro版: http://localhost:8002
  • 企业版: http://localhost:8003

📖 API 使用

健康检查

curl http://localhost:8003/

响应:

{"status": "ok", "service": "MCP Utility Server Enterprise", "version": "3.0.0", "tools": 16}

列出所有工具

curl http://localhost:8003/tools

调用工具

# 天气查询
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"get_weather","arguments":{"city":"北京"}}'

# 数学计算
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"calculate","arguments":{"expr":"100*9.8"}}'

# 单位转换
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"convert_unit","arguments":{"value":1,"from":"kg","to":"lb"}}'

# 创建笔记
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"create_note","arguments":{"title":"My Note","content":"Hello World"}}'

# 添加提醒
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"add_reminder","arguments":{"message":"Meeting at 3pm","time":"15:00"}}'

# 生成密码
curl -X POST http://localhost:8003/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name":"generate_password","arguments":{"length":16}}'

🔧 在 AI 助手中使用

Claude Desktop

创建 ~/.claude/desktop.json:

{
  "mcpServers": {
    "mcp-utility": {
      "command": "python",
      "args": ["-m", "mcp_utility_server.main_enterprise"]
    }
  }
}

Cursor

在设置中添加 MCP Server:

{
  "mcpServers": {
    "mcp-utility": {
      "url": "http://localhost:8003"
    }
  }
}

📦 版本

版本 工具数 端口 命令
v1 6 8000 mcp-server
Pro 11 8002 mcp-server-pro
Enterprise 16 8003 mcp-server-enterprise

🧩 扩展开发

添加新工具非常简单:

def my_new_tool(param: str) -> str:
    """新工具描述"""
    return f"Result: {param}"

# 注册工具
TOOLS["my_new_tool"] = {
    "description": "我的新工具",
    "params": {"param": "参数描述"}
}

# 添加处理逻辑
elif tool_name == "my_new_tool":
    return {"result": [{"type": "text", "text": my_new_tool(args.get("param", ""))}]}

📄 许可证

MIT License

🙏 感谢

⭐ Star

如果对你有帮助,欢迎 star!


GitHub: https://github.com/UnbornPerson/mcp-utility-server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_utility_server-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_utility_server-1.0.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_utility_server-1.0.0.tar.gz.

File metadata

  • Download URL: mcp_utility_server-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mcp_utility_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b257fe69c8eab0879d513d71f2e0a90bdce59fcb2df9d713d93031b5fddaeb1c
MD5 cbbda3421d54d6e95e7d9e9a9b46534b
BLAKE2b-256 0bfb7bf1bd5531e9cf2cf9ff713e9c41127bca75f525934df76e228d1d303a31

See more details on using hashes here.

File details

Details for the file mcp_utility_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_utility_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc5cd6f0996a9f28162b889ce1045e42d188e5e49c39cf63858aa6e2397f1511
MD5 f8ce8296e3203d4a60b99b2bdf7217b1
BLAKE2b-256 2a8888985d67e2da46b39579195f053249c82431443dbce07a5bdae4486d2c8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page