Skip to content

feat(sql-server): add the stdio MCP server with its fixed read tool set - #11509

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-11325-41186308728-1
Oct 31, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-11325-41186308728-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #11325

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Adds the sql-server plugin's stdio MCP server (slice B of #9849). It binds one registration from --config <path> --environment <name>, exposes exactly query, list_objects and describe_object with the tools capability's listChanged false, refuses a database outside the allow-list before the executor runs, defaults an omitted database to the first allowed one, and returns reject-list refusals as isError tool results. Means chosen on evidence: the server is dependency-free (the plugin has no dependencies, slice A even hand-rolled its schema validator, and the lane cannot add a lockfile) and speaks both the stateless 2026-07-28 protocol (server/discover, per-request _meta, read in the spec this run) and the initialize-based 2025-11-25 protocol, since clients may still use the handshake. The executor interface has three methods (query, listObjects, describeObject), so slice C owns all catalog SQL and the per-call guards; until then a placeholder executor turns every passing call into a tool error that says no executor exists.

Not verified

  • The plugin's unit tests (npm test --prefix plugins/sql-server, node --test) were not executed: this lane's Bash runs only the named wrappers. Left to the PR's CI test-node lane; the review subagent traced each test against the source.
  • ci-status green on the PR head is a PR CI check this run cannot see; left to the PR's CI.
  • Tidy skipped: the change spans 2 areas (plugins/sql-server and docs) and its new files exceed the 300-line cutoff.
  • Build and lint steps: the plugin has no build or lint script; check-affected's validate-plugins ran, and typos was skipped because it is not installed.
  • The legacy initialize path echoes only 2025-11-25 and answers that version to any other requested legacy version, per the 2025-11-25 negotiation rule; older legacy revisions were not read this run, so they are not claimed. A client that refuses 2025-11-25 would disconnect.
  • tools/list ignores a cursor parameter and always returns the single full page; the pagination page was not read this run.
  • Untracked root files (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) appeared in the working tree from the runner environment; this run did not create or touch them and they are not part of the change.

Fix

  • plugins/sql-server/src/tools.mjs: new; the frozen three-tool list with input schemas, argument checks, the database allow-list resolution, the reject-list gate on query, and the Executor interface
  • plugins/sql-server/src/server.mjs: new; the dual-era JSON-RPC handler (server/discover, initialize, ping, tools/list, tools/call, -32022 for an unsupported version, -32602 for an unknown tool or missing clientCapabilities) and the newline-delimited stdio loop
  • plugins/sql-server/src/registration.mjs: new; strict --config/--environment parsing and binding of one environment's server, allow-list and limits
  • plugins/sql-server/src/main.mjs: new; main() wires config, registration, executor and server, exits 2 with the reason on stderr when the registration cannot bind; pendingExecutor() placeholder until slice C
  • plugins/sql-server/src/launch.mjs: new; the command a registration runs
  • plugins/sql-server/test/server.test.mjs: new; node:test cases for the fixed list on both protocol eras and on repeated calls, listChanged false, allow-list refusal before the fake executor runs (each tool), the first-database default (each tool), reject-list tool errors, unknown tool and argument er
  • plugins/sql-server/README.md: documents the server, its launch command, the three tools and the allow-list behavior
  • plugins/sql-server/.claude-plugin/plugin.json: description now names the server and tools and says the executor comes later
  • docs/catalog.md: the sql-server line regenerated text to match the new plugin description (check-affected's catalog drift check)
  • .changes/sql-server/feat-11325-sql-server-mcp-server-7c41e2a9.md: minor changelog fragment, written by hand because new-changelog-fragment refuses a detached HEAD

Verification

The runner ran each check from the base copy against 0360c62:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //modelcontextprotocol.io/specification/2026-07-28/server/tools: servers declaring tools must answer tools/list with a set that must not vary per connection or as a side effect of other requests; listChanged signals list-change notifications; unknown tool is a -32602 protocol error, inpu
  • read https: //modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio: newline-delimited JSON-RPC, no embedded newlines, nothing but MCP messages on stdout, stderr for logging, exit when stdin closes
  • read https: //modelcontextprotocol.io/specification/2026-07-28/basic/lifecycle (served the versioning page): no handshake; per-request version; unsupported version answers -32022 with data.supported and data.requested; servers must implement server/discover; dual-era servers may also answer initiali
  • read https: //modelcontextprotocol.io/specification/2026-07-28/server/discover: DiscoverResult carries supportedVersions, capabilities and _meta io.modelcontextprotocol/serverInfo
  • read https: //modelcontextprotocol.io/specification/2026-07-28/basic/index: results carry resultType complete; _meta protocolVersion and clientCapabilities are required and a missing one is -32602; notifications get no response
  • read https: //modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle: initialize request/response shape, server echoes a supported protocolVersion or answers with its latest, notifications/initialized
  • check-changelog-fragments: all 40 fragments valid (run after the final edit)
  • check-affected: first run failed validate-plugins on docs/catalog.md drift; fixed; final run 11 passed, 7 skipped, 0 failed over 10 changed files
  • fresh-context review subagent over the whole diff: no test or allow-list defect found; one low finding (an EPIPE write error is emitted as an event, so the .catch never saw it) fixed by an output error listener that closes the reader, plus a test it noted was missing for absent clientCapabilities
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41186308728

Left out: the items under Not verified.

Related

#11325

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 0360c6260e7082361498a4868b39681174ec4b13: 0 finding(s), 0 as inline comments.

No security issues found in this pull request.

critical-findings: 0

I read the whole diff (10 files) and the PR context. None of the changed files match a trusted path, and the PR text contains no embedded directives.

  • Database allow-list: resolveDatabase in plugins/sql-server/src/tools.mjs uses an exact databases.includes(requested) check. It runs before any executor call, and the executor receives only the resolved name. The registration's databases list is frozen, so no tool argument can add to it.
  • Tool arguments: checkArguments accepts only declared properties, using Object.hasOwn and non-empty strings. A server or environment argument is refused, so a call cannot reach another server or environment.
  • Reject list: query runs checkStatement before the executor, and a refusal returns as a tool error. statement.mjs is not in this diff and was not re-reviewed.
  • Executor: the shipped executor refuses every call. No SQL is built or run in this change, so there is no injection or credential-handling surface yet. Slice C will add that and should be reviewed then.
  • Registration and launch: parseArgs runs in strict mode and rejects positionals. bindRegistration uses Object.hasOwn on the environment name, so a name like __proto__ or constructor cannot select a prototype property. The config path is read by the existing loader, and the user who launches the server supplies it.
  • Protocol handling: JSON.parse failures return a parse error. Handler errors are logged to stderr and answered with a generic "Internal error", so stack traces do not reach the client.
  • manifest description: pass. The plugin.json change is a description-only edit, which is in the inert set. No hooks, mcpServers, userConfig or dependencies were added.

The change spends no paid resources and starts no billed resource.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 0360c6260e7082361498a4868b39681174ec4b13: 0 finding(s), 0 as inline comments.

I found nothing to block or flag in this change. I did not run the tests, so every test result below is traced by reading, not by execution. The author's claim that the unit tests pass is unverified.

Closing issue #11325 criteria

  • tools/list returns exactly query, list_objects and describe_object, and the same list on repeated calls. This is covered in server.test.mjs under tools/list, on both protocol eras and before and after tool calls.
  • The tools capability declares listChanged false. This is asserted for both server/discover and the legacy initialize.
  • A database outside the allow-list is refused before the executor runs. callTool calls resolveDatabase before any executor method. The test asserts executor.calls is empty for each of the three tools.
  • An omitted database takes the first allowed one. This is tested for each of the three tools.
  • A reject-list refusal reaches the client as a tool error. callTool turns a failed checkStatement into a ToolInputError, which dispatch returns as isError: true. Four statements are tested, plus one on the legacy era.
  • ci-status green is a PR CI check, so I cannot see it from here.

Review notes

  • Argument checking is strict. checkArguments rejects unknown keys (including server), non-string values and empty strings. A __proto__ key from JSON is also rejected, because Object.hasOwn is used.
  • The first-database default is applied only when database is undefined, so an empty string is refused.
  • The stdio loop writes one JSON line per response, sends nothing for notifications, and waits for in-flight requests when input ends. The EPIPE handler closes the reader.
  • main reads the plugin version from plugin.json, and parseArgs runs in strict mode.
  • I found no defect in tools.mjs, server.mjs, registration.mjs or main.mjs that I could show failing with a concrete input.

Manifest checks

  • manifest description: pass. It names the stdio server and the three tools, and says the executor comes later, which matches the diff.
  • manifest version bump: pass. The minor bump in the changelog fragment fits a new capability. The plugin has no userConfig fields, and docs/catalog.md matches the new description.

Spend: none. The change adds no billed resource and no model-driven lane spend.

Not reviewed or unverified

  • The legacy initialize path answers 2025-11-25 to any other requested version. The author says older legacy versions were not read, and I did not check this against the spec.
  • tools/list ignores a cursor parameter, which is harmless with a fixed three-tool list.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 0360c6260e7082361498a4868b39681174ec4b13.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 7e72ad5 Oct 31, 2026
47 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-11325-41186308728-1 branch October 31, 2026 10:10
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.

feat: add the sql-server MCP server with its fixed read tool set

0 participants