MTA - 智能编码助手 MCP 服务器(规范 + 技能 + 诊断 + 模板 + 记忆 + 思考)
npm install mta-mcp


智能分析项目并自动匹配 GitHub Copilot Agents 的 MCP 服务器。
> MCP = 信息提供者,AI = 决策者
v2.0 版本进行了重大设计调整:
| 错误做法 | 正确做法 |
|---------|---------|
| MCP 分析意图 → 计算权重 → 匹配规范 | AI 知道需要什么 → 调用 MCP → MCP 快速返回数据 |
| MCP 返回"推荐规范" | MCP 返回"可用信息供参考" |
| 复杂的权重算法 | 简单的映射表查询 |
核心思想:AI 比 MCP 更擅长理解用户意图和做决策,MCP 只需要提供高效的数据访问能力。
.github/copilot-instructions.mdget_standard_by_id - AI 知道需要什么规范时,直接按 ID 获取query_mappings - 查询场景-规范映射关系,AI 自行决策list_scenarios - 列出所有可用场景名称auto_setup 工具,30 秒完成 VS Code 配置health_check 工具,自动诊断并给出修复建议get_smart_standards 工具,自动检测上下文use_preset 工具,8 种常见场景一键获取``bash克隆仓库
git clone https://github.com/ForLear/copilot-prompts.git
cd copilot-prompts/mcp-server
🚀 快速开始
$3
1. 配置 Claude Desktop
编辑配置文件:
~/Library/Application Support/Claude/claude_desktop_config.json`json
{
"mcpServers": {
"copilot-prompts": {
"command": "node",
"args": ["/绝对路径/copilot-prompts/mcp-server/build/index.js"]
}
}
}
`2. 重启 Claude Desktop
3. 开始使用
在 Claude Desktop 中,您可以这样对话:
`
你: 帮我分析一下 /Users/username/projects/my-vue-app 这个项目Claude: [调用 analyze_project 工具]
检测到 Vue 3 项目,使用 Vite、TypeScript、Element Plus...
你: 为这个项目生成 Copilot 配置
Claude: [调用 generate_config 工具]
已为您生成配置文件,应用了 4 个 Agents:
- Vue 3 开发规范
- TypeScript 严格模式
- 国际化规范
- Element Plus 组件库
`🛠️ 可用工具
$3
> 这些工具遵循"MCP = 信息提供者"理念,AI 直接调用获取需要的数据。
#### 1.
get_standard_by_id - 按 ID 直接获取规范 ⭐AI 知道需要什么规范时,直接按 ID 获取,最简洁高效。
参数:
`typescript
{
id?: string, // 单个规范 ID
ids?: string[], // 多个规范 ID(批量获取)
mode?: 'summary' | 'key-rules' | 'full' // 加载模式,默认 key-rules
}
`使用示例:
`
// 获取单个规范
get_standard_by_id({ id: 'vue3-composition', mode: 'key-rules' })// 批量获取
get_standard_by_id({ ids: ['vue3-composition', 'element-plus'], mode: 'summary' })
`#### 2.
query_mappings - 查询场景-规范映射提供映射信息给 AI 参考,AI 自己决定使用哪些规范。
参数:
`typescript
{
scenario?: string, // 场景名称
fileType?: string, // 文件类型
imports?: string[], // 导入的包
listAll?: boolean // 列出所有映射
}
`使用示例:
`
// 查询场景对应的规范
query_mappings({ scenario: 'vue3-form' })// 查询所有映射关系
query_mappings({ listAll: true })
`#### 3.
list_scenarios - 列出所有场景获取所有可用场景名称,用于
use_preset 或 query_mappings。参数: 无
---
$3
> 模板是可复用的代码片段,AI 可根据需要选择并应用到目标项目。
#### 1.
list_templates - 列出可用模板列出所有可用的代码模板,支持按类型、框架筛选。
参数:
`typescript
{
type?: 'api-layer' | 'component' | 'store' | 'composable' | 'config' | 'types',
framework?: string, // 如 'vue', 'react'
search?: string // 搜索关键词
}
`使用示例:
`
// 列出所有模板
list_templates({})// 按类型筛选
list_templates({ type: 'api-layer' })
// 搜索
list_templates({ search: 'axios' })
`#### 2.
get_template - 获取模板详情获取模板的配置说明和文件内容,AI 可根据说明自行修改并应用。
参数:
`typescript
{
id: string, // 模板 ID(如 'vue/api-layer')
includeFiles?: boolean, // 是否包含文件内容(默认 false)
files?: string[] // 指定获取的文件列表(可选)
}
`使用示例:
`
// 获取配置说明(节省 token)
get_template({ id: 'vue/api-layer' })// 获取完整模板(含所有文件)
get_template({ id: 'vue/api-layer', includeFiles: true })
// 获取特定文件
get_template({ id: 'vue/api-layer', files: ['request.ts'] })
`AI 工作流:
1. 调用
list_templates 了解可用模板
2. 调用 get_template 获取模板配置说明
3. 根据目标项目情况决定如何修改模板
4. 将模板文件复制到目标项目并适配---
$3
#### 1.
auto_setup - 一键自动配置 ⭐v1.2.0 更新:现在不仅配置 MCP 服务器,还会自动分析项目并生成
copilot-instructions.md!
v1.2.1 更新:默认从 GitHub 获取最新 Agents,本地作为备份。30 秒完成完整配置,无需手动编辑任何文件:
- ✅ 创建
.vscode/mcp.json
- ✅ 更新 settings.json
- ✅ 添加推荐扩展
- ✅ 自动分析项目并生成 .github/copilot-instructions.md
- ✅ 从 GitHub 获取最新 Agents(确保使用最新规范)参数:
`typescript
{
workspacePath?: string // 可选,不填则使用当前目录
generateInstructions?: boolean // 是否生成 copilot-instructions.md(默认 true)
}
`返回:
`json
{
"success": true,
"message": "🎉 MCP 服务器已自动配置到工作区",
"steps": [
{ "step": "创建 .vscode 目录", "status": "success" },
{ "step": "检测 MCP 服务器路径", "status": "success" },
{ "step": "创建 mcp.json", "status": "success" },
{ "step": "更新 settings.json", "status": "success" },
{ "step": "生成 copilot-instructions.md", "status": "success", "detail": "应用了 3 个 Agents" }
],
"nextSteps": [
"1. 重新加载 VS Code 窗口",
"2. 打开 GitHub Copilot Chat",
"3. 开始使用:Copilot 会自动应用项目规范"
]
}
`使用示例:
`
// 完整配置(推荐)
auto_setup({ workspacePath: "/Users/you/my-project" })// 只配置 MCP,不生成项目规范
auto_setup({
workspacePath: "/Users/you/my-project",
generateInstructions: false
})
`#### 2.
health_check - 健康检查诊断检查 MCP 服务器配置和运行状态,自动诊断问题并给出修复建议。
参数:
`typescript
{
workspacePath?: string, // 可选
verbose?: boolean // 是否显示详细信息
}
`返回:
`json
{
"success": true,
"overallStatus": "healthy",
"summary": "✅ MCP 服务器状态: healthy",
"checks": {
"server": { "status": "healthy", "details": ["✅ MCP 服务器正在运行"] },
"configuration": { "status": "healthy", "details": ["✅ mcp.json 配置正确"] },
"dependencies": { "status": "healthy", "details": ["✅ 服务器版本: 1.4.0"] },
"standards": { "status": "healthy", "details": ["✅ 找到 8 个规范文件"] }
},
"recommendations": ["🎉 一切正常!您可以开始使用 MCP 服务器了"]
}
`#### 3.
get_smart_standards - 零参数智能推荐自动检测当前文件类型、导入和场景,推荐最相关的编码规范。
参数:
`typescript
{
currentFile?: string, // 可选,当前文件路径
fileContent?: string // 可选,文件内容用于分析
}
`返回:
`json
{
"success": true,
"analysis": {
"source": "file-content",
"fileType": "vue",
"imports": ["vue", "element-plus", "pinia"],
"scenario": "表单组件、状态管理"
},
"standards": ["standards://core/code-style", "standards://frameworks/vue3-composition"],
"stats": {
"standardsCount": 5,
"estimatedTokens": 4347
}
}
`#### 4.
use_preset - 预设场景快捷方式使用预定义的常见场景配置,一键获取相关规范。
预设列表:
-
vue3-component - Vue 3 组件开发
- vue3-form - Vue 3 表单开发
- vue3-table - Vue 3 表格开发
- pinia-store - Pinia 状态管理
- api-call - API 调用层
- typescript-strict - TypeScript 严格模式
- i18n - 国际化开发
- composable - Vue 3 Composable参数:
`typescript
{
preset: string, // 预设 ID(见上方列表)
customImports?: string[] // 可选,额外的导入
}
`返回:
`json
{
"success": true,
"preset": {
"id": "vue3-form",
"name": "Vue 3 表单开发",
"description": "Element Plus 表单组件开发,包含验证和国际化"
},
"applied": {
"fileType": "vue",
"imports": ["vue", "element-plus"],
"scenario": "表单组件"
},
"standards": ["standards://core/code-style", "..."],
"stats": { "estimatedTokens": 4347 }
}
`#### 5.
list_presets - 列出所有预设参数: 无
返回: 所有可用预设的列表及说明
---
$3
#### 1.
analyze_project分析项目的技术栈和特征。路径可选,不填则自动检测当前工作区。
参数:
`typescript
{
projectPath?: string // 项目绝对路径(可选,不填则使用当前目录)
}
`返回:
`json
{
"success": true,
"projectPath": "/path/to/project",
"projectName": "my-app",
"autoDetected": true,
"features": {
"projectType": "vue3",
"frameworks": ["Vue 3"],
"languages": ["TypeScript"],
"tools": ["Vite", "Element Plus"],
"keywords": ["i18n", "state-management"]
}
}
`$3
根据项目特征匹配 Agents。
参数:
`typescript
{
projectFeatures: ProjectFeatures, // 从 analyze_project 获取
limit?: number // 返回数量,默认 10
}
`返回:
`json
{
"success": true,
"matched": 5,
"agents": [
{
"id": "vue3",
"title": "Vue 3 开发规范",
"score": 25,
"tags": ["vue3", "typescript"]
}
]
}
`$3
列出所有可用的 Agents。
参数: 无
返回:
`json
{
"success": true,
"total": 8,
"agents": [...]
}
`$3
生成配置文件。
参数:
`typescript
{
projectPath: string, // 项目路径
agentIds?: string[], // 指定 Agents(可选)
autoMatch?: boolean // 是否自动匹配(默认 true)
}
`返回:
`json
{
"success": true,
"configPath": "/path/to/.github/copilot-instructions.md",
"agents": [...],
"message": "已成功生成配置文件,应用了 4 个 Agents"
}
`$3
根据开发上下文智能获取编码规范,按需加载节省 50-70% tokens。
参数:
`typescript
{
fileType?: string, // 文件类型(vue, ts, tsx 等)
imports?: string[], // import 语句(如未提供会自动检测)
scenario?: string, // 开发场景("创建组件"、"API调用"等)
fileContent?: string // 文件内容(可选,用于自动分析)
}
`返回:
`json
{
"success": true,
"standards": [
"standards://core/code-style",
"standards://frameworks/vue3-composition",
"standards://libraries/element-plus"
],
"content": "合并后的规范内容...",
"tokenEstimate": 3500
}
`示例:
`typescript
// 自动检测(仅提供文件内容)
get_relevant_standards({
fileType: "vue",
fileContent:
})
// 返回:Vue 3 + Element Plus + 组件设计规范// 手动指定
get_relevant_standards({
fileType: "ts",
imports: ["axios"],
scenario: "API 调用"
})
// 返回:TypeScript + API 层设计规范
`$3
查看规范系统的使用统计和性能指标。
参数:
`typescript
{
includeCache?: boolean // 是否包含缓存详情(默认 false)
}
`返回:
`json
{
"success": true,
"usage": {
"topCombinations": [...], // 最常用的规范组合
"topStandards": [...], // 最常用的单个规范
"totalCalls": 100
},
"performance": {
"totalCalls": 100,
"cacheHits": 75,
"cacheMisses": 25,
"cacheHitRate": "75.00%",
"averageResponseTime": 0.5,
"totalTokensSaved": 42000
},
"cache": { // 仅当 includeCache=true 时
"size": 8,
"maxSize": 50,
"entries": [...]
}
}
`📊 使用示例
$3
`
你: 我正在开发一个 Vue 表单组件,需要相关规范Claude: [调用 get_relevant_standards]
{
fileType: "vue",
scenario: "表单组件",
fileContent: "