sdl-mcp tool gives you full access to SDL-MCP’s tool capabilities from your terminal, shell scripts, and CI pipelines — without running a server or installing an MCP SDK.
The CLI tool dispatcher routes through the same gateway router and Zod validation schemas as the MCP server. CLI and MCP always execute identical code paths.
Quick Start
How It Works
The CLI tool dispatcher bypasses the MCP server and transport layer entirely:- Parses CLI flags into typed arguments using action definitions
- Loads config and initializes the graph DB (same as the MCP server)
- Routes directly to the same handler functions the MCP server uses
- Normalizes and validates with the same alias-mapping and Zod schemas
- Formats output in your choice of format
Basic Syntax
<action> follows a namespace.operation pattern, for example symbol.search or slice.build. Run sdl-mcp tool --list to see all 31 available actions.
All 31 Actions
Query — Read-only intelligence queries (9 actions)
Query — Read-only intelligence queries (9 actions)
| Action | Description |
|---|---|
symbol.search | Search for symbols by name or summary |
symbol.getCard | Get a single symbol card by ID |
symbol.getCards | Batch fetch symbol cards for multiple IDs |
slice.build | Build a graph slice for a task context |
slice.refresh | Refresh an existing slice handle (delta only) |
slice.spillover.get | Fetch overflow symbols with pagination |
delta.get | Get semantic delta pack between two versions |
context.summary | Generate token-bounded context summary |
pr.risk.analyze | Analyze PR risk with blast radius |
Code — Gated raw code access (3 actions)
Code — Gated raw code access (3 actions)
| Action | Description |
|---|---|
code.needWindow | Request policy-gated raw code window |
code.getSkeleton | Get skeleton view (signatures + control flow, bodies elided) |
code.getHotPath | Get lines matching specific identifiers with surrounding context |
Repo — Repository lifecycle (7 actions)
Repo — Repository lifecycle (7 actions)
| Action | Description |
|---|---|
repo.register | Register a repository for indexing |
repo.status | Get repository status information |
repo.overview | Get codebase overview with directory summaries |
index.refresh | Trigger full or incremental re-indexing |
policy.get | Read current gating policy |
policy.set | Update policy configuration |
usage.stats | Get token usage statistics for session or history |
Agent — Agentic and live-edit operations (12 actions)
Agent — Agentic and live-edit operations (12 actions)
| Action | Description |
|---|---|
agent.orchestrate | Autonomous task execution with budget control |
agent.feedback | Record which symbols were useful or missing |
agent.feedback.query | Query aggregated feedback statistics |
buffer.push | Push editor buffer updates (requires running server) |
buffer.checkpoint | Force checkpoint (requires running server) |
buffer.status | Get buffer status (requires running server) |
memory.store | Store a development memory |
memory.query | Query development memories |
memory.remove | Remove a development memory |
memory.surface | Auto-surface relevant memories |
runtime.execute | Execute command in sandboxed subprocess |
runtime.queryOutput | Search stored runtime output artifacts by keyword |
Output Formats
Control output with--output-format:
| Format | Flag value | Best for |
|---|---|---|
| Indented JSON | json (default) | Human-readable, machine-parseable |
| Compact JSON | json-compact | Piping to jq or other tools |
| Pretty | pretty | Interactive terminal sessions |
| Table | table | List-like results |
Pretty Format Examples
Symbol search (--output-format pretty)
--output-format pretty)
--output-format pretty)
Argument Types
The CLI automatically coerces flag values to the expected types:| Type | CLI Syntax | Example |
|---|---|---|
string | --flag value | --repo-id my-repo |
number | --flag 42 | --limit 20 |
boolean | --flag | --semantic |
string[] | --flag a,b,c | --entry-symbols "sym1,sym2" |
json | --flag '{"key":"val"}' | --policy-patch '{"maxWindowLines":200}' |
--repo-id, --root-path, --symbol-id, --symbol-ids, --from-version, --to-version, and --slice-handle all normalize to the canonical action fields before validation.
Budget Flags
Actions that accept abudget object use flat flags for convenience. SDL-MCP merges them automatically:
Stdin JSON Piping
Pipe JSON arguments via stdin. CLI flags always override piped values when both are present.Auto-Resolution
Automatic repoId
You don’t always need to specify--repo-id. The CLI resolves it automatically:
- CLI flags or stdin — explicit
--repo-idalways wins - Current directory match — if your cwd is inside a configured repo’s root path
- Single-repo fallback — if only one repo is configured, it’s used automatically
Typo Suggestions
Mistyped action names produce actionable error messages:Examples by Workflow
- Debugging
- PR Review
- CI/CD Integration
- Scripting
Configuration
No additional configuration is needed beyond the standard SDL-MCP config file. Thetool command uses the same config resolution as all other commands:
--config flag → SDL_CONFIG env → cwd local config → user-global config → package fallback.
Architecture
The CLI tool access feature is composed of four modules:| Module | File | Responsibility |
|---|---|---|
| Action Definitions | src/cli/commands/tool-actions.ts | 31 action definitions with arg specs, types, and examples |
| Arg Parser | src/cli/commands/tool-arg-parser.ts | Flag→field mapping, type coercion, budget merging, required validation |
| Dispatcher | src/cli/commands/tool-dispatch.ts | Config/DB init, repoId resolution, handler routing, error handling |
| Output Formatter | src/cli/commands/tool-output.ts | JSON, compact JSON, pretty, and table output with action-specific formatting |
src/gateway/router.ts), which maps action names to the same { schema, handler } pairs used by the MCP server. This ensures CLI and MCP always execute identical code paths.