REAPER API文档MCP服务器
模型上下文协议(MCP)服务器,提供对REAPER ReaScript API文档的访问。该服务器允许像Claude这样的人工智能助手实时搜索、浏览和检索REAPER API函数文档。
特性
- 搜索功能:通过名称、描述和签名中的关键字查找REAPER API函数
- 获取函数详细信息:检索所有语言(C、EEL、Lua、Python)中具有签名的特定函数的完整文档
- 按前缀浏览:按类别列出功能(例如,所有“获取”功能、所有“跟踪”功能)
- API统计:获取有关REAPER API的概述统计信息
- MCP资源:通过URI模板访问文档(例如。,
reaper://function/GetTrack) - 智能提示:用于脚本编写帮助和API探索的预构建提示
安装
# Clone or navigate to this repository
cd reaper-apidocs-mcp
# Install dependencies
npm install
# Build the server
npm run build用法
运行服务器
stdio模式(用于本地使用Claude Desktop/Cursor):
npm startHTTP/SSE模式(用于网络访问):
npm run start:http
# Server will run on http://localhost:3001连接到克劳德桌面
添加到您的Claude Desktop MCP配置(~/Library/Application Support/Claude/claude_desktop_config.json 在Mac或 %APPDATA%\Claude\claude_desktop_config.json 在Windows上):
{
"mcpServers": {
"reaper-api": {
"command": "node",
"args": [
"/path/to/reaper-apidocs-mcp/build/index.js"
]
}
}
}连接到游标
创建或编辑 .cursor/mcp.json 在您的项目中:
{
"mcpServers": {
"reaper-api": {
"command": "node",
"args": [
"/path/to/reaper-apidocs-mcp/build/index.js"
]
}
}
}或者使用SSE端点:
{
"mcpServers": {
"reaper-api": {
"url": "http://localhost:3001/sse"
}
}
}可用工具
reaper_get_function
获取特定REAPER API函数的详细文档。
参数:
function_name(string):函数的名称(例如,“AddProjectMarker”、“resper.GetTrack”)
例子:
reaper_get_function({ function_name: "GetTrack" })reaper_search_functions
按关键字搜索REAPER API函数。
参数:
query(string):搜索查询(例如,“track”、“marker”、“midi”)limit(数字,可选):最大结果(默认值:20,最大值:100)
例子:
reaper_search_functions({ query: "track", limit: 10 })reaper_list_by_prefix
列出以特定前缀开头的所有函数。
参数:
prefix(string):函数名称前缀(例如,“Get”、“Set”、“Track”)
例子:
reaper_list_by_prefix({ prefix: "Get" })reaper_api_stats
获取有关REAPER API文档的统计信息。
参数: 无
例子:
reaper_api_stats({})reaper_list_all_functions
获取所有REAPER API函数名称的完整列表。
参数:
limit(数字,可选):要返回的最大函数数(默认值:100)
例子:
reaper_list_all_functions({ limit: 50 })可用资源
reaper://function/{name}
以markdown的形式获取函数文档。
例子: reaper://function/GetTrack
reaper://category/{prefix}
按前缀浏览函数。
例子: reaper://category/Get
reaper://overview
获取REAPER API和此MCP服务器的概述。
例子: reaper://overview
可用提示
reaper_script_helper
获取编写REAPER ReaScript的帮助。
论据:
task(必填):描述您希望脚本执行的操作language(可选):脚本语言(lua、python、eel)
explore_reaper_api
探索特定域的REAPER API函数。
论据:
domain(必需):API域(例如,“tracks”、“items”,“midi”、“fx”)
对话示例
示例1:查找轨迹函数
你: “在REAPER中使用曲目有哪些功能?”
克劳德(使用MCP):
Let me search for track-related functions...
[Uses reaper_search_functions with query "track"]
Here are the main functions for working with tracks:
1. GetTrack - Get a track by index
2. GetSelectedTrack - Get a selected track
3. InsertTrackAtIndex - Insert a new track
4. DeleteTrack - Delete a track
5. SetTrackColor - Set track color
... [continues with more results]示例2:编写脚本
你: “帮助我编写Lua脚本,在当前光标位置创建标记”
克劳德(使用MCP):
Let me find the relevant functions...
[Uses reaper_search_functions with query "marker"]
[Uses reaper_get_function with "AddProjectMarker"]
Here's how to create a marker at the cursor position:
local proj = reaper.EnumProjects(-1, "") local cursor_pos = reaper.GetCursorPosition() local marker_idx = reaper.AddProjectMarker(proj, false, cursor_pos, 0, "My Marker", -1)
if marker_idx >= 0 then reaper.ShowConsoleMsg("Marker created at index " .. marker_idx .. "\n") else reaper.ShowConsoleMsg("Failed to create marker\n") end
…\[解释参数\]
API Documentation Source
The server parses docs/reaper_api.html which contains the official REAPER ReaScript API documentation (v7.54 as of last update).
Technical Details
- Framework: FastMCP
- Language: TypeScript
- Transport: stdio or SSE (HTTP)
- Parsing: Custom HTML parser for REAPER API documentation
- Caching: Functions are parsed once and cached in memory
Development
# Install dependencies
npm install
# Run in development mode with auto-reload
npm run dev # stdio mode
npm run dev:http # HTTP mode
# Build for production
npm run build
npm run build:http
# Test with MCP Inspector
npx fastmcp inspect src/index.ts项目结构
src/
├── core/
│ ├── services/
│ │ ├── reaper-api-parser.ts # HTML parsing and API data
│ │ └── index.ts
│ ├── tools.ts # MCP tool definitions
│ ├── resources.ts # MCP resource definitions
│ └── prompts.ts # MCP prompt definitions
├── server/
│ ├── server.ts # FastMCP server setup
│ ├── http-server.ts # SSE/HTTP entry point
│ └── index.ts # stdio entry point (not used)
├── index.ts # Main stdio entry point
docs/
└── reaper_api.html # REAPER API documentation source故障排除
“加载REAPER API文档失败”
确保 docs/reaper_api.html 存在于项目目录中。服务器期望此文件位于 {cwd}/docs/reaper_api.html.
服务器未连接
- 对于stdio模式:检查MCP配置中的路径是否指向正确的
build/index.js文件 - 对于SSE模式:确保端口3001未被使用,或更改为
PORT=8080 npm run start:http
未找到功能
解析器期望来自REAPER API官方文档的HTML结构。如果您已经更新了HTML文件,请确保它保持了预期的结构 阻碍。
许可证
麻省理工学院
