Skip to content

feat(express): add limit option for JSON body parser#1489

Open
aditya-ai-architect wants to merge 2 commits intomodelcontextprotocol:mainfrom
aditya-ai-architect:feat/express-json-limit
Open

feat(express): add limit option for JSON body parser#1489
aditya-ai-architect wants to merge 2 commits intomodelcontextprotocol:mainfrom
aditya-ai-architect:feat/express-json-limit

Conversation

@aditya-ai-architect
Copy link

Summary

Closes #1354

Adds a limit option to CreateMcpExpressAppOptions that is passed through to express.json({ limit }), allowing users to override the default 100kb request body size limit.

Changes

  • Added limit?: string | number to the CreateMcpExpressAppOptions interface with JSDoc documentation
  • Passed limit to express.json() when specified
  • Added tests for both string ('10mb') and numeric (1048576) limit values

Usage

// Override the default 100kb JSON body parser limit
const app = createMcpExpressApp({ limit: '10mb' });

// Or use a numeric value in bytes
const app = createMcpExpressApp({ limit: 1048576 });

Add a `limit` option to `CreateMcpExpressAppOptions` that is passed
through to `express.json({ limit })`, allowing users to override the
default 100kb request body size limit.

Closes modelcontextprotocol#1354
@aditya-ai-architect aditya-ai-architect requested a review from a team as a code owner February 5, 2026 22:45
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: 5727476

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/express Minor

Not sure what this means? Click here to learn what changesets are.

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

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