MCP 简介;在 MacOS 上向 Keynote 绘制和添加文本
该项目使用模型控制协议 (MCP) 实现了一个数学代理,它可以执行数学计算,并在 macOS 上的 Keynote 中以可视化的方式呈现结果。该代理可以绘制形状并在 Keynote 幻灯片中添加文本,非常适合用于创建数学演示文稿。
特征
- 数学运算(加法、减法、乘法、除法等)
- 高级数学函数(阶乘、对数、三角函数)
- ASCII 值计算和指数和运算
- Keynote 中的视觉呈现:
- 绘制矩形
- 向幻灯片添加文本
- 自动幻灯片管理
先决条件
- Python 3.x
- macOS(用于 Keynote 集成)
- 您的系统上已安装 Keynote
- Google Gemini API 密钥
安装
- 克隆存储库:
- 安装所需的依赖项:
- 在项目根目录中创建一个
.env
文件并添加您的 Gemini API 密钥:
项目结构
mcp-server.py
:包含带有数学工具和 Keynote 集成的服务器实现mcp-client.py
:实现与 LLM 通信并管理工作流的客户端requirements.txt
:列出所有 Python 依赖项
用法
客户端脚本 ( mcp-client.py
) 会自动处理 MCP 服务器的启动和通信。您只需运行以下命令:
例如:
如果没有提供查询,脚本将使用上面示例中提到的默认查询。
客户将:
- 在后台自动启动 MCP 服务器
- 打开 Keynote 并创建新文档
- 执行请求的数学运算
- 在幻灯片上绘制一个矩形
- 将结果作为文本添加到矩形内
注意:MCP 服务器由客户端脚本内部管理,因此您无需手动启动它。服务器负责处理所有数学运算和 Keynote 交互,而客户端则负责管理与语言模型的通信并协调整体工作流程。
可用的数学工具
- 基本操作:
- 加法(
add
) - 减法(
subtract
) - 乘法(
multiply
) - 除法(
divide
) - 功率(
power
) - 平方根(
sqrt
) - 立方根 (
cbrt
)
- 加法(
- 高级操作:
- 阶乘(
factorial
) - 自然对数(
log
) - 余数(
remainder
) - 三角函数(
sin
、cos
、tan
) - 斐波那契数列(
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 请求。
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
使用模型控制协议实现数学代理,执行数学计算并在 Keynote 中以可视化方式呈现结果,从而能够绘制形状并向幻灯片添加文本。
Related MCP Servers
- AsecurityAlicenseAqualityFacilitates the creation of mathematical diagrams using natural language through Penrose's domain-specific languages, allowing for the definition of mathematical types, relationships, and visual representation rules.Last updated -41JavaScriptMIT License
- -securityFlicense-qualityEnables programmatic creation of Whimsical diagrams from Mermaid markup generated by AI models like Claude through the Model Context Protocol.Last updated -7TypeScript
- AsecurityFlicenseAqualityEnables users to control the cursor in Figma through verbal commands using an agentic AI agent, streamlining the design process with a new interaction method.Last updated -192,5141JavaScript
- -securityFlicense-qualityA Model Context Protocol server that enables AI models to create and manipulate PowerPoint presentations with advanced features like financial charts, formatting, and template management.Last updated -1Python