@yottameta/yotta-dev-mcp 0.0.0 → 0.1.1
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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/NOTICE +7 -0
- package/README.md +76 -0
- package/README.zh-CN.md +71 -0
- package/SKILL.md +67 -0
- package/assets/banner.png +0 -0
- package/bin/install.js +142 -0
- package/bin/yotta-dev-mcp.js +57 -0
- package/install.sh +9 -0
- package/package.json +37 -12
- package/references/tools.md +111 -0
- package/scripts/dev_engine.py +1014 -0
- package/scripts/dev_rules.py +25 -0
- package/scripts/yotta_dev_mcp.py +430 -0
- package/server.json +20 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.1.1 (2026-09-25)
|
|
4
|
+
|
|
5
|
+
- 品牌改名:对外显示名统一为「元开(yotta-dev-mcp)」,不再把功能描述「开发能力 MCP」当产品名。
|
|
6
|
+
- 功能与 12 个工具保持不变;协议、参数、输出与 0.1.0 兼容。
|
|
7
|
+
|
|
8
|
+
## v0.1.0 (2026-09-25)
|
|
9
|
+
|
|
10
|
+
- 首个本地候选:MCP 双时代协议内核(2026-07-28 modern + 2025-11-25 legacy)。
|
|
11
|
+
- 十二个确定性工具:`repo_map` / `find_code` / `compress_output` /
|
|
12
|
+
`review_code` / `review_diff` / `mcp_doctor` / `scan_secrets` /
|
|
13
|
+
`scan_dependencies` / `check_publish_readiness` / `run_checks` /
|
|
14
|
+
`scaffold_skill` / `workflow_state`。
|
|
15
|
+
- Python 3.8+ 标准库实现;离线默认运行;输出带证据、排序稳定。
|
|
16
|
+
- `run_checks` 默认关闭执行;`scaffold_skill` / `workflow_state` 默认只预览。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YottaMeta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<p align="center"><img src="assets/banner.png" alt="YuanKai banner" width="100%"></p>
|
|
2
|
+
<h1 align="center">YuanKai (yotta-dev-mcp)</h1>
|
|
3
|
+
<p align="center"><b>Language</b>: English · <a href="README.zh-CN.md">中文</a></p>
|
|
4
|
+
|
|
5
|
+
Deterministic local development tools exposed over a stdio MCP server.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
| Tool | Purpose |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `repo_map` | Map modules, imports and entrypoints in a repository. |
|
|
12
|
+
| `find_code` | Locate symbols and text with bounded results. |
|
|
13
|
+
| `compress_output` | Compress long logs while keeping errors and head/tail context. |
|
|
14
|
+
| `review_code` | Apply deterministic review rules with file, line and evidence. |
|
|
15
|
+
| `review_diff` | Review only added lines in a unified diff. |
|
|
16
|
+
| `mcp_doctor` | Inspect installed skills and MCP JSON configuration files. |
|
|
17
|
+
| `scan_secrets` | Scan for credentials and high-entropy tokens with redacted evidence. |
|
|
18
|
+
| `scan_dependencies` | Check manifests, lockfiles, insecure sources and typosquat suspicion. |
|
|
19
|
+
| `check_publish_readiness` | Check version alignment, release files and package metadata. |
|
|
20
|
+
| `run_checks` | Run whitelisted tests, lint or compile checks; execution is explicit. |
|
|
21
|
+
| `scaffold_skill` | Plan or create a minimal skill scaffold; dry-run by default. |
|
|
22
|
+
| `workflow_state` | Read `.workflow` and optionally append an explicit log entry. |
|
|
23
|
+
|
|
24
|
+
The first nine tools are read-only; `run_checks` requires `allow_execute=true`, and
|
|
25
|
+
`scaffold_skill` / `workflow_state` require `apply=true` before writing. Python 3.8+
|
|
26
|
+
standard library is sufficient; no network access is required.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
### Start the MCP server
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx -y @yottameta/yotta-dev-mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Install the skill payload
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx -y @yottameta/yotta-dev-mcp --agent codex
|
|
40
|
+
npx -y @yottameta/yotta-dev-mcp --dir <skill-directory>
|
|
41
|
+
npx -y @yottameta/yotta-dev-mcp --list
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The installer uses explicit targets. `--global` additionally requires `--yes`, and
|
|
45
|
+
`--dry-run` prints the target without writing.
|
|
46
|
+
|
|
47
|
+
Other installation methods:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/YottaMeta/yotta-dev-mcp.git <skill-directory>/yotta-dev-mcp
|
|
51
|
+
bash <skill-directory>/yotta-dev-mcp/install.sh --agent codex
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also use GitHub's **Download ZIP** action and unpack the archive into the
|
|
55
|
+
skill directory.
|
|
56
|
+
|
|
57
|
+
## Direct CLI
|
|
58
|
+
|
|
59
|
+
The engine can also be used without MCP:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python scripts/dev_engine.py repo-map .
|
|
63
|
+
python scripts/dev_engine.py find-code . "helper"
|
|
64
|
+
python scripts/dev_engine.py review-code .
|
|
65
|
+
python scripts/dev_engine.py mcp-doctor
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Boundaries
|
|
69
|
+
|
|
70
|
+
- No code execution, no automatic edits, no commits.
|
|
71
|
+
- No network access, no package-existence lookup.
|
|
72
|
+
- Static deterministic findings only; human review remains the final decision.
|
|
73
|
+
|
|
74
|
+
## Current version
|
|
75
|
+
|
|
76
|
+
`0.1.0` ships the protocol core and twelve deterministic tools.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<p align="center"><img src="assets/banner.png" alt="元开 banner" width="100%"></p>
|
|
2
|
+
<h1 align="center">元开(yotta-dev-mcp)</h1>
|
|
3
|
+
<p align="center"><b>Language</b>: <a href="README.md">English</a> · 中文</p>
|
|
4
|
+
|
|
5
|
+
把本地、确定性的开发工具做成 stdio MCP server,任何支持 MCP 的客户端接上即可使用。
|
|
6
|
+
|
|
7
|
+
## 能做什么
|
|
8
|
+
|
|
9
|
+
| 工具 | 用途 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `repo_map` | 代码库模块、导入关系与入口点地图。 |
|
|
12
|
+
| `find_code` | 符号与文本定位,结果有数量上限。 |
|
|
13
|
+
| `compress_output` | 压缩长日志,保留错误、错误栈和首尾上下文。 |
|
|
14
|
+
| `review_code` | 规则化代码评审,输出文件、行号、证据与建议。 |
|
|
15
|
+
| `review_diff` | 只评审 unified diff 的新增行。 |
|
|
16
|
+
| `mcp_doctor` | 只读检查技能目录与 MCP JSON 配置。 |
|
|
17
|
+
| `scan_secrets` | 密钥 / 凭据 / 高熵令牌扫描,证据强制脱敏。 |
|
|
18
|
+
| `scan_dependencies` | 依赖清单、lockfile、来源与 typosquat 启发式检查。 |
|
|
19
|
+
| `check_publish_readiness` | 版本对齐、发布文件与包元数据检查。 |
|
|
20
|
+
| `run_checks` | 运行白名单测试 / lint / compile,执行必须显式开启。 |
|
|
21
|
+
| `scaffold_skill` | 规划或生成最小技能脚手架,默认 dry-run。 |
|
|
22
|
+
| `workflow_state` | 读取 `.workflow`,可选显式追加快照日志。 |
|
|
23
|
+
|
|
24
|
+
前九个工具只读;`run_checks` 必须显式 `allow_execute=true`,`scaffold_skill` /
|
|
25
|
+
`workflow_state` 必须显式 `apply=true` 才写入。核心只用 Python 3.8+ 标准库,默认不联网。
|
|
26
|
+
|
|
27
|
+
## 安装
|
|
28
|
+
|
|
29
|
+
### 启动 MCP server
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx -y @yottameta/yotta-dev-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 安装技能载荷
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx -y @yottameta/yotta-dev-mcp --agent codex
|
|
39
|
+
npx -y @yottameta/yotta-dev-mcp --dir <技能目录>
|
|
40
|
+
npx -y @yottameta/yotta-dev-mcp --list
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
安装器只写入显式目标。`--global` 必须同时给 `--yes`;`--dry-run` 只预览不写入。
|
|
44
|
+
|
|
45
|
+
其他安装方式:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/YottaMeta/yotta-dev-mcp.git <技能目录>/yotta-dev-mcp
|
|
49
|
+
bash <技能目录>/yotta-dev-mcp/install.sh --agent codex
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
也可以使用 GitHub 的 **Download ZIP**,解压到技能目录。
|
|
53
|
+
|
|
54
|
+
## 直接使用 CLI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python scripts/dev_engine.py repo-map .
|
|
58
|
+
python scripts/dev_engine.py find-code . "helper"
|
|
59
|
+
python scripts/dev_engine.py review-code .
|
|
60
|
+
python scripts/dev_engine.py mcp-doctor
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 边界
|
|
64
|
+
|
|
65
|
+
- 不执行代码、不自动改文件、不自动提交。
|
|
66
|
+
- 不联网,不查询公共仓库中包是否存在。
|
|
67
|
+
- 仅做确定性静态判断,最终评审由人负责。
|
|
68
|
+
|
|
69
|
+
## 当前版本
|
|
70
|
+
|
|
71
|
+
`0.1.0` 提供协议内核与十二个确定性工具。
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yotta-dev-mcp
|
|
3
|
+
description: 元开(yotta-dev-mcp)—— 本地、确定性的开发工具 MCP,把只读默认的开发能力暴露为 stdio MCP server:repo_map / find_code / compress_output / review_code / review_diff / mcp_doctor / scan_secrets / scan_dependencies / check_publish_readiness / run_checks / scaffold_skill / workflow_state。触发:让 AI 在陌生项目里先做结构盘点、定位代码、评审改动、扫描密钥/依赖、检查发布就绪、运行白名单检查、生成脚手架或读取 .workflow 状态时;或用户说 元开 / 开发能力 MCP / yotta-dev-mcp / 代码库地图 / 代码评审 MCP 等。边界:Python 3.8+ 标准库、离线默认;除 run_checks(显式 allow_execute)与 scaffold_skill / workflow_state 的显式 apply 外均为只读;不上传源码、不自动修改、不提交、不联网查询包是否存在。
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 元开(yotta-dev-mcp)
|
|
9
|
+
|
|
10
|
+
元开(YuanKai)把一组本地、确定性的开发工具做成一个 stdio MCP server。任何支持 MCP 的客户端接上后,
|
|
11
|
+
都能在真实开发任务里调用这些工具;输出带文件、行号、规则和证据,便于直接进入修复清单。
|
|
12
|
+
|
|
13
|
+
## 何时使用
|
|
14
|
+
|
|
15
|
+
- 接手陌生项目:先 `repo_map` 看模块、依赖和入口,再 `find_code` 定位。
|
|
16
|
+
- 评审改动:`review_diff` 只看新增行;`review_code` 对文件或仓库做规则检查。
|
|
17
|
+
- 长日志 / 长命令输出:`compress_output` 保错误、错误栈和首尾上下文。
|
|
18
|
+
- 本机排查:`mcp_doctor` 只读检查技能目录和 MCP JSON 配置。
|
|
19
|
+
|
|
20
|
+
## MCP 接入
|
|
21
|
+
|
|
22
|
+
启动命令:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx -y @yottameta/yotta-dev-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
或直接用本地脚本:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python scripts/yotta_dev_mcp.py
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
自动接入说明:AI 首次协助配置时,必须先展示目标配置文件、完整配置片段和影响,
|
|
35
|
+
并获得用户明确同意后再写入 `mcpServers`。用户拒绝时不要写文件,直接提供上面的启动命令
|
|
36
|
+
让用户手动接入。
|
|
37
|
+
|
|
38
|
+
## 工具
|
|
39
|
+
|
|
40
|
+
| 工具 | 用途 | 写入 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `repo_map` | 模块、导入、入口点地图 | 否 |
|
|
43
|
+
| `find_code` | 符号 / 文本定位,结果有上限 | 否 |
|
|
44
|
+
| `compress_output` | 保留错误与首尾的长输出压缩 | 否 |
|
|
45
|
+
| `review_code` | 规则化代码评审,带行号与建议 | 否 |
|
|
46
|
+
| `review_diff` | 只评审 diff 的新增行 | 否 |
|
|
47
|
+
| `mcp_doctor` | 技能版本与 MCP JSON 配置体检 | 否 |
|
|
48
|
+
| `scan_secrets` | 密钥 / 凭据 / 高熵令牌扫描(强制脱敏) | 否 |
|
|
49
|
+
| `scan_dependencies` | 依赖清单、lockfile、来源与 typosquat 启发式检查 | 否 |
|
|
50
|
+
| `check_publish_readiness` | 版本四件、发布文件、仓库与 publishConfig 检查 | 否 |
|
|
51
|
+
| `run_checks` | 白名单测试 / lint / compile 并返回结构化摘要 | 仅显式 allow_execute |
|
|
52
|
+
| `scaffold_skill` | 生成最小技能脚手架,默认 dry-run | 仅显式 apply |
|
|
53
|
+
| `workflow_state` | 读取 `.workflow`,可选显式追加日志 | 仅显式 apply |
|
|
54
|
+
|
|
55
|
+
详细契约见 `references/tools.md`。
|
|
56
|
+
|
|
57
|
+
## 边界
|
|
58
|
+
|
|
59
|
+
- `run_checks` 是唯一会执行项目代码的工具,默认关闭,必须显式 `allow_execute=true`;只运行白名单检查。
|
|
60
|
+
- `scaffold_skill` / `workflow_state` 默认只预览,显式 `apply=true` 才写入;写入前做原子替换并保留 `.bak`。
|
|
61
|
+
- 不联网,不查询包是否存在于公共仓库。
|
|
62
|
+
- 不读取或修改 YottaCode 仓库。
|
|
63
|
+
- 结论是确定性静态判断,不替代人工评审与最终决策。
|
|
64
|
+
|
|
65
|
+
## 当前版本
|
|
66
|
+
|
|
67
|
+
- v0.1.1:品牌显示名统一为「元开」;功能与 12 个工具不变。
|
|
Binary file
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* yotta-dev-mcp installer.
|
|
4
|
+
*
|
|
5
|
+
* Safe defaults:
|
|
6
|
+
* --agent <name> install to one agent's user-level skill directory
|
|
7
|
+
* --dir <path> install to an explicit skill directory
|
|
8
|
+
* --list print the supported agent directory map
|
|
9
|
+
* --global install to all known user-level directories, requires --yes
|
|
10
|
+
* --dry-run print the target without writing
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const os = require('os');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
|
|
17
|
+
const SKILL_NAME = 'yotta-dev-mcp';
|
|
18
|
+
const PKG_ROOT = path.join(__dirname, '..');
|
|
19
|
+
const AGENT_DIRS = {
|
|
20
|
+
claude: { label: 'Claude Code', dirs: ['.claude/skills'] },
|
|
21
|
+
cursor: { label: 'Cursor', dirs: ['.cursor/skills', '.agents/skills'] },
|
|
22
|
+
codex: { label: 'Codex', dirs: ['.codex/skills'] },
|
|
23
|
+
gemini: { label: 'Gemini CLI', dirs: ['.gemini/skills', '.agents/skills'] },
|
|
24
|
+
goose: { label: 'Goose', dirs: ['.config/goose/skills', '.agents/skills'] },
|
|
25
|
+
amp: { label: 'Amp', dirs: ['.config/agents/skills', '.agents/skills'] },
|
|
26
|
+
opencode: { label: 'OpenCode', dirs: ['.config/opencode/skills'] },
|
|
27
|
+
windsurf: { label: 'Windsurf', dirs: ['.codeium/windsurf/skills'] },
|
|
28
|
+
workbuddy: { label: 'WorkBuddy', dirs: ['.workbuddy/skills'] },
|
|
29
|
+
kiro: { label: 'Kiro', dirs: ['.kiro/skills'] },
|
|
30
|
+
trae: { label: 'Trae Code CLI', dirs: ['.traecli/skills'] },
|
|
31
|
+
'trae-cn': { label: 'Trae IDE', dirs: ['.trae-cn/skills'] },
|
|
32
|
+
qwen: { label: 'Qwen Code', dirs: ['.qwen/skills'] },
|
|
33
|
+
comate: { label: 'Comate', dirs: ['.comate/skills'] },
|
|
34
|
+
codebuddy: { label: 'CodeBuddy Code', dirs: ['.codebuddy/skills'] },
|
|
35
|
+
kimi: { label: 'Kimi Code CLI', dirs: ['.kimi/skills'] },
|
|
36
|
+
agents: { label: 'AGENTS.md', dirs: ['.agents/skills'] },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function codexUserDir() {
|
|
40
|
+
const base = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
|
|
41
|
+
return path.join(base, 'skills');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function opencodeUserDir() {
|
|
45
|
+
const base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
|
|
46
|
+
return path.join(base, 'opencode', 'skills');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resolveUserDir(rel) {
|
|
50
|
+
if (rel === '.codex/skills') return codexUserDir();
|
|
51
|
+
if (rel === '.config/opencode/skills') return opencodeUserDir();
|
|
52
|
+
return path.join(os.homedir(), rel);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function shouldSkip(name) {
|
|
56
|
+
return name === 'package.json' || name === 'bin' || name === 'node_modules' ||
|
|
57
|
+
name === '.git' || name === '__pycache__' || name.indexOf('test_') === 0 ||
|
|
58
|
+
name.endsWith('.pyc') || name.endsWith('.pyo');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function copyDir(source, target) {
|
|
62
|
+
fs.mkdirSync(target, { recursive: true });
|
|
63
|
+
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
|
|
64
|
+
if (shouldSkip(entry.name)) continue;
|
|
65
|
+
const sourcePath = path.join(source, entry.name);
|
|
66
|
+
const targetPath = path.join(target, entry.name);
|
|
67
|
+
if (entry.isDirectory()) {
|
|
68
|
+
copyDir(sourcePath, targetPath);
|
|
69
|
+
} else if (entry.isFile()) {
|
|
70
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function installTo(directory, dryRun) {
|
|
76
|
+
const target = path.join(directory, SKILL_NAME);
|
|
77
|
+
if (dryRun) {
|
|
78
|
+
console.log('[dry-run] install -> ' + target);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
copyDir(PKG_ROOT, target);
|
|
82
|
+
console.log('installed -> ' + target);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function displayDir(rel) {
|
|
86
|
+
if (process.platform === 'win32') return '%USERPROFILE%\\' + rel.replace(/\//g, '\\');
|
|
87
|
+
return '~/' + rel;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function main() {
|
|
91
|
+
const args = process.argv.slice(2);
|
|
92
|
+
const dryRun = args.indexOf('--dry-run') !== -1;
|
|
93
|
+
const yes = args.indexOf('--yes') !== -1 || args.indexOf('-y') !== -1;
|
|
94
|
+
const list = args.indexOf('--list') !== -1 || args.indexOf('-l') !== -1;
|
|
95
|
+
const global = args.indexOf('-g') !== -1 || args.indexOf('--global') !== -1;
|
|
96
|
+
const dirIndex = args.indexOf('--dir');
|
|
97
|
+
const agentIndex = args.indexOf('--agent');
|
|
98
|
+
const explicitDir = dirIndex !== -1 ? args[dirIndex + 1] : null;
|
|
99
|
+
const agent = agentIndex !== -1 ? String(args[agentIndex + 1]).toLowerCase() : null;
|
|
100
|
+
|
|
101
|
+
if (list) {
|
|
102
|
+
for (const [key, value] of Object.entries(AGENT_DIRS)) {
|
|
103
|
+
console.log(' ' + key.padEnd(10) + value.label.padEnd(18) +
|
|
104
|
+
value.dirs.map(displayDir).join(', '));
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (explicitDir) {
|
|
109
|
+
installTo(explicitDir, dryRun);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (agent) {
|
|
113
|
+
const info = AGENT_DIRS[agent];
|
|
114
|
+
if (!info) {
|
|
115
|
+
console.error('Unknown agent: ' + agent + '. Use --dir <path>.');
|
|
116
|
+
process.exitCode = 2;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
installTo(resolveUserDir(info.dirs[0]), dryRun);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (global) {
|
|
123
|
+
if (!yes) {
|
|
124
|
+
console.error('Refusing --global without --yes. Use --dry-run to preview.');
|
|
125
|
+
process.exitCode = 2;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const seen = new Set();
|
|
129
|
+
for (const value of Object.values(AGENT_DIRS)) {
|
|
130
|
+
for (const rel of value.dirs) {
|
|
131
|
+
if (seen.has(rel)) continue;
|
|
132
|
+
seen.add(rel);
|
|
133
|
+
installTo(resolveUserDir(rel), dryRun);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
console.error('Choose --agent <name>, --dir <path>, or --list. Use --global --yes explicitly.');
|
|
139
|
+
process.exitCode = 2;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
main();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* yotta-dev-mcp launcher.
|
|
4
|
+
*
|
|
5
|
+
* Default: start the stdio MCP server.
|
|
6
|
+
* Install flags: delegate to bin/install.js.
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
const { spawn, spawnSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const PKG_ROOT = path.join(__dirname, '..');
|
|
13
|
+
const SERVER = path.join(PKG_ROOT, 'scripts', 'yotta_dev_mcp.py');
|
|
14
|
+
const INSTALL_FLAGS = ['--agent', '--dir', '--list', '-l', '-g', '--global', '--dry-run', '--yes'];
|
|
15
|
+
|
|
16
|
+
function isInstallRequest(args) {
|
|
17
|
+
return args.some(function (item) {
|
|
18
|
+
if (INSTALL_FLAGS.indexOf(item) !== -1) return true;
|
|
19
|
+
return item.indexOf('--agent=') === 0 || item.indexOf('--dir=') === 0;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function findPython() {
|
|
24
|
+
const candidates = [];
|
|
25
|
+
if (process.env.YOTTA_MCP_PYTHON) candidates.push(process.env.YOTTA_MCP_PYTHON);
|
|
26
|
+
candidates.push('python3', 'python', 'py');
|
|
27
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
28
|
+
try {
|
|
29
|
+
const result = spawnSync(candidates[i], ['--version'], { encoding: 'utf8', timeout: 5000 });
|
|
30
|
+
if (result.status === 0) return candidates[i];
|
|
31
|
+
} catch (error) {
|
|
32
|
+
// Try the next candidate.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return 'python';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function main() {
|
|
39
|
+
const args = process.argv.slice(2);
|
|
40
|
+
if (args.indexOf('--version') !== -1 || args.indexOf('-v') !== -1) {
|
|
41
|
+
process.stdout.write(require(path.join(PKG_ROOT, 'package.json')).version + '\n');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (isInstallRequest(args)) {
|
|
45
|
+
require(path.join(__dirname, 'install.js'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const python = findPython();
|
|
49
|
+
const child = spawn(python, [SERVER].concat(args), { stdio: 'inherit' });
|
|
50
|
+
child.on('exit', function (code) { process.exit(code || 0); });
|
|
51
|
+
child.on('error', function (error) {
|
|
52
|
+
process.stderr.write('yotta-dev-mcp: cannot start Python MCP server: ' + error.message + '\n');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main();
|
package/install.sh
ADDED
package/package.json
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yottameta/yotta-dev-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "YuanKai (yotta-dev-mcp) - deterministic local development tools exposed over stdio MCP: repo_map, find_code, compress_output, review_code, review_diff, mcp_doctor, scan_secrets, scan_dependencies, check_publish_readiness, run_checks, scaffold_skill and workflow_state. Python 3.8+ standard library, offline by default; writes and command execution require explicit flags.",
|
|
11
5
|
"license": "MIT",
|
|
12
|
-
"
|
|
6
|
+
"keywords": [
|
|
7
|
+
"agent-skills",
|
|
8
|
+
"yottaskills",
|
|
9
|
+
"mcp",
|
|
10
|
+
"developer-tools",
|
|
11
|
+
"code-review"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"SKILL.md",
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"NOTICE",
|
|
17
|
+
"README.md",
|
|
18
|
+
"README.zh-CN.md",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"install.sh",
|
|
21
|
+
"server.json",
|
|
22
|
+
"references",
|
|
23
|
+
"scripts",
|
|
24
|
+
"assets",
|
|
25
|
+
"bin",
|
|
26
|
+
"!scripts/test_*.py",
|
|
27
|
+
"!**/__pycache__",
|
|
28
|
+
"!**/*.pyc",
|
|
29
|
+
"!**/*.pyo"
|
|
30
|
+
],
|
|
13
31
|
"repository": {
|
|
32
|
+
"type": "git",
|
|
14
33
|
"url": "git+https://github.com/YottaMeta/yotta-dev-mcp.git"
|
|
15
34
|
},
|
|
16
35
|
"publishConfig": {
|
|
17
36
|
"access": "public"
|
|
18
37
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
38
|
+
"bin": {
|
|
39
|
+
"yotta-dev-mcp": "bin/yotta-dev-mcp.js",
|
|
40
|
+
"yotta-dev-mcp-install": "bin/install.js"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "python scripts/test_dev_engine.py && python scripts/test_yotta_dev_mcp.py"
|
|
21
44
|
},
|
|
22
|
-
"
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
}
|
|
23
48
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Tool contracts
|
|
2
|
+
|
|
3
|
+
All tools are local, deterministic and read-only in v0.1.0.
|
|
4
|
+
|
|
5
|
+
## repo_map
|
|
6
|
+
|
|
7
|
+
Input:
|
|
8
|
+
|
|
9
|
+
- `path` (required): repository or source directory.
|
|
10
|
+
- `max_files` (optional, default 2000): source file limit.
|
|
11
|
+
|
|
12
|
+
Output: `root`, `modules`, `imports`, `entrypoints`, `truncated`.
|
|
13
|
+
|
|
14
|
+
## find_code
|
|
15
|
+
|
|
16
|
+
Input:
|
|
17
|
+
|
|
18
|
+
- `path` (required): repository, directory or file.
|
|
19
|
+
- `query` (required): symbol or text.
|
|
20
|
+
- `extensions` (optional): file extensions such as `.py`.
|
|
21
|
+
- `max_results` (optional, default 100).
|
|
22
|
+
- `context_lines` (optional, 0-5).
|
|
23
|
+
|
|
24
|
+
Output: `query`, `matches` (`path`, `line`, `kind`, `text`, `context`), `truncated`.
|
|
25
|
+
|
|
26
|
+
## compress_output
|
|
27
|
+
|
|
28
|
+
Input:
|
|
29
|
+
|
|
30
|
+
- `text` or `file` (one required).
|
|
31
|
+
- `max_chars` (optional, default 4000).
|
|
32
|
+
- `head_lines` / `tail_lines` (optional).
|
|
33
|
+
|
|
34
|
+
Output: text plus `original_lines`, `kept_lines`, `error_lines`, `truncated`.
|
|
35
|
+
|
|
36
|
+
## review_code
|
|
37
|
+
|
|
38
|
+
Input:
|
|
39
|
+
|
|
40
|
+
- `path` or `text` (one required).
|
|
41
|
+
- `max_findings` (optional, default 200).
|
|
42
|
+
|
|
43
|
+
Rules: bare-except, eval-exec, shell-true, debug-print, todo-comment,
|
|
44
|
+
mutable-default.
|
|
45
|
+
|
|
46
|
+
Each finding contains `path`, `line`, `rule`, `severity`, `evidence`, `suggestion`.
|
|
47
|
+
|
|
48
|
+
## review_diff
|
|
49
|
+
|
|
50
|
+
Input:
|
|
51
|
+
|
|
52
|
+
- `diff_text` or `path` (one required).
|
|
53
|
+
- `base` (optional git revision when `path` is used).
|
|
54
|
+
- `max_findings` (optional).
|
|
55
|
+
|
|
56
|
+
Only added lines are reviewed. Output: `files`, `findings`, `truncated`.
|
|
57
|
+
|
|
58
|
+
## mcp_doctor
|
|
59
|
+
|
|
60
|
+
Input:
|
|
61
|
+
|
|
62
|
+
- `skills_dirs` (optional array).
|
|
63
|
+
- `config_paths` (optional array).
|
|
64
|
+
|
|
65
|
+
Output: `skills`, `mcp_configs`, `issues`, `checked_skills`, `checked_configs`.
|
|
66
|
+
|
|
67
|
+
## scan_secrets
|
|
68
|
+
|
|
69
|
+
Input: `path` or `text`, optional `max_findings`, optional `include_git_history`
|
|
70
|
+
(bounded, default false).
|
|
71
|
+
|
|
72
|
+
Output: `findings` with `path`, `line`, `rule`, `severity`, redacted `evidence`,
|
|
73
|
+
`suggestion`; `truncated`.
|
|
74
|
+
|
|
75
|
+
## scan_dependencies
|
|
76
|
+
|
|
77
|
+
Input: `path`.
|
|
78
|
+
|
|
79
|
+
Output: `manifests`, `lockfiles`, `issues` (`missing-lockfile`,
|
|
80
|
+
`unpinned-dependency`, `insecure-source`, `local-dependency`,
|
|
81
|
+
`typosquat-suspicion`), and counts. Offline heuristics only.
|
|
82
|
+
|
|
83
|
+
## check_publish_readiness
|
|
84
|
+
|
|
85
|
+
Input: `path`.
|
|
86
|
+
|
|
87
|
+
Output: `ok`, `files`, `versions` (package / skill / changelog / engine when
|
|
88
|
+
present), `issues`.
|
|
89
|
+
|
|
90
|
+
## run_checks
|
|
91
|
+
|
|
92
|
+
Input: `kind` (`python-unittest` / `pytest` / `python-compile` / `npm-test` /
|
|
93
|
+
`npm-lint`), `cwd`, optional `timeout`, explicit `allow_execute=true`.
|
|
94
|
+
|
|
95
|
+
Output: `exit_code`, `passed`, bounded `summary`, compressed `output`,
|
|
96
|
+
`timed_out`.
|
|
97
|
+
|
|
98
|
+
## scaffold_skill
|
|
99
|
+
|
|
100
|
+
Input: `name`, `output_dir`, optional `description`, explicit `apply=true`.
|
|
101
|
+
|
|
102
|
+
Output: `target`, `files`, `applied`. Default is dry-run; existing non-empty
|
|
103
|
+
targets are rejected.
|
|
104
|
+
|
|
105
|
+
## workflow_state
|
|
106
|
+
|
|
107
|
+
Input: `root`, `action` (`read` / `append-log` / `append-file`), optional
|
|
108
|
+
`date`, `text`, `file`, explicit `apply=true`.
|
|
109
|
+
|
|
110
|
+
Output: `ok`, `files`, `missing`, `excerpts` for read; `target`, `applied`,
|
|
111
|
+
`preview` for writes. Writes are atomic and keep a `.bak` of an existing file.
|