Skip to content

Feat/ts server cli#135

Open
kartikloops wants to merge 47 commits into
The-OpenROAD-Project:feat/ts-migrationfrom
kartikloops:feat/ts-server-cli
Open

Feat/ts server cli#135
kartikloops wants to merge 47 commits into
The-OpenROAD-Project:feat/ts-migrationfrom
kartikloops:feat/ts-server-cli

Conversation

@kartikloops

Copy link
Copy Markdown
Collaborator

This PR adds the layer that actually boots the MCP server. The engine and all 10 tools already existed on feat/ts-tools; this connects them to MCP transports, a CLI, and graceful shutdown so that node dist/main.js (and later npx openroad-mcp) runs as a real server.

The work is split across four files. src/server.ts registers all 10 tools with their Zod schemas and behavior annotations (ported straight from the Python server.py) and runs them over either stdio or HTTP. src/config/cli.ts parses the command-line flags and rejects --host/--port unless you're on HTTP. src/utils/cleanup.ts handles SIGTERM/SIGINT, signals shutdown, and force-exits if a graceful stop hangs. src/main.ts ties it together: parse the CLI, set up logging, run the server, and exit with sensible codes. Tests cover the CLI, the cleanup manager, and an in-memory server boot that confirms all 10 tools show up.

HTTP runs in stateless mode with a fresh transport and server per request, because the SDK forbids reusing one transport and two clients numbering their requests from the same id would otherwise collide. Session continuity still works since sessions are keyed by our own session_id, not the MCP transport. In main.ts, logging and server are imported dynamically (not statically) so that a bad env var fails cleanly instead of crashing during module load, and so the CLI log level is applied before any logger is built. Lastly, tsconfig.json flips skipLibCheck to true: the SDK's HTTP transport types don't satisfy our strict exactOptionalPropertyTypes, so lib checking has to be skipped to use it. Our own source stays fully type-checked.

Everything is verified: typecheck and lint are clean, all 420 tests pass with 85.7% line coverage, and the server was tested live in Cursor and it boots over stdio, lists all 10 tools, spawns a real OpenROAD process and runs commands, handles concurrent HTTP requests without collisions, and shuts down cleanly on Ctrl-C. A bad env var produces a clear configuration error and exit code 1.

To run it, build with cd typescript && npm run build, then point your MCP client at it:

{
"mcpServers": {
"openroad-mcp": {
"command": "node",
"args": ["/absolute/path/to/typescript/dist/main.js"]
}
}
}

Copilot AI review requested due to automatic review settings June 25, 2026 06:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kartikloops kartikloops requested review from luarss and vvbandeira June 25, 2026 06:29
…annot be bypassed via catch/if/foreach or set x [exec ls]
…t can map config and interrupt failures to distinct exit codes
…exit timer so a hung graceful shutdown still exits after FORCE_EXIT_DELAY_SECONDS
…re asserted to enumerate with correct annotations
…ing logging and server so settings validate before any logger is built and the CLI log level applies first
…ncurrent stateless clients do not collide on JSON-RPC request ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants