Skip to content

feat(mcp): concurrent component_mcp calls with session limits (Phase 5) - #259

Open
askdba wants to merge 1 commit into
mainfrom
feat/mcp-workers
Open

askdba wants to merge 1 commit into
mainfrom
feat/mcp-workers

Conversation

@askdba

@askdba askdba commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Phase 5 items from #256: more than one I/O worker and the per-account session cap, plus max_connections.

Change

  • mcp_http.threads (read-only, default 4, range 1–64): the number of Router IoComponent worker threads. Each worker serves one call at a time, since SQL runs synchronously on it. Router's HTTP server assigns connections to the workers in turn (Server::return_next_thread). The spike had one worker.
  • mcp_http.max_sessions_per_account (read-only, default 4, range 1–1024): a per-account count of open endpoint sessions, kept under a mutex.
  • max_connections: the sessions now set MYSQL_COMMAND_BYPASS_MAX_CONNECTIONS = false (26.10). Before, they counted toward max_connections but could exceed it, which is the command service's default. When the server is full, a call now fails with 1040.

Tests

scripts/test-mcp-endpoint.sh on mysql:26.10.0: 40 passed, 0 failed. New checks:

  • the defaults are 4 / 4;
  • 4 concurrent SELECT SLEEP(2) calls all succeed, in under 4 s wall time (they overlap);
  • after reinstalling with a cap of 2: 2 of 4 concurrent calls succeed, 2 fail with 1203, and a slot is free again afterwards;
  • with max_connections = 1 and one idle client, the call fails with 1040. It works again once the limit is restored;
  • mcp.sessions_connected is back to 0 afterwards.

Built once with the bypass left true: the max_connections check fails. So the test covers the change.

Docs: settings table, Phase 5 facts, CHANGELOG.

Independent of #257 and #258. All three touch run_as(), so later merges get a merge from main.

Part of #256.

🤖 Generated with Claude Code

- mcp_http.threads (read-only, default 4): I/O workers; each serves one
  call at a time (the spike had one). Router assigns connections to the
  workers in turn.
- mcp_http.max_sessions_per_account (read-only, default 4): caps an
  account's concurrent endpoint sessions (error 1203), since the server's
  max_user_connections does not apply to command-service sessions.
- Sessions are subject to max_connections (MYSQL_COMMAND_BYPASS_MAX_CONNECTIONS
  = false, 26.10) instead of bypassing it (error 1040 when full).

test-mcp-endpoint.sh: 4 x SLEEP(2) overlap in under 4 s, cap 2 lets 2 of
4 through and refuses 2, max_connections = 1 with one idle client refuses
the call. 40 checks; with the bypass left on, the max_connections check
fails.

Part of #256 (RFC 0001 Phase 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T10:03:22.792466Z 777d921 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f2b1cbd1-a0aa-45db-a408-10d0255b77cd
Commits

Reviewing files that changed from the base of the PR and between ff59fea and 777d921.

Files selected for processing: 4
  • CHANGELOG.md
  • docs/MCP_COMPONENTS.md
  • scripts/test-mcp-endpoint.sh
  • src/mcp/endpoint/component_mcp.cc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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.

1 participant