Skip to content

Comments

feat(express): add jsonBodyLimit option to createMcpExpressApp#1559

Open
corvid-agent wants to merge 1 commit intomodelcontextprotocol:mainfrom
corvid-agent:fix/express-body-limit
Open

feat(express): add jsonBodyLimit option to createMcpExpressApp#1559
corvid-agent wants to merge 1 commit intomodelcontextprotocol:mainfrom
corvid-agent:fix/express-body-limit

Conversation

@corvid-agent
Copy link
Contributor

Summary

  • Adds a jsonBodyLimit option to CreateMcpExpressAppOptions to allow configuring the maximum request body size for the JSON body parser
  • Accepts a number (bytes) or a string (e.g., '1mb', '500kb')
  • Defaults to Express's built-in default of 100kb if not specified

Motivation

When MCP payloads exceed Express's default 100kb limit, the body parser rejects the request. This change allows users to configure the limit without needing to patch the package.

Closes #1354

Test plan

  • Verify default behavior unchanged (no jsonBodyLimit = Express default 100kb)
  • Verify custom limit works (e.g., jsonBodyLimit: '1mb')

🤖 Generated with Claude Code

Allow configuring the maximum request body size for the JSON body
parser via a new `jsonBodyLimit` option. This is needed when MCP
payloads exceed Express's default 100kb limit.

Closes modelcontextprotocol#1354

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@corvid-agent corvid-agent requested a review from a team as a code owner February 20, 2026 16:39
@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

⚠️ No Changeset found

Latest commit: 43bef9a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 20, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1559

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1559

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1559

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1559

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1559

commit: 43bef9a

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.

Need to override json limit defaults for express body parser in createMcpExpressApp()

1 participant