Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| `libscope search <query>` | Semantic search |
| `libscope ask <question>` | RAG question-answering |
| `libscope repl` | Interactive search REPL |
| `libscope serve` | Start MCP server (or `--api` for REST API) |
| `libscope serve` | Start MCP server, REST API (`--api`), or web dashboard (`--dashboard`) |

### `libscope add`

Expand Down Expand Up @@ -84,18 +84,21 @@ libscope ask "How do I configure OAuth2?" --library my-lib --top-k 8

### `libscope serve`

Start the MCP server or REST API.
Start the MCP server, REST API, or web dashboard.

```bash
libscope serve # MCP server (stdio)
libscope serve --api # REST API
libscope serve --api --port 3378
libscope serve # MCP server (stdio)
libscope serve --api # REST API (port 3378)
libscope serve --dashboard # Web dashboard UI (port 3377)
libscope serve --dashboard --port 8080
```

| Option | Description |
|--------|-------------|
| `--api` | Start REST API instead of MCP server |
| `--port <n>` | REST API port (default: 3378) |
| `--dashboard` | Start the web dashboard UI |
| `--port <n>` | Server port (default: 3378 for API, 3377 for dashboard) |
| `--host <h>` | Server host (default: localhost) |
Comment on lines +87 to +101
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI docs now describe --dashboard, but the README still documents only libscope serve --api under the “REST API” section. If this PR closes #259, consider updating README.md as well so users discover the dashboard entrypoint consistently.

Copilot uses AI. Check for mistakes.

## Document Management

Expand Down
28 changes: 18 additions & 10 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,19 +710,27 @@ program
// serve
program
.command("serve")
.description("Start the MCP server (or REST API with --api)")
.description("Start the MCP server, REST API (--api), or web dashboard (--dashboard)")
.option("--api", "Start the REST API server instead of MCP")
.option("--port <port>", "API server port", "3378")
.option("--host <host>", "API server host", "localhost")
.action(async (opts: { api?: boolean; port: string; host: string }) => {
if (opts.api) {
.option("--dashboard", "Start the web dashboard UI")
.option("--port <port>", "Server port (default: 3378 for API, 3377 for dashboard)")
.option("--host <host>", "Server host", "localhost")
.action(async (opts: { api?: boolean; dashboard?: boolean; port?: string; host: string }) => {
if (opts.dashboard) {
const { db, provider } = initializeAppWithEmbedding();
const { startWebServer } = await import("../web/server.js");
const defaultPort = 3377;
Comment on lines +718 to +722
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--api and --dashboard can both be provided, but the current branching silently prioritizes --dashboard. This makes the CLI behavior ambiguous; consider explicitly rejecting the combination (print an error and exit non-zero) or wiring it to start both servers if that’s intended.

Copilot uses AI. Check for mistakes.
const port = opts.port ? parseIntOption(opts.port, "--port") : defaultPort;
await startWebServer(db, provider, { port, host: opts.host });
console.log(`LibScope dashboard running at http://${opts.host}:${port}`);
console.log("Press Ctrl+C to stop");
} else if (opts.api) {
const { db, provider } = initializeAppWithEmbedding();
const { startApiServer } = await import("../api/server.js");
const { port } = await startApiServer(db, provider, {
port: parseIntOption(opts.port, "--port"),
host: opts.host,
});
console.log(`LibScope API server listening on http://${opts.host}:${port}`);
const defaultPort = 3378;
const port = opts.port ? parseIntOption(opts.port, "--port") : defaultPort;
const result = await startApiServer(db, provider, { port, host: opts.host });
console.log(`LibScope API server listening on http://${opts.host}:${result.port}`);
console.log("Press Ctrl+C to stop");
} else {
await import("../mcp/server.js");
Expand Down
Loading