mta-mcp 1.9.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -2
- package/bin/mta.cjs +43 -0
- package/dist/index.cjs +4784 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4769 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -16
- package/build/core/agentTemplate.d.ts +0 -33
- package/build/core/agentTemplate.d.ts.map +0 -1
- package/build/core/agentTemplate.js +0 -158
- package/build/core/agentTemplate.js.map +0 -1
- package/build/core/autoInitializer.d.ts +0 -34
- package/build/core/autoInitializer.d.ts.map +0 -1
- package/build/core/autoInitializer.js +0 -145
- package/build/core/autoInitializer.js.map +0 -1
- package/build/core/codeValidator.d.ts +0 -82
- package/build/core/codeValidator.d.ts.map +0 -1
- package/build/core/codeValidator.js +0 -287
- package/build/core/codeValidator.js.map +0 -1
- package/build/core/githubClient.d.ts +0 -26
- package/build/core/githubClient.d.ts.map +0 -1
- package/build/core/githubClient.js +0 -60
- package/build/core/githubClient.js.map +0 -1
- package/build/core/i18nDetector.d.ts +0 -47
- package/build/core/i18nDetector.d.ts.map +0 -1
- package/build/core/i18nDetector.js +0 -314
- package/build/core/i18nDetector.js.map +0 -1
- package/build/core/projectContextManager.d.ts +0 -39
- package/build/core/projectContextManager.d.ts.map +0 -1
- package/build/core/projectContextManager.js +0 -147
- package/build/core/projectContextManager.js.map +0 -1
- package/build/core/smartAgentMatcher.d.ts +0 -51
- package/build/core/smartAgentMatcher.d.ts.map +0 -1
- package/build/core/smartAgentMatcher.js +0 -493
- package/build/core/smartAgentMatcher.js.map +0 -1
- package/build/core/standardsManager.d.ts +0 -130
- package/build/core/standardsManager.d.ts.map +0 -1
- package/build/core/standardsManager.js +0 -600
- package/build/core/standardsManager.js.map +0 -1
- package/build/core/types.d.ts +0 -55
- package/build/core/types.d.ts.map +0 -1
- package/build/core/types.js +0 -21
- package/build/core/types.js.map +0 -1
- package/build/index.d.ts +0 -3
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -463
- package/build/index.js.map +0 -1
- package/build/tools/analyzeProject.d.ts +0 -12
- package/build/tools/analyzeProject.d.ts.map +0 -1
- package/build/tools/analyzeProject.js +0 -85
- package/build/tools/analyzeProject.js.map +0 -1
- package/build/tools/autoSetup.d.ts +0 -15
- package/build/tools/autoSetup.d.ts.map +0 -1
- package/build/tools/autoSetup.js +0 -291
- package/build/tools/autoSetup.js.map +0 -1
- package/build/tools/generateConfig.d.ts +0 -16
- package/build/tools/generateConfig.d.ts.map +0 -1
- package/build/tools/generateConfig.js +0 -379
- package/build/tools/generateConfig.js.map +0 -1
- package/build/tools/generateProjectAgent.d.ts +0 -15
- package/build/tools/generateProjectAgent.d.ts.map +0 -1
- package/build/tools/generateProjectAgent.js +0 -348
- package/build/tools/generateProjectAgent.js.map +0 -1
- package/build/tools/getCompactStandards.d.ts +0 -20
- package/build/tools/getCompactStandards.d.ts.map +0 -1
- package/build/tools/getCompactStandards.js +0 -367
- package/build/tools/getCompactStandards.js.map +0 -1
- package/build/tools/getSmartStandards.d.ts +0 -17
- package/build/tools/getSmartStandards.d.ts.map +0 -1
- package/build/tools/getSmartStandards.js +0 -190
- package/build/tools/getSmartStandards.js.map +0 -1
- package/build/tools/healthCheck.d.ts +0 -14
- package/build/tools/healthCheck.d.ts.map +0 -1
- package/build/tools/healthCheck.js +0 -237
- package/build/tools/healthCheck.js.map +0 -1
- package/build/tools/listAgents.d.ts +0 -10
- package/build/tools/listAgents.d.ts.map +0 -1
- package/build/tools/listAgents.js +0 -79
- package/build/tools/listAgents.js.map +0 -1
- package/build/tools/matchAgents.d.ts +0 -14
- package/build/tools/matchAgents.d.ts.map +0 -1
- package/build/tools/matchAgents.js +0 -70
- package/build/tools/matchAgents.js.map +0 -1
- package/build/tools/usePreset.d.ts +0 -23
- package/build/tools/usePreset.d.ts.map +0 -1
- package/build/tools/usePreset.js +0 -163
- package/build/tools/usePreset.js.map +0 -1
- package/src/core/autoInitializer.ts +0 -170
- package/src/core/codeValidator.ts +0 -357
- package/src/core/githubClient.ts +0 -64
- package/src/core/i18nDetector.ts +0 -357
- package/src/core/smartAgentMatcher.ts +0 -490
- package/src/core/standardsManager.ts +0 -769
- package/src/core/types.ts +0 -72
- package/src/index.ts +0 -519
- package/src/tools/analyzeProject.ts +0 -94
- package/src/tools/autoSetup.ts +0 -312
- package/src/tools/generateConfig.ts +0 -429
- package/src/tools/getCompactStandards.ts +0 -413
- package/src/tools/getSmartStandards.ts +0 -214
- package/src/tools/healthCheck.ts +0 -261
- package/src/tools/listAgents.ts +0 -91
- package/src/tools/matchAgents.ts +0 -80
- package/src/tools/usePreset.ts +0 -180
package/README.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# Copilot Prompts MCP Server
|
|
2
2
|
|
|
3
|
-
[](https://modelcontextprotocol.io)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
7
|
智能分析项目并自动匹配 GitHub Copilot Agents 的 MCP 服务器。
|
|
8
8
|
|
|
9
|
+
## 🧠 v2.0 设计理念
|
|
10
|
+
|
|
11
|
+
> **MCP = 信息提供者,AI = 决策者**
|
|
12
|
+
|
|
13
|
+
v2.0 版本进行了重大设计调整:
|
|
14
|
+
|
|
15
|
+
| 错误做法 | 正确做法 |
|
|
16
|
+
|---------|---------|
|
|
17
|
+
| MCP 分析意图 → 计算权重 → 匹配规范 | AI 知道需要什么 → 调用 MCP → MCP 快速返回数据 |
|
|
18
|
+
| MCP 返回"推荐规范" | MCP 返回"可用信息供参考" |
|
|
19
|
+
| 复杂的权重算法 | 简单的映射表查询 |
|
|
20
|
+
|
|
21
|
+
**核心思想**:AI 比 MCP 更擅长理解用户意图和做决策,MCP 只需要提供高效的数据访问能力。
|
|
22
|
+
|
|
9
23
|
## 🎯 功能特性
|
|
10
24
|
|
|
11
25
|
### 核心功能
|
|
@@ -15,7 +29,12 @@
|
|
|
15
29
|
- **模块化编码规范** - MCP Resources 按需加载,节省 50-70% tokens
|
|
16
30
|
- **跨平台支持** - 可用于 Claude Desktop、VS Code 等任何 MCP 客户端
|
|
17
31
|
|
|
18
|
-
###
|
|
32
|
+
### v2.0 新增:直接访问工具 🆕
|
|
33
|
+
- **📖 `get_standard_by_id`** - AI 知道需要什么规范时,直接按 ID 获取
|
|
34
|
+
- **🗺️ `query_mappings`** - 查询场景-规范映射关系,AI 自行决策
|
|
35
|
+
- **📋 `list_scenarios`** - 列出所有可用场景名称
|
|
36
|
+
|
|
37
|
+
### Phase 4: 傻瓜模式 🎉
|
|
19
38
|
- **🎯 一键自动配置** - `auto_setup` 工具,30 秒完成 VS Code 配置
|
|
20
39
|
- **🏥 健康检查诊断** - `health_check` 工具,自动诊断并给出修复建议
|
|
21
40
|
- **🧠 零参数智能推荐** - `get_smart_standards` 工具,自动检测上下文
|
|
@@ -84,6 +103,125 @@ Claude: [调用 generate_config 工具]
|
|
|
84
103
|
|
|
85
104
|
## 🛠️ 可用工具
|
|
86
105
|
|
|
106
|
+
### 📖 v2.0 直接访问工具(推荐 AI 使用)
|
|
107
|
+
|
|
108
|
+
> 这些工具遵循"MCP = 信息提供者"理念,AI 直接调用获取需要的数据。
|
|
109
|
+
|
|
110
|
+
#### 1. `get_standard_by_id` - 按 ID 直接获取规范 ⭐
|
|
111
|
+
|
|
112
|
+
AI 知道需要什么规范时,直接按 ID 获取,最简洁高效。
|
|
113
|
+
|
|
114
|
+
**参数**:
|
|
115
|
+
```typescript
|
|
116
|
+
{
|
|
117
|
+
id?: string, // 单个规范 ID
|
|
118
|
+
ids?: string[], // 多个规范 ID(批量获取)
|
|
119
|
+
mode?: 'summary' | 'key-rules' | 'full' // 加载模式,默认 key-rules
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**使用示例**:
|
|
124
|
+
```
|
|
125
|
+
// 获取单个规范
|
|
126
|
+
get_standard_by_id({ id: 'vue3-composition', mode: 'key-rules' })
|
|
127
|
+
|
|
128
|
+
// 批量获取
|
|
129
|
+
get_standard_by_id({ ids: ['vue3-composition', 'element-plus'], mode: 'summary' })
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### 2. `query_mappings` - 查询场景-规范映射
|
|
133
|
+
|
|
134
|
+
提供映射信息给 AI 参考,AI 自己决定使用哪些规范。
|
|
135
|
+
|
|
136
|
+
**参数**:
|
|
137
|
+
```typescript
|
|
138
|
+
{
|
|
139
|
+
scenario?: string, // 场景名称
|
|
140
|
+
fileType?: string, // 文件类型
|
|
141
|
+
imports?: string[], // 导入的包
|
|
142
|
+
listAll?: boolean // 列出所有映射
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**使用示例**:
|
|
147
|
+
```
|
|
148
|
+
// 查询场景对应的规范
|
|
149
|
+
query_mappings({ scenario: 'vue3-form' })
|
|
150
|
+
|
|
151
|
+
// 查询所有映射关系
|
|
152
|
+
query_mappings({ listAll: true })
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### 3. `list_scenarios` - 列出所有场景
|
|
156
|
+
|
|
157
|
+
获取所有可用场景名称,用于 `use_preset` 或 `query_mappings`。
|
|
158
|
+
|
|
159
|
+
**参数**: 无
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### 📦 v2.1 模板系统工具
|
|
164
|
+
|
|
165
|
+
> 模板是可复用的代码片段,AI 可根据需要选择并应用到目标项目。
|
|
166
|
+
|
|
167
|
+
#### 1. `list_templates` - 列出可用模板
|
|
168
|
+
|
|
169
|
+
列出所有可用的代码模板,支持按类型、框架筛选。
|
|
170
|
+
|
|
171
|
+
**参数**:
|
|
172
|
+
```typescript
|
|
173
|
+
{
|
|
174
|
+
type?: 'api-layer' | 'component' | 'store' | 'composable' | 'config' | 'types',
|
|
175
|
+
framework?: string, // 如 'vue', 'react'
|
|
176
|
+
search?: string // 搜索关键词
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**使用示例**:
|
|
181
|
+
```
|
|
182
|
+
// 列出所有模板
|
|
183
|
+
list_templates({})
|
|
184
|
+
|
|
185
|
+
// 按类型筛选
|
|
186
|
+
list_templates({ type: 'api-layer' })
|
|
187
|
+
|
|
188
|
+
// 搜索
|
|
189
|
+
list_templates({ search: 'axios' })
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### 2. `get_template` - 获取模板详情
|
|
193
|
+
|
|
194
|
+
获取模板的配置说明和文件内容,AI 可根据说明自行修改并应用。
|
|
195
|
+
|
|
196
|
+
**参数**:
|
|
197
|
+
```typescript
|
|
198
|
+
{
|
|
199
|
+
id: string, // 模板 ID(如 'vue/api-layer')
|
|
200
|
+
includeFiles?: boolean, // 是否包含文件内容(默认 false)
|
|
201
|
+
files?: string[] // 指定获取的文件列表(可选)
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**使用示例**:
|
|
206
|
+
```
|
|
207
|
+
// 获取配置说明(节省 token)
|
|
208
|
+
get_template({ id: 'vue/api-layer' })
|
|
209
|
+
|
|
210
|
+
// 获取完整模板(含所有文件)
|
|
211
|
+
get_template({ id: 'vue/api-layer', includeFiles: true })
|
|
212
|
+
|
|
213
|
+
// 获取特定文件
|
|
214
|
+
get_template({ id: 'vue/api-layer', files: ['request.ts'] })
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**AI 工作流**:
|
|
218
|
+
1. 调用 `list_templates` 了解可用模板
|
|
219
|
+
2. 调用 `get_template` 获取模板配置说明
|
|
220
|
+
3. 根据目标项目情况决定如何修改模板
|
|
221
|
+
4. 将模板文件复制到目标项目并适配
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
87
225
|
### 🎯 Phase 4: 傻瓜模式工具(推荐)
|
|
88
226
|
|
|
89
227
|
#### 1. `auto_setup` - 一键自动配置 ⭐
|
package/bin/mta.cjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MTA MCP Server - 自动兼容 CommonJS 和 ES Module
|
|
5
|
+
* 根据当前 Node.js 版本自动选择合适的模块格式
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { existsSync } = require('fs');
|
|
9
|
+
const { join, dirname } = require('path');
|
|
10
|
+
|
|
11
|
+
// 检测 Node.js 版本
|
|
12
|
+
const nodeVersion = process.versions.node;
|
|
13
|
+
const majorVersion = parseInt(nodeVersion.split('.')[0]);
|
|
14
|
+
|
|
15
|
+
// 获取包根目录(bin 的上一级)
|
|
16
|
+
const packageRoot = join(__dirname, '..');
|
|
17
|
+
const distPath = join(packageRoot, 'dist');
|
|
18
|
+
|
|
19
|
+
// Node.js 12-13 只支持 CommonJS
|
|
20
|
+
if (majorVersion < 14) {
|
|
21
|
+
const cjsPath = join(distPath, 'index.cjs');
|
|
22
|
+
if (existsSync(cjsPath)) {
|
|
23
|
+
require(cjsPath);
|
|
24
|
+
} else {
|
|
25
|
+
console.error(`[MCP Error] 未找到 CommonJS 构建版本: ${cjsPath}`);
|
|
26
|
+
console.error('[MCP Error] 请确保已运行: npm run build');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
// Node.js 14+ 支持 ES Module
|
|
31
|
+
const esmPath = join(distPath, 'index.js');
|
|
32
|
+
if (existsSync(esmPath)) {
|
|
33
|
+
// 使用动态 import 加载 ES Module
|
|
34
|
+
import(esmPath).catch(err => {
|
|
35
|
+
console.error('[MCP Error] 启动失败:', err.message);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
console.error(`[MCP Error] 未找到 ES Module 构建版本: ${esmPath}`);
|
|
40
|
+
console.error('[MCP Error] 请确保已运行: npm run build');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|