使用说明
Ember MCP服务器
一个MCP(模型上下文协议)服务器,提供对Ember文档、API参考、指南和社区最佳实践的全面访问。
⚠️ 免责声明
使用风险自负。 此MCP服务器与您的项目文件交互并执行命令。虽然MCP服务器本身并不直接建议有害的命令,但它为AI代理提供了可能建议有害或破坏性操作的工具。我们不对您的项目造成的任何损害负责,包括但不限于:
- 删除代码
- 删除项目外的文件夹/文件
- 对代码库的意外修改
- 任何其他不利影响
在应用生成的命令和更改之前,请务必检查它们,并确保您有适当的版本控制和备份。
特性
- 完整的文档访问权限:搜索官方Ember.js API文档、指南和社区文章
- API参考资料:获取Ember类、模块和方法的详细API文档
- 最佳实践:访问Ember开发的精选最佳实践和现代模式
- 版本信息:及时了解Ember版本和迁移指南
- npm包工具:从npm注册表获取最新的包版本和依赖关系信息
- 包管理器检测:自动检测工作区中正在使用哪个包管理器(pnpm、yarn、npm、bun)来提供正确的命令
- 智能搜索:智能搜索,对所有文档来源进行相关性排名
安装
先决条件
- Node.js 22或更高版本
- 任何兼容MCP的客户端
设置
在配置中使用最新版本:
{
"servers": {
"ember": {
"command": "npx",
"args": ["-y", "ember-mcp"]
}
}
}
或者,如果您需要确保使用特定的shell环境:
{
"servers": {
"ember": {
"command": "/opt/homebrew/bin/bash",
"args": ["-l", "-c", "pnpm dlx ember-mcp"]
}
}
}
using a tag-release from github
{
"servers": {
"ember": {
"command": "npx",
"args": ["-y", "github:NullVoxPopuli/ember-mcp#v0.0.2-ember-mcp"]
}
}
}
npx支持的任何语法都可以在这里工作
local
- 克隆或下载此存储库:
cd ember-mcp
npm install
- 通过编辑您的
claude_desktop_config.json:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
将此添加到MCP服务器配置中:
{
"servers": {
"ember-docs": {
"command": "node",
"args": ["/absolute/path/to/ember-mcp/index.js"]
}
}
}
然后,重新启动编辑器或其扩展主机
[!注意] VSCode使用
servers所有MCP服务器和Claud使用的密钥mcpServers
可用工具
1. search_ember_docs
搜索所有Ember文档,包括API文档、指南和社区内容。
参数:
query(必填):搜索查询(例如,“组件生命周期”、“跟踪属性”)category(可选):按“all”、“api”、“guides”或“community”筛选(默认值:“all”)limit(可选):最大结果数(默认值:5)
例子:
Search for "tracked properties" in Ember docs
2. get_api_reference
获取特定Ember类、模块或方法的详细API文档。
参数:
name(必需):API元素的名称(例如,“组件”、“@flight/Component”、“服务”)type(可选):API元素的类型(“类”、“模块”、“方法”、“属性”)
例子:
Get API documentation for the Component class
3. get_best_practices
获取Ember针对特定主题的最佳实践和建议。该工具提供了现代模式、要避免的反模式和社区认可的方法。
参数:
topic(必填):获取最佳实践的主题(例如,“组件模式”、“状态管理”、“测试”)
例子:
What are the best practices for component patterns in Ember?
4. get_ember_version_info
获取有关Ember版本的信息,包括当前稳定版本、最新版本和迁移指南。
参数:
version(可选):要获取信息的特定版本(如果未指定,则返回最新版本)
例子:
What's new in the latest Ember version?
5. get_npm_package_info
获取有关npm包的全面信息,包括最新版本、描述、依赖关系、维护者等。
参数:
packageName(必填):npm包的名称(例如,'ember-source','@glimmer/component')
例子:
What's the latest version of ember-source?
Get information about @glimmer/component package
6. compare_npm_versions
将当前包版本与npm上可用的最新版本进行比较。显示是否需要更新,并提供版本详细信息以帮助进行依赖关系升级。
参数:
packageName(必填):npm包的名称currentVersion(必填):当前使用的版本(例如“4.12.0”)
例子:
I'm using ember-source 4.12.0, should I upgrade?
Compare my current version of @glimmer/component (1.1.2) with the latest
7. detect_package_manager
通过检查lockfiles和package.json来检测工作区中正在使用哪个包管理器(pnpm、yarn、npm、bun)。返回用于安装依赖项、运行脚本和执行包的相应命令。
参数:
workspacePath(必填):要分析的工作区目录的绝对路径(例如,“/path/to/project”)
例子:
What package manager should I use in this project?
Which commands should I use to install dependencies?
为什么这很重要:
AI代理通常默认使用 npm 或 npx 命令,但许多项目使用不同的包管理器。使用错误的包管理器可能会导致锁文件一致性和依赖性解决问题。此工具可确保AI始终为项目使用正确的命令。
使用示例
开始使用新功能
User: I need to implement a feature that tracks user preferences. What's the best approach in modern Ember?
The agent will:
1. Use search_ember_docs to find relevant service and state management docs
2. Use get_best_practices to recommend modern patterns
3. Use get_api_reference to show specific API details for Services
4. Provide code examples following best practices
了解API详细信息
User: How do I use the @tracked decorator?
The agent will:
1. Use get_api_reference to get detailed @tracked documentation
2. Use search_ember_docs to find related concepts
3. Use get_best_practices to show modern reactive patterns
迁移帮助
User: I'm upgrading from Ember 3.x to 4.x, what do I need to know?
The agent will:
1. Use get_ember_version_info to get migration information
2. Use get_best_practices for modern patterns replacing deprecated ones
3. Use search_ember_docs to find upgrade guides
依赖管理
User: Help me upgrade my Ember dependencies. I'm on ember-source 4.8.0
The agent will:
1. Use detect_package_manager to determine which package manager the project uses
2. Use get_npm_package_info to get the latest ember-source information
3. Use compare_npm_versions to check if an update is available
4. Use get_ember_version_info for migration guides
5. Check other related packages for compatibility
6. Provide commands using the correct package manager
包装经理意识
User: I want to add ember-concurrency to my project
The agent will:
1. Use detect_package_manager to check the workspace's package manager
2. Provide the correct command (pnpm add, yarn add, npm install, or bun add)
3. Avoid suggesting npm/npx when the project uses a different package manager
数据源
此MCP服务器从全面的Ember文档聚合器中获取文档: https://nullvoxpopuli.github.io/ember-ai-information-aggregator/llms-full.txt
该来源包括:
- 官方Ember.js API文档(JSON格式)
- 官方指南和教程
- 社区博客文章和文章
- 最佳实践和现代模式
文档在服务器启动时加载并解析,然后缓存在内存中以供快速访问。
最佳实践重点
此MCP服务器专门用于通过以下方式推广Ember最佳实践:
- 现代模式优先:优先考虑Octane版本模式和现代JavaScript
- 反模式检测:突出显示要避免的模式
- 社区智慧:包括社区专家的见解
- 版本意识:帮助用户了解特定版本的功能和弃用
- 完整上下文:不仅提供“如何”,还提供“为什么”和“何时”
发展
直接运行服务器
npm start
服务器通过stdio进行通信,并期望收到MCP协议消息。
发展模式
npm run dev
使用节点 --watch 开发过程中自动重启的标志。
建筑
服务器由以下部分组成:
- index.js:带有工具处理程序的主MCP服务器实现
- lib/documentation-service.js:文档解析、索引和搜索逻辑
文档服务:
- 启动时获取完整文档
- 将其解析为可搜索的部分
- 为API文档编制索引,以便快速查找
- 提供智能搜索和相关性排名
- 提取最佳实践和示例
故障排除
服务器未出现在Claude Desktop中
- 检查路径是否正确
claude_desktop_config.json绝对正确 - 确保Node.js在你的PATH中
- 检查克劳德桌面日志:
~/Library/Logs/Claude/(macOS) - 完全重新启动克劳德桌面
文档未加载
服务器在首次使用时获取文档。检查:
- 互联网连接可用
- 文档URL可访问
- 错误消息的服务器日志
搜索未返回任何结果
- 尝试更广泛的搜索词
- 使用
category缩小搜索范围的参数 - 检查API名称的拼写
贡献
欢迎投稿!需要改进的地方:
- 更好的相关性排名算法
- 缓存频繁访问的文档
- 支持离线模式
- 其他最佳实践提取
- 与Ember CLI文档集成
许可证
麻省理工学院