Skip to content

Reject empty metadata keys in MCP validation - #3023

Open
HarshPopat23 wants to merge 1 commit into
sourcemeta:mainfrom
HarshPopat23:fix/mcp-reject-empty-metadata-key
Open

HarshPopat23 wants to merge 1 commit into
sourcemeta:mainfrom
HarshPopat23:fix/mcp-reject-empty-metadata-key

Conversation

@HarshPopat23

@HarshPopat23 HarshPopat23 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Hold unprefixed MCP metadata keys to having at least one valid character, rejecting empty keys.

Under MCP 2026-07-28, keys without a prefix must begin and end with an alphanumeric character. Previously, metadata_key permitted an empty string when prefix_required was false because name.empty() evaluated to true.

Add regressions across request meta, notification, and result writer validation.

MCP metadata keys without a prefix must begin and end with an alphanumeric character. Previously, metadata_key allowed an empty string when prefix_required was false because name.empty() evaluated to true. Hold unprefixed keys to having at least one valid character, rejecting empty keys.

Signed-off-by: HarshPopat23 <musichk61@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 4 files

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Re-trigger cubic

@augmentcode

augmentcode Bot commented Oct 16, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Rejects empty metadata keys to enforce MCP 2026-07-28 naming rules.
Updates shared metadata_key validation when prefixes are optional.
Preserves valid prefixed extension keys with empty names.
Adds regression coverage for request metadata validation.
Adds rejection tests for notification creation and result writing.
Verifies rejected results leave the output stream untouched.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot 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.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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