Skip to content

fix(mcp server): do not pass the whole query in requests#1548

Merged
nbouliol merged 5 commits intomainfrom
fix/mcp-server-query-fields
Apr 14, 2026
Merged

fix(mcp server): do not pass the whole query in requests#1548
nbouliol merged 5 commits intomainfrom
fix/mcp-server-query-fields

Conversation

@nbouliol
Copy link
Copy Markdown
Member

@nbouliol nbouliol commented Apr 13, 2026

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Fix QuerySerializer.serialize to exclude arbitrary query properties from requests

Previously, serialize spread all input query properties into the output, which caused unintended fields to be forwarded in requests. The method now emits only an explicit set of known keys (search, sort, filters, searchExtended, page[size], page[number], fields). Risk: any callers relying on arbitrary query properties being forwarded will no longer receive them.

Changes since #1548 opened

  • Modified QuerySerializer.serialize method to forward all additional query properties [7e67658]
  • Modified QuerySerializer.serialize method in the agent-client package to explicitly control forwarded query properties [76396e4]
  • Modified QuerySerializer.serialize method to explicitly destructure segmentQuery and connectionName from query object and added corresponding optional fields to SelectOptions type [1787757]
  • Modified QuerySerializer.serialize method to always include segmentQuery and connectionName as top-level properties in the serialized output [a91b14d]

Macroscope summarized bef5acf.

alban bertolini and others added 2 commits April 13, 2026 21:08
…xtra params

The previous fix removed ...query entirely, which also dropped extra
params like segmentQuery and connectionName that Segment passes through.
Now destructure only the fields we reformat (fields, sort, filters,
shouldSearchInRelation, pagination) and spread the rest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pread

List all known params explicitly (search, sort, filters, pagination,
fields, segmentQuery, connectionName) instead of using ...rest spread
which could leak unknown fields into the query string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 13, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-client/src/query-serializer.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

alban bertolini and others added 2 commits April 13, 2026 21:18
…ns type

Remove unsafe Record<string, unknown> cast by adding the segment
fields to the type definition. TypeScript now validates these fields
at compile time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…erialize

No need for conditional spread — undefined values are ignored by the
query string builder.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nbouliol nbouliol merged commit ca4810f into main Apr 14, 2026
29 checks passed
@nbouliol nbouliol deleted the fix/mcp-server-query-fields branch April 14, 2026 07:42
forest-bot added a commit that referenced this pull request Apr 14, 2026
## @forestadmin/agent-client [1.4.23](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/agent-client@1.4.22...@forestadmin/agent-client@1.4.23) (2026-04-14)

### Bug Fixes

* **mcp server:** do not pass the whole query in requests ([#1548](#1548)) ([ca4810f](ca4810f))
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.

2 participants