Claude工具扩展

通过MCP协议为Claude提供基于Python的强大工具扩展,包括计算器、天气预报、时间查询等功能,支持桌面应用和IDE集成。

  • by webdevtodayjason
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 webdevtodayjason/slim-mcp

使用说明

Slim MCP:Claude Tools🤖

🚀 通过MCP协议为Claude提供强大的基于Python的工具

✨ 特性

  • 🧮 计算器:执行复杂的数学计算
  • 🌦️ 天气:获取当前天气预报和警报
  • 🕒 日期时间:以本地和UTC格式访问当前时间
  • 🔌 可扩展:使用简单的Python函数轻松添加自定义工具
  • 💻 桌面集成:与Claude Desktop应用程序无缝集成
  • 🖱️ 光标IDE:为开发人员提供与Cursor IDE的原生集成

📋 目录

🚀 安装

先决条件

  • Python 3.11+
  • 康达(推荐)

使用Conda进行设置(推荐)

# Create conda environment with Python 3.11
conda create -n mcp-tools python=3.11

# Activate environment
conda activate mcp-tools

# Clone the repository
git clone https://github.com/webdevtodayjason/slim-MCP.git
cd slim-MCP

# Install with uv (preferred)
uv pip install -e .

# OR install with standard pip
pip install -e .

🎮 用法

配置Claude

将以下内容添加到您的Claude配置文件中:

{
    "mcpServers": {
        "claude-tools": {
            "command": "/path/to/conda/envs/mcp-tools/bin/python",
            "args": ["-m", "claude_tools.main"]
        }
    }
}

配置游标IDE

NAME: claude-tools
TYPE: command
COMMAND: /path/to/conda/envs/mcp-tools/bin/python -m claude_tools.main

示例提示

Can you calculate 25^3 + sqrt(196)?

What's the current time in UTC?

What's the weather like in Austin, TX?

🔌 集成

  • 克劳德AI桌面:通过MCP协议进行初步集成
  • 光标IDE:开发工作流程的直接集成
  • 克劳德·韦伯:通过配置与Claude Web兼容

💻 发展

项目结构

slim-MCP/
├── src/
│   └── claude_tools/
│       ├── __init__.py
│       ├── calculator.py     # Math calculation tool
│       ├── datetime_tool.py  # Date and time utilities
│       ├── main.py           # Entry point
│       └── weather.py        # Weather forecasting tool
├── http_server.py            # HTTP server for MCP
├── pyproject.toml            # Project configuration
├── .gitignore                # Git ignore file
└── LICENSE                   # MIT License

创建新工具

  1. 在中创建一个新的Python文件 src/claude_tools/:
# src/claude_tools/my_tool.py
def my_awesome_function(param: str) -> str:
    """Description of what this tool does.
    
    Args:
        param: Description of the parameter
        
    Returns:
        A string with the result
    """
    result = f"Processed: {param}"
    return result
    
def register_my_tools(mcp):
    """Register all my tools with the MCP server."""
    mcp.tool()(my_awesome_function)
  1. 在中导入并注册您的工具 __init__.py:
# In src/claude_tools/__init__.py
from .calculator import register_calculator_tools
from .datetime_tool import register_datetime_tools
from .weather import register_weather_tools
from .my_tool import register_my_tools  # Add this line

def register_all_tools(mcp):
    register_calculator_tools(mcp)
    register_datetime_tools(mcp)
    register_weather_tools(mcp)
    register_my_tools(mcp)  # Add this line
  1. 重新启动服务器,您的新工具就可以使用了!

👥 贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。


Made with ❤️ by Jason Brashear