@zokizuan/satori-mcp 4.0.0 → 4.4.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.
Files changed (46) hide show
  1. package/README.md +56 -4
  2. package/assets/skills/satori-indexing/SKILL.md +36 -0
  3. package/assets/skills/satori-navigation/SKILL.md +36 -0
  4. package/assets/skills/satori-search/SKILL.md +36 -0
  5. package/dist/cli/args.d.ts +54 -0
  6. package/dist/cli/args.js +474 -0
  7. package/dist/cli/client.d.ts +26 -0
  8. package/dist/cli/client.js +99 -0
  9. package/dist/cli/errors.d.ts +7 -0
  10. package/dist/cli/errors.js +18 -0
  11. package/dist/cli/format.d.ts +15 -0
  12. package/dist/cli/format.js +100 -0
  13. package/dist/cli/index.d.ts +17 -0
  14. package/dist/cli/index.js +297 -0
  15. package/dist/cli/install.d.ts +30 -0
  16. package/dist/cli/install.js +327 -0
  17. package/dist/cli/resolve-server-entry.d.ts +2 -0
  18. package/dist/cli/resolve-server-entry.js +17 -0
  19. package/dist/core/call-graph.d.ts +6 -0
  20. package/dist/core/call-graph.js +34 -8
  21. package/dist/core/handlers.d.ts +56 -49
  22. package/dist/core/handlers.js +1362 -532
  23. package/dist/core/indexing-recovery.d.ts +17 -0
  24. package/dist/core/indexing-recovery.js +53 -0
  25. package/dist/core/manage-types.d.ts +27 -0
  26. package/dist/core/manage-types.js +2 -0
  27. package/dist/core/search-constants.d.ts +1 -0
  28. package/dist/core/search-constants.js +1 -0
  29. package/dist/core/search-types.d.ts +6 -3
  30. package/dist/core/snapshot.d.ts +39 -4
  31. package/dist/core/snapshot.js +535 -51
  32. package/dist/core/sync.d.ts +5 -1
  33. package/dist/core/sync.js +25 -6
  34. package/dist/core/warnings.d.ts +11 -0
  35. package/dist/core/warnings.js +12 -0
  36. package/dist/index.js +60 -218
  37. package/dist/server/start-server.d.ts +48 -0
  38. package/dist/server/start-server.js +233 -0
  39. package/dist/server/stdio-safety.d.ts +13 -0
  40. package/dist/server/stdio-safety.js +124 -0
  41. package/dist/tools/call_graph.js +1 -1
  42. package/dist/tools/list_codebases.js +136 -8
  43. package/dist/tools/manage_index.js +2 -1
  44. package/dist/tools/read_file.js +81 -0
  45. package/dist/utils.js +1 -1
  46. package/package.json +10 -6
package/README.md CHANGED
@@ -8,7 +8,7 @@ MCP server for Satori — agent-safe semantic code search and indexing.
8
8
  - Runtime-first `search_codebase` with explicit `scope`, `resultMode`, `groupBy`, and optional `debug` traces
9
9
  - Deterministic query-prefix operators in `search_codebase` (`lang:`, `path:`, `-path:`, `must:`, `exclude:`)
10
10
  - Default grouped-result diversity and auto changed-files ranking (`rankingMode="auto_changed_first"`)
11
- - First-class `call_graph` tool with deterministic node/edge sorting and TS/Python support
11
+ - First-class `call_graph` tool with deterministic node/edge sorting and capability-driven language support (currently TS/JS/Python)
12
12
  - Sidecar-backed `file_outline` tool for per-file symbol navigation and direct call_graph jump handles
13
13
  - Snapshot v3 safety with index fingerprints and strict `requires_reindex` access gates
14
14
  - Deterministic train-in-the-error responses for incompatible or legacy index states
@@ -63,13 +63,14 @@ Tool surface is hard-broken to 6 tools. This keeps routing explicit while exposi
63
63
 
64
64
  ### `manage_index`
65
65
 
66
- Manage index lifecycle operations (create/reindex/sync/status/clear) for a codebase path. Ignore-rule edits in repo-root .satoriignore/.gitignore reconcile automatically in the normal sync path. Use action="sync" for immediate convergence and action="reindex" for full rebuild recovery.
66
+ Manage index lifecycle operations (create/reindex/sync/status/clear) for a codebase path. Ignore-rule edits in repo-root .satoriignore/.gitignore reconcile automatically in the normal sync path. Use action="sync" for immediate convergence and action="reindex" for full rebuild recovery (preflight may block unnecessary ignore-only reindex churn unless allowUnnecessaryReindex=true).
67
67
 
68
68
  | Parameter | Type | Required | Default | Description |
69
69
  |---|---|---|---|---|
70
70
  | `action` | enum("create", "reindex", "sync", "status", "clear") | yes | | Required operation to run. |
71
71
  | `path` | string | yes | | ABSOLUTE path to the target codebase. |
72
72
  | `force` | boolean | no | | Only for action='create'. Force rebuild from scratch. |
73
+ | `allowUnnecessaryReindex` | boolean | no | | Only for action='reindex'. Override preflight block when reindex is detected as unnecessary ignore-only churn. |
73
74
  | `customExtensions` | array<string> | no | | Only for action='create'. Additional file extensions to include. |
74
75
  | `ignorePatterns` | array<string> | no | | Only for action='create'. Additional ignore patterns to apply. |
75
76
  | `zillizDropCollection` | string | no | | Only for action='create'. Zilliz-only: drop this Satori-managed collection before creating the new index. |
@@ -91,7 +92,7 @@ Unified semantic search with runtime-first defaults (start with scope="runtime")
91
92
 
92
93
  ### `call_graph`
93
94
 
94
- Traverse the prebuilt TS/JS/Python call graph sidecar for callers/callees/bidirectional symbol relationships.
95
+ Traverse the prebuilt call graph sidecar for callers/callees/bidirectional symbol relationships (language support follows the core callGraphQuery capability set; currently TS/JS/Python).
95
96
 
96
97
  | Parameter | Type | Required | Default | Description |
97
98
  |---|---|---|---|---|
@@ -188,7 +189,7 @@ env = { EMBEDDING_PROVIDER = "VoyageAI", EMBEDDING_MODEL = "voyage-4-large", EMB
188
189
  "mcpServers": {
189
190
  "satori": {
190
191
  "command": "node",
191
- "args": ["/absolute/path/to/claude-context/packages/mcp/dist/index.js"],
192
+ "args": ["/absolute/path/to/satori/packages/mcp/dist/index.js"],
192
193
  "timeout": 180000,
193
194
  "env": {
194
195
  "EMBEDDING_PROVIDER": "VoyageAI",
@@ -212,6 +213,57 @@ Never commit real API keys/tokens into repo config files.
212
213
  pnpm --filter @zokizuan/satori-mcp start
213
214
  ```
214
215
 
216
+ ## Shell CLI (`satori-cli`)
217
+
218
+ `@zokizuan/satori-mcp` also ships a shell-first client binary that works without an MCP adapter.
219
+
220
+ ### Commands
221
+
222
+ ```bash
223
+ satori-cli tools list
224
+ satori-cli tool call <toolName> --args-json '{"path":"/abs/repo","query":"auth"}'
225
+ satori-cli tool call <toolName> --args-file ./args.json
226
+ satori-cli tool call <toolName> --args-json @-
227
+ satori-cli <toolName> [schema-subset flags]
228
+ ```
229
+
230
+ Global flags (`--startup-timeout-ms`, `--call-timeout-ms`, `--format`, `--debug`) must appear before the command token.
231
+ Example: `satori-cli --debug tools list`.
232
+
233
+ ### Output + Exit Contract
234
+
235
+ - `stdout`: JSON only
236
+ - `stderr`: diagnostics and text summaries
237
+ - exit `0`: success
238
+ - exit `1`: tool-level error (`isError=true` or structured envelope `status!="ok"`)
239
+ - exit `2`: usage/argument/schema-subset errors
240
+ - exit `3`: startup/transport/protocol/timeout failures
241
+
242
+ ### Wrapper Flag Support
243
+
244
+ Wrapper mode (`satori-cli <toolName> ...`) supports a strict subset from reflected `tools/list` schemas:
245
+
246
+ - primitive properties (`string|number|integer|boolean`)
247
+ - enums of primitives
248
+ - arrays of primitives (repeat flags in insertion order)
249
+ - object properties only via `--<prop>-json '{...}'`
250
+
251
+ Tool-level flags that overlap global names are preserved in wrapper mode once command parsing starts.
252
+ Example: `satori-cli search_codebase --path /repo --query auth --debug` forwards `debug=true` to the tool.
253
+ For boolean wrapper flags, `--flag` implies `true` and `--flag false` is supported.
254
+
255
+ Unsupported schema shapes (for example `oneOf`, `anyOf`, `$ref`, complex arrays, nested expansion) return `E_SCHEMA_UNSUPPORTED` with fallback guidance to `--args-json` / `--args-file`.
256
+
257
+ ### Run Mode Semantics
258
+
259
+ When spawned by `satori-cli`, server process mode is `SATORI_RUN_MODE=cli`:
260
+
261
+ - startup background loops are disabled (`verifyCloudState`, watcher mode, background sync)
262
+ - stdio safety hardening is enabled (`stdout` protocol-only, logs to `stderr`)
263
+ - tool behavior stays on-demand and uses the same six MCP tools
264
+
265
+ `SATORI_CLI_STDOUT_GUARD=drop|redirect` controls accidental non-protocol stdout handling (`drop` default).
266
+
215
267
  ## Development
216
268
 
217
269
  ```bash
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: satori-indexing
3
+ description: Index lifecycle and remediation for Satori. Use when codebases are not indexed, stale, blocked, or need freshness recovery.
4
+ ---
5
+
6
+ # Satori Indexing
7
+
8
+ Use this skill when the task is to create, reindex, sync, inspect readiness, or recover from stale index state.
9
+
10
+ ## Tools
11
+
12
+ Use only:
13
+ 1. `list_codebases`
14
+ 2. `manage_index`
15
+
16
+ ## Workflow
17
+
18
+ 1. Use `list_codebases` for a global view of tracked roots.
19
+ 2. Use `manage_index(action="status", path=...)` for the specific codebase.
20
+ 3. Use `manage_index(action="create", path=...)` when the codebase is not indexed.
21
+ 4. Use `manage_index(action="reindex", path=...)` only for compatibility gates or explicit rebuilds.
22
+ 5. Use `manage_index(action="sync", path=...)` for freshness convergence and ignore-rule updates.
23
+
24
+ ## Rules
25
+
26
+ - If any tool returns `requires_reindex`, stop and reindex. Do not substitute `sync`.
27
+ - Never call `manage_index(action="clear")` unless the user explicitly requests destructive reset.
28
+ - Treat ignore-only churn as a `sync` problem first.
29
+ - Respect blocked and indexing states instead of forcing retries blindly.
30
+
31
+ ## Status Handling
32
+
33
+ - `requires_reindex`: run `manage_index(action="reindex")`.
34
+ - `not_ready` with indexing reason: check status and wait for terminal completion.
35
+ - `not_indexed`: create the index.
36
+ - Ignore-rule noise mitigation: update `.satoriignore`, wait debounce, and run `sync` for immediate convergence.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: satori-navigation
3
+ description: Deterministic symbol navigation with Satori. Use after search results are found to lock exact spans and inspect call relationships.
4
+ ---
5
+
6
+ # Satori Navigation
7
+
8
+ Use this skill after `search_codebase` has returned candidate results and you need exact symbol/file navigation.
9
+
10
+ ## Tools
11
+
12
+ Use only:
13
+ 1. `file_outline`
14
+ 2. `call_graph`
15
+ 3. `read_file`
16
+
17
+ ## Workflow
18
+
19
+ 1. Use grouped `search_codebase` results as the starting point.
20
+ 2. If `callGraphHint.supported=true`, call `call_graph(path=..., symbolRef=..., direction="both", depth=1)`.
21
+ 3. If `callGraphHint.supported=false`, execute `navigationFallback.readSpan.args` exactly.
22
+ 4. Use `file_outline(resolveMode="exact", symbolIdExact|symbolLabelExact)` to lock the symbol span.
23
+ 5. Use `read_file(path=..., open_symbol=...)` or deterministic line spans for the final read.
24
+
25
+ ## Rules
26
+
27
+ - Treat `navigationFallback` as authoritative. Do not invent spans.
28
+ - `open_symbol` must resolve deterministically. Do not guess on ambiguity.
29
+ - `read_file(mode="annotated")` is preferred when outline metadata is useful.
30
+ - Follow continuation hints when plain reads are truncated.
31
+
32
+ ## Remediation
33
+
34
+ - `requires_reindex`: reindex before retrying navigation.
35
+ - `not_ready`: wait for indexing to finish.
36
+ - `unsupported`: fall back to deterministic `read_file` spans when supplied by `navigationFallback`.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: satori-search
3
+ description: Semantic-first code search with Satori. Use for intent-based code discovery before file reads or grep.
4
+ ---
5
+
6
+ # Satori Search
7
+
8
+ Use this skill when the task is to find where behavior lives, identify candidate symbols, or narrow the search space before deeper navigation.
9
+
10
+ ## Tools
11
+
12
+ Use only:
13
+ 1. `list_codebases`
14
+ 2. `manage_index`
15
+ 3. `search_codebase`
16
+
17
+ ## Workflow
18
+
19
+ 1. Check readiness with `manage_index(action="status", path=...)`.
20
+ 2. If not indexed, use `manage_index(action="create", path=...)`.
21
+ 3. If `requires_reindex` appears, stop and use `manage_index(action="reindex", path=...)`, then retry.
22
+ 4. Search with `search_codebase(path=..., query=..., scope="runtime", resultMode="grouped", groupBy="symbol", rankingMode="auto_changed_first")`.
23
+
24
+ ## Search Rules
25
+
26
+ - Start with natural-language intent, not filenames.
27
+ - Default to `scope="runtime"`.
28
+ - Use operators only when needed: `lang:`, `path:`, `-path:`, `must:`, `exclude:`.
29
+ - Treat warnings as usable-but-degraded results, not fatal errors.
30
+ - Use `debug=true` only when ranking or filter explanations are required.
31
+
32
+ ## Remediation
33
+
34
+ - `requires_reindex`: run `manage_index(action="reindex")`, not `sync`.
35
+ - `not_ready` with indexing reason: wait or check `manage_index(action="status")`.
36
+ - Noise mitigation hint: update `.satoriignore`, wait debounce, rerun search, and use `manage_index(action="sync")` only for immediate convergence.
@@ -0,0 +1,54 @@
1
+ export interface GlobalOptions {
2
+ startupTimeoutMs: number;
3
+ callTimeoutMs: number;
4
+ format: "json" | "text";
5
+ debug: boolean;
6
+ }
7
+ export type RawArgsMode = {
8
+ kind: "none";
9
+ } | {
10
+ kind: "json";
11
+ value: string;
12
+ } | {
13
+ kind: "file";
14
+ path: string;
15
+ } | {
16
+ kind: "stdin-json";
17
+ };
18
+ export type ParsedCommand = {
19
+ kind: "help";
20
+ } | {
21
+ kind: "version";
22
+ } | {
23
+ kind: "install";
24
+ client: InstallClient;
25
+ dryRun: boolean;
26
+ } | {
27
+ kind: "uninstall";
28
+ client: InstallClient;
29
+ dryRun: boolean;
30
+ } | {
31
+ kind: "tools-list";
32
+ } | {
33
+ kind: "tool-call";
34
+ toolName: string;
35
+ rawArgsMode: RawArgsMode;
36
+ } | {
37
+ kind: "wrapper";
38
+ toolName: string;
39
+ rawArgsMode: RawArgsMode;
40
+ wrapperArgs: string[];
41
+ };
42
+ export interface ParsedCliInput {
43
+ globals: GlobalOptions;
44
+ command: ParsedCommand;
45
+ }
46
+ export interface ResolveRawArgsOptions {
47
+ stdin?: NodeJS.ReadStream;
48
+ stdinTimeoutMs: number;
49
+ }
50
+ export type InstallClient = "all" | "claude" | "codex";
51
+ export declare function parseCliArgs(argv: string[]): ParsedCliInput;
52
+ export declare function resolveRawArguments(rawArgsMode: RawArgsMode, options: ResolveRawArgsOptions): Promise<Record<string, unknown>>;
53
+ export declare function parseWrapperArgumentsFromSchema(toolName: string, inputSchema: unknown, wrapperArgs: string[]): Record<string, unknown>;
54
+ //# sourceMappingURL=args.d.ts.map