@harivatsa/sirius-mcp-proxy 0.1.0 → 0.1.2
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 +6 -0
- package/dist/index.js +40 -5
- package/dist/validation.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@ npm install -g @harivatsa/sirius-mcp-proxy
|
|
|
10
10
|
|
|
11
11
|
Point Claude at `sirius-mcp-proxy` after configuring the Sirius index URL, repo-agent URL, and token environment variables described in the root README.
|
|
12
12
|
|
|
13
|
+
Use `index_repo` from Claude/MCP to register a local repo path with the always-on repo-agent and start
|
|
14
|
+
indexing. Use `list_local_repos` to inspect repos known to the local agent. After that,
|
|
15
|
+
`semantic_code_search`, `hybrid_search`, `symbol_search`, `get_call_chain`, `impact_analysis`,
|
|
16
|
+
`ripgrep_search`, `sync_repo`, and `sync_status` operate through the repo-agent and index server.
|
|
17
|
+
Pass `reset=true` to `index_repo` or `sync_repo` when you need to purge and rebuild a polluted index.
|
|
18
|
+
|
|
13
19
|
Snippet enrichment is bounded by `SIRIUS_MCP_ENRICH_CONCURRENCY`, which defaults to `16` and caps at `50`, matching the MCP tool `top_k` limit. Normal `top_k <= 16` searches fetch snippets in one wave; larger windows avoid unbounded local file-range fan-out.
|
|
14
20
|
|
|
15
21
|
`semantic_code_search`, `hybrid_search`, `symbol_search`, `get_call_chain`, and `impact_analysis` compare indexed file hashes with local snippet hashes when `include_code=true`. With `auto_sync_stale=true`, stale snippets trigger one local repo-agent sync and then rerun the lookup.
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { enrichGraphNodes, enrichSearchResults, enrichSymbols } from "./enrich.j
|
|
|
6
6
|
import { agentGet, agentPost, indexDelete, indexGet, indexPost } from "./http.js";
|
|
7
7
|
import { impactAnalysisWithOptionalStaleSync } from "./impact.js";
|
|
8
8
|
import { hasStaleSnippet, searchWithOptionalStaleSync } from "./search.js";
|
|
9
|
-
import { localFilePathSchema, publicRepoIdSchema } from "./validation.js";
|
|
9
|
+
import { localFilePathSchema, localRepoPathSchema, publicRepoIdSchema } from "./validation.js";
|
|
10
10
|
// General rule: package-installed CLIs need a no-session self-check path for install validation.
|
|
11
|
-
const MCP_PROXY_VERSION = "0.1.
|
|
11
|
+
const MCP_PROXY_VERSION = "0.1.2";
|
|
12
12
|
// General rule: expanded call graphs can include many nodes, while source snippets dominate MCP payload size.
|
|
13
13
|
const DEFAULT_CALL_CHAIN_CODE_NODE_LIMIT = 50;
|
|
14
14
|
// General rule: graph snippet enrichment should stay bounded by the largest accepted call-chain graph window.
|
|
@@ -24,6 +24,40 @@ const server = new McpServer({
|
|
|
24
24
|
name: "sirius-mcp",
|
|
25
25
|
version: MCP_PROXY_VERSION
|
|
26
26
|
});
|
|
27
|
+
server.registerTool("index_repo", {
|
|
28
|
+
title: "Index Repo",
|
|
29
|
+
description: "Register a local repository with the repo agent and start indexing it on the Sirius server.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
repo_path: localRepoPathSchema,
|
|
32
|
+
repo_id: publicRepoIdSchema.optional(),
|
|
33
|
+
share_mode: z.enum(["personal", "group"]).default("personal"),
|
|
34
|
+
remote: z.string().min(1).default("origin"),
|
|
35
|
+
shared_ref: z.string().optional(),
|
|
36
|
+
sync: z.boolean().default(true),
|
|
37
|
+
full: z.boolean().default(false),
|
|
38
|
+
reset: z.boolean().default(false)
|
|
39
|
+
}
|
|
40
|
+
}, async ({ repo_path, repo_id, share_mode, remote, shared_ref, sync, full, reset }) => {
|
|
41
|
+
const response = await agentPost("/repos/register", {
|
|
42
|
+
repo_path,
|
|
43
|
+
repo_id,
|
|
44
|
+
share_mode,
|
|
45
|
+
remote,
|
|
46
|
+
shared_ref,
|
|
47
|
+
sync,
|
|
48
|
+
full,
|
|
49
|
+
reset
|
|
50
|
+
});
|
|
51
|
+
return asJson(response);
|
|
52
|
+
});
|
|
53
|
+
server.registerTool("list_local_repos", {
|
|
54
|
+
title: "List Local Repos",
|
|
55
|
+
description: "List repositories registered with the local Sirius repo agent.",
|
|
56
|
+
inputSchema: {}
|
|
57
|
+
}, async () => {
|
|
58
|
+
const response = await agentGet("/repos");
|
|
59
|
+
return asJson(response);
|
|
60
|
+
});
|
|
27
61
|
server.registerTool("semantic_code_search", {
|
|
28
62
|
title: "Semantic Code Search",
|
|
29
63
|
description: "Find relevant code by meaning using the Sirius index, optionally returning local snippets.",
|
|
@@ -201,10 +235,11 @@ server.registerTool("sync_repo", {
|
|
|
201
235
|
description: "Trigger a manual incremental or full sync through the local repo agent.",
|
|
202
236
|
inputSchema: {
|
|
203
237
|
repo_id: publicRepoIdSchema,
|
|
204
|
-
full: z.boolean().default(false)
|
|
238
|
+
full: z.boolean().default(false),
|
|
239
|
+
reset: z.boolean().default(false)
|
|
205
240
|
}
|
|
206
|
-
}, async ({ repo_id, full }) => {
|
|
207
|
-
const response = await agentPost(`/repos/${encodeURIComponent(repo_id)}/sync`, { full });
|
|
241
|
+
}, async ({ repo_id, full, reset }) => {
|
|
242
|
+
const response = await agentPost(`/repos/${encodeURIComponent(repo_id)}/sync`, { full, reset });
|
|
208
243
|
return asJson(response);
|
|
209
244
|
});
|
|
210
245
|
server.registerTool("sync_status", {
|
package/dist/validation.js
CHANGED
|
@@ -3,10 +3,13 @@ import { z } from "zod";
|
|
|
3
3
|
const PUBLIC_REPO_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
4
4
|
// General rule: local file reads must use normalized repo-relative slash paths.
|
|
5
5
|
const WINDOWS_DRIVE_PATH_PATTERN = /^[A-Za-z]:/;
|
|
6
|
+
const WINDOWS_ABSOLUTE_PATH_PATTERN = /^[A-Za-z]:[\\/]/;
|
|
6
7
|
export const PUBLIC_REPO_ID_RULE = "use 1-128 ASCII letters, digits, dots, underscores, or hyphens, starting with a letter or digit";
|
|
7
8
|
export const LOCAL_FILE_PATH_RULE = "file_path must be a relative path inside the repo";
|
|
9
|
+
export const LOCAL_REPO_PATH_RULE = "repo_path must be an absolute local filesystem path";
|
|
8
10
|
export const publicRepoIdSchema = z.string().regex(PUBLIC_REPO_ID_PATTERN, PUBLIC_REPO_ID_RULE);
|
|
9
11
|
export const localFilePathSchema = z.string().refine(isSafeLocalFilePath, LOCAL_FILE_PATH_RULE);
|
|
12
|
+
export const localRepoPathSchema = z.string().min(1).refine(isAbsoluteLocalPath, LOCAL_REPO_PATH_RULE);
|
|
10
13
|
export function isSafeLocalFilePath(filePath) {
|
|
11
14
|
if (!filePath ||
|
|
12
15
|
filePath.includes("\0") ||
|
|
@@ -17,3 +20,6 @@ export function isSafeLocalFilePath(filePath) {
|
|
|
17
20
|
}
|
|
18
21
|
return filePath.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
|
|
19
22
|
}
|
|
23
|
+
export function isAbsoluteLocalPath(filePath) {
|
|
24
|
+
return filePath.startsWith("/") || WINDOWS_ABSOLUTE_PATH_PATTERN.test(filePath);
|
|
25
|
+
}
|