Skip to content

spec: add openspec for MCP server setup (SANDBOX-1814) - #20

Merged
fbm3307 merged 3 commits into
codeready-toolchain:masterfrom
fbm3307:SANDBOX-1814-mcp-server-setup-openspec
Jul 17, 2026
Merged

spec: add openspec for MCP server setup (SANDBOX-1814)#20
fbm3307 merged 3 commits into
codeready-toolchain:masterfrom
fbm3307:SANDBOX-1814-mcp-server-setup-openspec

Conversation

@fbm3307

@fbm3307 fbm3307 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator
  • Add OpenSpec change-set for SANDBOX-1814 (MCP server setup and entry point)
  • Document mcp.Server middleware wiring, Streamable HTTP options, HTTP mux (/mcp, DELETE /sessions/{id}, /metrics, /live, /health), Cobra flags, and graceful shutdown
  • Capture implementation tasks and requirements/scenarios for mcp-server-setup and server-entry-point

Assisted by : Cursor

Summary by CodeRabbit

  • Documentation
    • Added OpenSpec configuration plus new design, proposal, and spec documents for the CLI MCP server.
    • Defined the required MCP server setup pattern, including middleware behavior and transport rules (HTTP stateless + loopback-only binding; stdio transport constraints).
    • Documented the HTTP surface and semantics: /mcp, session deletion routes with status code rules, /metrics, /live, and /health (including timeout and payload expectations).
    • Specified CLI startup validation, Kubernetes reachability checks, and graceful shutdown behavior.

- Capture proposal, design, tasks, and specs for mcp.Server wiring,
  HTTP mux, Cobra entry point, and graceful shutdown
- Align with mcp-server-devsandbox mcpinit and design/implementation docs

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c1eb83f6-e0bd-4b19-a62f-5fad6ce78015

📥 Commits

Reviewing files that changed from the base of the PR and between 6f695de and 0768fb5.

📒 Files selected for processing (5)
  • openspec/changes/2026-07-16-mcp-server-setup/design.md
  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
🚧 Files skipped from review as they are similar to previous changes (5)
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/design.md

Walkthrough

This change adds OpenSpec documentation for an MCP server control plane, covering HTTP and stdio transports, routes, middleware, CLI validation, session lifecycle, health probes, background workers, graceful shutdown, dependencies, and acceptance checks.

Changes

MCP server setup

Layer / File(s) Summary
Server construction and HTTP contracts
openspec/changes/2026-07-16-mcp-server-setup/design.md, proposal.md, specs/mcp-server-setup/spec.md
Defines MCP construction, middleware, stateless HTTP transport, loopback binding, operational routes, session cleanup, health behavior, and bash tool registration.
CLI validation and process lifecycle
openspec/changes/2026-07-16-mcp-server-setup/design.md, specs/server-entry-point/spec.md, tasks.md
Defines Cobra flags, startup validation, initialization order, cleanup and warm-pool workers, HTTP and stdio serving, signal handling, shutdown, and version logging.
Implementation dependencies and acceptance plan
openspec/changes/2026-07-16-mcp-server-setup/.openspec.yaml, tasks.md, proposal.md
Adds OpenSpec metadata and lists dependencies, implementation tasks, tests, build checks, acceptance criteria, and scope impact.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: documentation

Suggested reviewers: alexeykazakov, rajivnathan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the new OpenSpec MCP server setup change and references the correct work item.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the documentation Improvements or additions to documentation label Jul 16, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openspec/changes/2026-07-16-mcp-server-setup/design.md`:
- Around line 52-70: Resolve the HTTP statelessness contract consistently across
the design, proposal, specs, Cobra --stateless handling, and deployment
manifests. Ensure production HTTP cannot unintentionally run with Stateless
false—either require/force true for HTTP while preserving documented local
behavior, or update all related contracts to explicitly support stateful mode,
including Tools.ListChanged expectations.
- Around line 145-161: Align the required-flag rules in Decision 8 with
runServer validation: define whether sandbox-image and hmac-key-file are
required for both stdio and HTTP transports, ensure the documented default
command satisfies those rules or explicitly requires the needed flags, and
update server-entry-point/spec.md plus tests to cover both transport paths.
- Around line 3-5: Update the deployment and configuration requirements around
--address and DisableLocalhostProtection to enforce the trust boundary before
disabling localhost protection: require a loopback bind address, a verified
trusted-proxy deployment, or explicit authentication configuration. Document
that non-loopback addresses must not expose /mcp or DELETE /sessions/{id}
without authentication, and define startup validation that rejects unsafe
combinations.

In `@openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md`:
- Around line 42-64: Update the mux configuration for session deletion to
explicitly handle DELETE requests to /sessions/ with an empty ID, returning HTTP
400 without calling CleanupSession. Preserve the existing DELETE /sessions/{id}
route and its handler behavior for non-empty IDs, while ensuring the fallback
does not redirect or produce a 404.

In `@openspec/changes/2026-07-16-mcp-server-setup/tasks.md`:
- Around line 24-31: The HTTP transport flow in task 3.7 must observe
ListenAndServe failures instead of waiting only for signals. Capture the
goroutine’s serve result, treat non-http.ErrServerClosed errors as fatal by
canceling the shared context and returning cleanly, and preserve normal shutdown
handling for expected closure. Add an acceptance test covering an unexpected
HTTP serve failure and confirming shutdown occurs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 49d260e7-850b-4e38-96dd-48418c5dac74

📥 Commits

Reviewing files that changed from the base of the PR and between c2f9e32 and 6bd8ce4.

📒 Files selected for processing (6)
  • openspec/changes/2026-07-16-mcp-server-setup/.openspec.yaml
  • openspec/changes/2026-07-16-mcp-server-setup/design.md
  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
  • openspec/changes/2026-07-16-mcp-server-setup/design.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
🪛 LanguageTool
openspec/changes/2026-07-16-mcp-server-setup/design.md

[grammar] ~75-~75: Ensure spelling is correct
Context: ...thout Cobra) - cmd/server owns flags, clientset construction, SessionManager lifecycle,...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (5)
openspec/changes/2026-07-16-mcp-server-setup/.openspec.yaml (1)

1-2: LGTM!

openspec/changes/2026-07-16-mcp-server-setup/proposal.md (1)

1-45: LGTM!

openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md (1)

3-40: LGTM!

Also applies to: 65-97

openspec/changes/2026-07-16-mcp-server-setup/tasks.md (1)

1-20: LGTM!

Also applies to: 33-51

openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md (1)

3-74: LGTM!

Comment thread openspec/changes/2026-07-16-mcp-server-setup/design.md Outdated
Comment thread openspec/changes/2026-07-16-mcp-server-setup/design.md Outdated
Comment thread openspec/changes/2026-07-16-mcp-server-setup/design.md
Comment thread openspec/changes/2026-07-16-mcp-server-setup/tasks.md Outdated
- Require --stateless and loopback --address for HTTP; reject unsafe binds
- Require sandbox-image and hmac-key-file for both transports
- Add DELETE /sessions/ empty-id fallback (400, not 404)
- Observe ListenAndServe failures and shut down background workers

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openspec/changes/2026-07-16-mcp-server-setup/design.md`:
- Around line 97-100: Update the session deletion flow using
SessionManager.CleanupSession so cleanup failures return a stable generic HTTP
500 response without exposing the underlying error text. Log the wrapped cleanup
error server-side with request and session correlation details, while preserving
the 204 No Content success response.

In
`@openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md`:
- Around line 16-24: Update runServer’s HMAC key validation to reject readable
files whose loaded contents are zero-length, before constructing SessionManager
or starting either transport. Preserve the existing empty-path and
unreadable-file errors, and cover the non-empty-content requirement for both
stdio and http transports.
- Around line 44-55: Expand the runServer requirement to define stdio behavior:
specify how stdio blocks while serving, how transport errors are returned or
surfaced, and that shutdown stops the stale-session cleanup and warm-pool
reconciler workers. Keep the existing HTTP shutdown and fatal serve-error
semantics unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: fd1f9528-23e2-4c2f-b918-a13b379a75b9

📥 Commits

Reviewing files that changed from the base of the PR and between 6bd8ce4 and 6f695de.

📒 Files selected for processing (5)
  • openspec/changes/2026-07-16-mcp-server-setup/design.md
  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • codeready-toolchain/mcp-common (manual)
  • codeready-toolchain/mcp-server-devsandbox (manual)
  • codeready-toolchain/api (manual)
  • codeready-toolchain/toolchain-common (manual)
  • codeready-toolchain/host-operator (manual)
  • codeready-toolchain/toolchain-e2e (manual)
🚧 Files skipped from review as they are similar to previous changes (3)
  • openspec/changes/2026-07-16-mcp-server-setup/proposal.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/mcp-server-setup/spec.md
  • openspec/changes/2026-07-16-mcp-server-setup/tasks.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • openspec/changes/2026-07-16-mcp-server-setup/design.md
  • openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md
🪛 LanguageTool
openspec/changes/2026-07-16-mcp-server-setup/design.md

[grammar] ~154-~154: Ensure spelling is correct
Context: ...iler on either signal or unexpected serve failure. Treat http.ErrServerClosed a...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md

[grammar] ~55-~55: Ensure spelling is correct
Context: .... Wait for shutdown signal or fatal serve error #### Scenario: Warm pool skipped...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~89-~89: Ensure spelling is correct
Context: ...cenario: ErrServerClosed is not a fatal serve failure - WHEN ListenAndServe ret...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
openspec/changes/2026-07-16-mcp-server-setup/design.md (1)

1-96: LGTM!

Also applies to: 101-220

openspec/changes/2026-07-16-mcp-server-setup/specs/server-entry-point/spec.md (1)

1-15: LGTM!

Also applies to: 25-43, 56-98

Comment thread openspec/changes/2026-07-16-mcp-server-setup/design.md
- Return generic 500 on session cleanup failure; log details server-side
- Reject zero-byte HMAC key files for both transports
- Define stdio Run blocking, cancel, and worker shutdown semantics

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Feny Mehta <fbm3307@gmail.com>
@fbm3307
fbm3307 merged commit 935a019 into codeready-toolchain:master Jul 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant