@kanchingyg/repomcp 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +114 -2
- package/SKILL.md +10 -0
- package/dist/adapters/api-routes.d.ts +31 -0
- package/dist/adapters/api-routes.d.ts.map +1 -0
- package/dist/adapters/api-routes.js +680 -0
- package/dist/adapters/api-routes.js.map +1 -0
- package/dist/adapters/cli-crawler.d.ts +28 -0
- package/dist/adapters/cli-crawler.d.ts.map +1 -0
- package/dist/adapters/cli-crawler.js +467 -0
- package/dist/adapters/cli-crawler.js.map +1 -0
- package/dist/adapters/data-sources.d.ts +6 -0
- package/dist/adapters/data-sources.d.ts.map +1 -0
- package/dist/adapters/data-sources.js +672 -0
- package/dist/adapters/data-sources.js.map +1 -0
- package/dist/adapters/docs-bm25.d.ts +50 -0
- package/dist/adapters/docs-bm25.d.ts.map +1 -0
- package/dist/adapters/docs-bm25.js +484 -0
- package/dist/adapters/docs-bm25.js.map +1 -0
- package/dist/adapters/index.d.ts +18 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +66 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/polyglot-code.d.ts +65 -0
- package/dist/adapters/polyglot-code.d.ts.map +1 -0
- package/dist/adapters/polyglot-code.js +691 -0
- package/dist/adapters/polyglot-code.js.map +1 -0
- package/dist/adapters/remote-target.d.ts +30 -0
- package/dist/adapters/remote-target.d.ts.map +1 -0
- package/dist/adapters/remote-target.js +559 -0
- package/dist/adapters/remote-target.js.map +1 -0
- package/dist/adapters/task-runners.d.ts +8 -0
- package/dist/adapters/task-runners.d.ts.map +1 -0
- package/dist/adapters/task-runners.js +468 -0
- package/dist/adapters/task-runners.js.map +1 -0
- package/dist/adapters/types.d.ts +9 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +21 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/bridge.d.ts +136 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +488 -0
- package/dist/bridge.js.map +1 -0
- package/dist/checkpoints.d.ts +41 -0
- package/dist/checkpoints.d.ts.map +1 -0
- package/dist/checkpoints.js +208 -0
- package/dist/checkpoints.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +124 -0
- package/dist/cli.js.map +1 -0
- package/dist/dirty-parser.d.ts +10 -0
- package/dist/dirty-parser.d.ts.map +1 -0
- package/dist/dirty-parser.js +220 -0
- package/dist/dirty-parser.js.map +1 -0
- package/dist/harnesses.d.ts +74 -0
- package/dist/harnesses.d.ts.map +1 -0
- package/dist/harnesses.js +204 -0
- package/dist/harnesses.js.map +1 -0
- package/dist/introspect.d.ts +18 -0
- package/dist/introspect.d.ts.map +1 -0
- package/dist/introspect.js +125 -0
- package/dist/introspect.js.map +1 -0
- package/dist/path-containment.d.ts +2 -0
- package/dist/path-containment.d.ts.map +1 -0
- package/dist/path-containment.js +20 -0
- package/dist/path-containment.js.map +1 -0
- package/dist/providers.d.ts +17 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +127 -0
- package/dist/providers.js.map +1 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/jsr.json +24 -0
- package/package.json +57 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Augusto Cerrutti
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,115 @@
|
|
|
1
|
-
#
|
|
1
|
+
# repomcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/kanchingyg/repomcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@kanchingyg/repomcp)
|
|
5
|
+
[](https://jsr.io/@kanchingyg/repomcp)
|
|
6
|
+
[](https://jsr.io/@kanchingyg/repomcp/score)
|
|
7
|
+
[](https://github.com/kanchingyg/repomcp)
|
|
8
|
+
[](https://github.com/kanchingyg/repomcp/blob/HEAD/LICENSE)
|
|
9
|
+
|
|
10
|
+
Universal repo-to-MCP bridge: introspect a repository, expose guarded MCP tools over stdio, generate multi-harness configs (Pi, OMP, Hermes, cc-switch, Claude Code, Kilo Code, Roo Code, Cursor, Cline, OpenCode), normalize embeddings for code indexers, and adapt tool-calling for Chinese providers and raw local checkpoints.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
[Bun](https://bun.sh) / [npm](https://www.npmjs.com/package/@kanchingyg/repomcp):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bunx @kanchingyg/repomcp init --target all
|
|
18
|
+
npx @kanchingyg/repomcp init --target all
|
|
19
|
+
|
|
20
|
+
# or install in your project / globally
|
|
21
|
+
bun add -d @kanchingyg/repomcp
|
|
22
|
+
npm i -D @kanchingyg/repomcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
[JSR](https://jsr.io/@kanchingyg/repomcp):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bunx jsr add @kanchingyg/repomcp
|
|
29
|
+
npx jsr add @kanchingyg/repomcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bunx @kanchingyg/repomcp init --target all
|
|
36
|
+
npx @kanchingyg/repomcp --mcp
|
|
37
|
+
npx @kanchingyg/repomcp embed --port 11435
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
+--------+ +-------------+ +------------------+
|
|
44
|
+
| repo |--->| introspect |--->| MCP tools (stdio)|
|
|
45
|
+
+--------+ +-------------+ +------------------+
|
|
46
|
+
| | |
|
|
47
|
+
v v v
|
|
48
|
+
+--------+ +-------------+ +------------------+
|
|
49
|
+
| harness| | dirty-parser| | embed normalizer |
|
|
50
|
+
| configs| | checkpoints | | (Kilo/Roo dims) |
|
|
51
|
+
+--------+ +-------------+ +------------------+
|
|
52
|
+
| | |
|
|
53
|
+
v v v
|
|
54
|
+
Pi OMP Hermes Chinese providers LanceDB/Qdrant
|
|
55
|
+
Cursor Kilo raw checkpoint EOS
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Flags
|
|
59
|
+
|
|
60
|
+
| Flag | Purpose |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `--mcp` | Run stdio MCP server (stdout JSON-RPC guard enabled) |
|
|
63
|
+
| `--allow-write` | Enable mutating tools (read-only by default) |
|
|
64
|
+
| `--dry-run` | Simulate tool calls without side effects |
|
|
65
|
+
|
|
66
|
+
## Programmatic API
|
|
67
|
+
|
|
68
|
+
The package exports the runtime from `repomcp`, `repomcp/bridge`, and `repomcp/runtime` (also available on JSR as `@kanchingyg/repomcp`): MCP server, harness generators, provider/checkpoint helpers, dirty tool-call parser, and embedding normalizer.
|
|
69
|
+
|
|
70
|
+
## MCP Tools Reference
|
|
71
|
+
|
|
72
|
+
| Tool | Mutates | Description |
|
|
73
|
+
| --- | --- | --- |
|
|
74
|
+
| `repo_status` | `false` | Inspect repository git status, tracked languages, and detected scripts. |
|
|
75
|
+
| `run_script` | `true` | Run a package.json, Cargo, or Makefile script inside the workspace (requires `--allow-write`). |
|
|
76
|
+
| `search_code` | `false` | Search repository source files with context-window budget truncation. |
|
|
77
|
+
|
|
78
|
+
## Editor and Agent Integration
|
|
79
|
+
|
|
80
|
+
### Cursor (`.cursor/mcp.json`)
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"repomcp": {
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["-y", "@kanchingyg/repomcp", "--mcp"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Claude Code CLI
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
claude mcp add repomcp -- npx -y @kanchingyg/repomcp --mcp
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Programmatic Usage (JSR / TypeScript)
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import * as bridge from "jsr:@kanchingyg/repomcp/bridge";
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Runtime Safety and Guardrails
|
|
106
|
+
|
|
107
|
+
- **Stdio frame isolation**: When `--mcp` is active, `hijackStdoutForMcp()` redirects accidental `console.log` calls to `stderr` so JSON-RPC 2.0 frames on `stdout` never corrupt.
|
|
108
|
+
- **Read-only by default**: Mutating tools (`mutates: true`) are blocked in `--dry-run` mode and require explicit `--allow-write` authorization.
|
|
109
|
+
- **Loop breaker**: Repeated identical `(toolName, args)` invocations are hashed with SHA-256 and halted after 3 consecutive repeats to prevent runaway agent loops.
|
|
110
|
+
- **Context budget truncation**: Tool outputs are middle-truncated (`60%` head / `40%` tail) scaled to the probed local model `n_ctx` (Ollama `/api/show`, llama.cpp `/props`, vLLM `/v1/models`).
|
|
111
|
+
- **Secret redaction and path normalization**: AWS keys (`AKIA*`, `ASIA*`), bearer tokens, and `sk-*` keys are scrubbed before returning tool output, and Windows drive paths (`C:\...`) translate cleanly to `/mnt/c/...` when WSL mode is enabled.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
[MIT](./LICENSE)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repomcp
|
|
3
|
+
description: Turn any repo into MCP tools with multi-harness configs and model bridges.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# repomcp
|
|
7
|
+
|
|
8
|
+
Use `npx @kanchingyg/repomcp init` to generate orchestrator-specific MCP and skill files, then run `npx @kanchingyg/repomcp --mcp` for the stdio server.
|
|
9
|
+
|
|
10
|
+
For Kilo Code / Roo Code indexing issues (batch limits, dimensions, base64), run `npx @kanchingyg/repomcp embed --port 11435` and point the indexer at `http://127.0.0.1:11435/v1`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AdapterDiscovery } from "./types.js";
|
|
2
|
+
export type RequestDescriptor = {
|
|
3
|
+
method: string;
|
|
4
|
+
path: string;
|
|
5
|
+
body?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ApiToolResult = {
|
|
8
|
+
request: RequestDescriptor;
|
|
9
|
+
planned?: boolean;
|
|
10
|
+
status?: number;
|
|
11
|
+
responseBody?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ApiRouteEntry = {
|
|
14
|
+
name: string;
|
|
15
|
+
method: string;
|
|
16
|
+
path: string;
|
|
17
|
+
source: "openapi" | "graphql" | "static" | "wrangler";
|
|
18
|
+
mutates: boolean;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
export type ApiDiscoverySummary = {
|
|
22
|
+
routeCount: number;
|
|
23
|
+
bySource: Record<string, number>;
|
|
24
|
+
byMethod: Record<string, number>;
|
|
25
|
+
routes: ApiRouteEntry[];
|
|
26
|
+
};
|
|
27
|
+
export declare function summarizeApiDiscovery(discovery: AdapterDiscovery): ApiDiscoverySummary;
|
|
28
|
+
export declare function discoverApiRoutes(repoRoot: string, opts?: {
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
}): Promise<AdapterDiscovery>;
|
|
31
|
+
//# sourceMappingURL=api-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-routes.d.ts","sourceRoot":"","sources":["../../src/adapters/api-routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,YAAY,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB,CAAC;AAiuBF,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,gBAAgB,GAAG,mBAAmB,CAuCtF;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAiB3B"}
|