Math MCP Server for MacOS

Integrations

  • Allows integration with Apple Keynote for creating presentations, opening new documents, drawing shapes, and adding text to slides automatically.

  • Integrates with Google Gemini API for processing mathematical queries and generating responses that can be visualized in Keynote presentations.

  • Enables interaction with macOS applications specifically for creating visual presentations in Keynote, including drawing rectangles and adding text to slides.

MCP 简介;在 MacOS 上向 Keynote 绘制和添加文本

该项目使用模型控制协议 (MCP) 实现了一个数学代理,它可以执行数学计算,并在 macOS 上的 Keynote 中以可视化的方式呈现结果。该代理可以绘制形状并在 Keynote 幻灯片中添加文本,非常适合用于创建数学演示文稿。

特征

  • 数学运算(加法、减法、乘法、除法等)
  • 高级数学函数(阶乘、对数、三角函数)
  • ASCII 值计算和指数和运算
  • Keynote 中的视觉呈现:
    • 绘制矩形
    • 向幻灯片添加文本
    • 自动幻灯片管理

先决条件

  • Python 3.x
  • macOS(用于 Keynote 集成)
  • 您的系统上已安装 Keynote
  • Google Gemini API 密钥

安装

  1. 克隆存储库:
git clone <your-repository-url> cd keynote-drawing-text
  1. 安装所需的依赖项:
pip install -r requirements.txt
  1. 在项目根目录中创建一个.env文件并添加您的 Gemini API 密钥:
GEMINI_API_KEY=your_api_key_here

项目结构

  • mcp-server.py :包含带有数学工具和 Keynote 集成的服务器实现
  • mcp-client.py :实现与 LLM 通信并管理工作流的客户端
  • requirements.txt :列出所有 Python 依赖项

用法

客户端脚本 ( mcp-client.py ) 会自动处理 MCP 服务器的启动和通信。您只需运行以下命令:

python mcp-client.py "Your mathematical query here"

例如:

python mcp-client.py "Find the ASCII values of characters in INDIA and then return sum of exponentials of those values"

如果没有提供查询,脚本将使用上面示例中提到的默认查询。

客户将:

  1. 在后台自动启动 MCP 服务器
  2. 打开 Keynote 并创建新文档
  3. 执行请求的数学运算
  4. 在幻灯片上绘制一个矩形
  5. 将结果作为文本添加到矩形内

注意:MCP 服务器由客户端脚本内部管理,因此您无需手动启动它。服务器负责处理所有数学运算和 Keynote 交互,而客户端则负责管理与语言模型的通信并协调整体工作流程。

可用的数学工具

  • 基本操作:
    • 加法( add
    • 减法( subtract
    • 乘法( multiply
    • 除法( divide
    • 功率( power
    • 平方根( sqrt
    • 立方根 ( cbrt )
  • 高级操作:
    • 阶乘( factorial
    • 自然对数( log
    • 余数( remainder
    • 三角函数( sincostan
    • 斐波那契数列( fibonacci_numbers
    • ASCII 值计算( strings_to_chars_to_int
    • 指数和( int_list_to_exponential_sum

Keynote 集成

该项目包括用于 Keynote 集成的工具:

  • mac_open_keynote :打开 Keynote 并创建新文档
  • mac_draw_rectangle :在当前幻灯片上绘制一个矩形
  • mac_add_text_in_keynote :向当前幻灯片添加文本

错误处理

该系统包括全面的错误处理:

  • API 通信问题
  • 无效的数学运算
  • Keynote 集成问题
  • LLM 响应的超时处理

工具

  • 框架的模型控制协议(MCP)
  • Google Gemini 用于语言模型
  • Apple Keynote 用于演示平台

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

-
security - not tested
F
license - not found
-
quality - not tested

使用模型控制协议实现数学代理,执行数学计算并在 Keynote 中以可视化方式呈现结果,从而能够绘制形状并向幻灯片添加文本。

  1. Features
    1. Prerequisites
      1. Installation
        1. Project Structure
          1. Usage
            1. Available Mathematical Tools
              1. Keynote Integration
                1. Error Handling
                  1. Tools
                    1. Contributing
                      ID: 6f8ostr2kt