Skip to content

fix(server): accept path params longer than 100 characters - #2

Merged
saurav-shakya merged 1 commit into
devfrom
ccr-bf38cb46-bt5x73
Oct 11, 2026
Merged

saurav-shakya merged 1 commit into
devfrom
ccr-bf38cb46-bt5x73

Conversation

@saurav-shakya

@saurav-shakya saurav-shakya commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Issue for this PR

Closes anomalyco#53401

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Effect's HttpRouter.layer builds its find-my-way router from HttpRouter.RouterConfig, which defaults to {}. find-my-way then falls back to maxParamLength: 100, so any route whose path param exceeds 100 characters never matches and returns a bare 404 before the handler runs. Clients such as T3 Code use MCP server names like t3-code-<threadId>, so PUT /api/experimental/mcp/:server silently fails for them and those sessions get no MCP tools.

makeRoutes in packages/server/src/routes.ts now provides RouterConfig with maxParamLength: 512 to the router layer. This is what HttpRouter.serve({ routerConfig }) does internally, and it applies to every server entry point that goes through createRoutes/createEmbeddedRoutes (process and fetch handler).

Server names over 64 characters can still lose their tools for a separate reason (anomalyco#53400). This PR does not touch that.

How did you verify your code works?

  • Added packages/server/test/router.test.ts. It requests GET /api/provider/<300 chars> and asserts that the handler's ProviderNotFoundError comes back, not the router's bare 404. It fails on dev and passes with this change.
  • bun typecheck in packages/server passes.
  • bun test in packages/server: 80 pass, 3 fail. The 3 failures are OpenAI OAuth callback-port tests that fail identically on dev without this change.

Screenshots / recordings

N/A, not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

find-my-way defaults maxParamLength to 100, so any route param past that
(e.g. long MCP server names on PUT /api/experimental/mcp/:server) returned
a bare 404 without reaching its handler. Provide RouterConfig with
maxParamLength 512.

Fixes anomalyco#53401
Copilot AI balanced review requested due to automatic review settings October 11, 2026 04:18

Copilot AI 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.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 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-10-11T04:21:52.238940Z 1414be0 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.

@saurav-shakya
saurav-shakya merged commit 0ae2fe3 into dev Oct 11, 2026
5 of 11 checks passed
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.

PUT /api/experimental/mcp/:server returns 404 for server names over 100 chars (router maxParamLength)

2 participants