使用说明
Gamma MCP服务器
用于Gamma AI的模型上下文协议(MCP)服务器,提供使用Gamma Public API生成演示文稿、文档和网页的工具和资源。
特性
资源(2)
gamma://folders-列出Gamma工作区中的所有文件夹(频道)gamma://themes-列出所有可用于生成的主题
工具(1)
generate_gamma-使用AI生成Gamma内容,包括自动轮询直到完成
先决条件
- Node.js 18+
- 纱线包装经理
- A Gamma API密钥(在这里买一个)
安装
-
安装依赖项:
yarn install -
配置API密钥:
编辑
src/gamma-api.service.ts并替换占位符API密钥:const GAMMA_API_KEY = 'sk-gamma-your-api-key-here';替换
'sk-gamma-your-api-key-here'使用您的实际Gamma API密钥。 -
构建项目:
yarn build
运行服务器
开发模式(自动重新加载):
yarn dev
生产方式:
yarn start
服务器将于启动 http://localhost:3000 使用流式HTTP传输。
连接到克劳德桌面
要将此MCP服务器与Claude Desktop一起使用,请将其添加到您的Claude配置中:
macOS/Linux:
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"gamma": {
"command": "node",
"args": ["/absolute/path/to/gamma-mcp-server/dist/index.js"]
}
}
}
窗户:
编辑 %APPDATA%\Claude\claude_desktop_config.json 具有类似的配置。
重要提示: 替换 /absolute/path/to/gamma-mcp-server 带有此项目目录的实际绝对路径。
用法示例
连接到Claude Desktop后,您可以使用自然语言与Gamma交互:
列出可用主题
Show me all available Gamma themes
列出工作区文件夹
What folders do I have in my Gamma workspace?
生成演示文稿
Create a 10-slide presentation about renewable energy using the "Modern Professional" theme
通过导出生成
Generate a presentation about AI trends and export it as a PowerPoint file
API 参考
资源
gamma://folders
返回所有自动处理分页的工作区文件夹。
答复:
{
"folders": [
{"id": "fold_123", "name": "Marketing"},
{"id": "fold_456", "name": "Sales"}
],
"total": 2
}
gamma://themes
返回所有可用的主题,并自动处理分页。
答复:
{
"themes": [
{
"id": "theme_123",
"name": "Modern Professional",
"type": "standard",
"colorKeywords": ["blue", "corporate"],
"toneKeywords": ["professional", "clean"]
}
],
"total": 50
}
工具
generate_gamma
使用自动轮询生成Gamma内容,直到完成。
参数:
inputText(必填):要生成的内容(最多400k个字符)textMode(必填):"generate","condense",或"preserve"format(可选):"presentation","document","social",或"webpage"(默认:“演示文稿”)numCards(可选):要生成的卡片/页面数量themeId(可选):主题资源中的主题IDfolderIds(可选):用于保存gamma的文件夹ID数组exportAs(可选):"pptx"或"pdf"生成导出URL
退货:
{
"success": true,
"generationId": "gen_abc123",
"gammaUrl": "https://gamma.app/docs/...",
"exportUrl": "https://gamma.app/export/...",
"credits": {
"deducted": 10,
"remaining": 90
}
}
发展
项目结构
gamma-mcp-server/
├── src/
│ ├── index.ts # Entry point
│ ├── app.module.ts # NestJS app module
│ ├── gamma-api.service.ts # Gamma API client
│ ├── folders.resource.ts # Folders MCP resource
│ ├── themes.resource.ts # Themes MCP resource
│ └── generate.tool.ts # Generate MCP tool
├── dist/ # Compiled output
├── package.json
├── tsconfig.json
└── README.md
脚本
yarn build-将TypeScript编译为JavaScriptyarn start-运行已编译的服务器yarn dev-使用ts节点以开发模式运行yarn watch-TypeScript编译的监视模式
故障排除
“无效的API密钥”错误
确保已替换中的占位符API键 src/gamma-api.service.ts 使用您的实际Gamma API密钥。
服务器无法启动
- 确保你已经跑过了
yarn install和yarn build - 检查端口3000是否尚未使用
- 检查控制台是否有错误消息
Claude Desktop无法连接
- 验证Claude配置中的绝对路径是否正确
- 确保服务器已构建(
yarn build) - 编辑配置后重新启动Claude Desktop
- 检查Claude Desktop日志中的连接错误
了解更多
许可证
麻省理工学院