Skip to main content

MCP feet Master 🐰🐔

Python 3.8+ MIT License PyPI version

一個專門計算動物腳數的 Model Context Protocol (MCP) 伺服器。解決經典的「兔子和雞」數學問題,讓 AI 模型能夠準確計算農場動物的總腳數。

✨ 功能特色

  • 🧮 精確計算:計算兔子(4腳)和雞(2腳)的總腳數
  • 🔄 反推功能:根據總腳數推算可能的動物組合
  • 📚 範例資源:內建計算範例和使用說明
  • 📝 提示模板:生成標準化的數學問題
  • 🔧 FastMCP:基於 FastMCP 框架,易於整合

🚀 安裝

使用 pip 安裝

pip install mcp-feet-master

從源碼安裝

git clone https://github.com/yourusername/mcp-feet-master.git
cd mcp-feet-master
pip install -e .

📖 使用方法

作為 MCP 伺服器運行

mcp-feet-master

或者在 Python 中:

from mcp_feet_master import create_server

server = create_server()
server.run()

與 Claude Desktop 整合

在 Claude Desktop 的配置文件中添加:

{
  "mcpServers": {
    "mcp-feet-master": {
      "command": "mcp-feet-master",
      "args": []
    }
  }
}

🛠️ 可用工具

1. get_foot_num(rabbits, chickens)

計算兔子和雞的總腳數。

參數:

  • rabbits (int): 兔子數量
  • chickens (int): 雞的數量

返回:

{
    "total_feet": 22,
    "rabbit_feet": 12,
    "chicken_feet": 10,
    "rabbits": 3,
    "chickens": 5,
    "calculation": "3 隻兔子 × 4 腳 + 5 隻雞 × 2 腳 = 22 隻腳",
    "formula": "3 × 4 + 5 × 2 = 22"
}

2. calculate_animals_from_feet(total_feet, animal_type)

根據總腳數反推動物組合。

參數:

  • total_feet (int): 總腳數
  • animal_type (str): "rabbits", "chickens", 或 "mixed"

範例:

# 混合動物組合
{
    "total_feet": 20,
    "possible_combinations": [
        {"rabbits": 5, "chickens": 0, "verification": 20},
        {"rabbits": 3, "chickens": 4, "verification": 20},
        {"rabbits": 1, "chickens": 8, "verification": 20},
        {"rabbits": 0, "chickens": 10, "verification": 20}
    ],
    "count": 4
}

📚 可用資源

feet://examples

獲取使用範例和計算說明。

📝 可用提示

animal_feet_problem

生成標準化的動物腳數數學問題。

參數:

  • rabbits (int): 兔子數量
  • chickens (int): 雞的數量
  • include_explanation (bool): 是否包含解釋(預設:true)

💡 使用範例

與 AI 模型對話範例

用戶: "農場裡有 3 隻兔子和 5 隻雞,總共有多少隻腳?"

AI 模型使用 MCP:

調用 get_foot_num(3, 5)
結果:22 隻腳 (3 × 4 + 5 × 2 = 12 + 10 = 22)

用戶: "如果總共有 20 隻腳,可能的動物組合有哪些?"

AI 模型使用 MCP:

調用 calculate_animals_from_feet(20, "mixed")
可能組合:
- 5 隻兔子 + 0 隻雞
- 3 隻兔子 + 4 隻雞  
- 1 隻兔子 + 8 隻雞
- 0 隻兔子 + 10 隻雞

🧪 開發

安裝開發依賴

pip install -e ".[dev]"

運行測試

pytest tests/

程式碼格式化

black src/ tests/
isort src/ tests/

型別檢查

mypy src/

📈 版本歷史

  • 0.1.0: 初始版本
    • 基本的兔子雞腳數計算功能
    • 反推動物組合功能
    • FastMCP 整合

🤝 貢獻

歡迎貢獻!請查看 CONTRIBUTING.md 了解詳細說明。

  1. Fork 專案
  2. 創建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 開啟 Pull Request

📄 授權

本專案使用 MIT 授權。詳見 LICENSE 文件。

🔗 相關連結

📞 支援

如果遇到問題或有建議,請:


讓 AI 計算動物腳數變得簡單又準確! 🎯

Metadata

Release files for mcp-feet-master 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-feet-master 0.1.12
File Size Uploaded Provenance
mcp_feet_master-0.1.12.tar.gz 17.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-feet-master 0.1.12
File Interpreter ABI Platform
mcp_feet_master-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / mcp_feet_master-0.1.12.tar.gz

Download URL mcp_feet_master-0.1.12.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3f539d9d311cfbdc77cfc4b664cd1bd4f53d2450e13119a910d8131772544de6
BLAKE2b-256 checksum
How to use checksums
7057040642c2ae4aebb6bbc780b290f244a9ee35450c47f1a3d319e9fa5ef6a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / mcp_feet_master-0.1.12-py3-none-any.whl

Download URL mcp_feet_master-0.1.12-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4a664ab318f09d3983fbeb2183a5478c4dbc74f7c8f7666af78148c14c42585
BLAKE2b-256 checksum
How to use checksums
e9a73fcd1fdd7b44fed96168821a427fba67abe97587c779d09ac710a55b9f81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for mcp-feet-master 0.1.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page