bug: openapi-to-mcp appends a second ? to a query-suffixed path template
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- lua, openapi
- Domain
- api, backend-api-design
Research direction
Read apisix/plugins/openapi-to-mcp/tools/handler.lua, focusing on build_path() and _M.call(), where the issue identifies the query suffix and serialized parameters being joined. Check the existing tests added in PR #14154 for query-suffixed templates. Done means the example request uses /b?acl&prefix=logs and the declared parameter reaches the upstream under its own name.
Written by the indexing model from the issue text.
Description
Current Behavior
openapi-to-mcp sends a second literal ? upstream when a path template carries a query
suffix and the operation also declares query parameters.
build_path() returns the template with its substitutions, query suffix included, and
_M.call() then appends the serialized query parameters with its own ?:
local url = base_url .. path
if query then
url = url .. "?" .. query
end
For a template of /{Bucket}?acl with a declared prefix query parameter, a call with
Bucket=b and prefix=logs is sent as:
/b?acl?prefix=logs
The upstream parses everything after the first ? as the query string, so it sees one
parameter spelled acl?prefix, and the declared prefix parameter never arrives under
its own name. Query-suffixed path templates are used by S3-style documents.
Verified at runtime against the official test harness on master; the output is identical
on #14154, so the behavior is pre-existing and that PR neither introduces nor changes it.
It surfaced while reviewing #14154, which added the first test coverage for query-suffixed
templates: https://github.com/apache/apisix/pull/14154#discussion_r4475591464
Expected Behavior
The template's query suffix and the serialized query parameters should be merged into one
query string joined by &, so the example above is sent as /b?acl&prefix=logs and every
declared parameter reaches the upstream under its own name.
Steps to Reproduce
- Serve an OpenAPI document whose path is
/{Bucket}?acl, withBucketas a required
path parameter andprefixas a query parameter. - Configure an
openapi-to-mcpRoute using that document. - Call the generated tool with
Bucket=bandprefix=logs. - Observe the upstream request path
/b?acl?prefix=logsrather than/b?acl&prefix=logs.
Environment
- APISIX: current
master, reproduced at6205e4a56 - Component:
apisix/plugins/openapi-to-mcp/tools/handler.lua,build_path()and_M.call()
- Dominant language
- Lua
- Stars
- 17.3k
- Forks
- 3k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 58
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/apisix
-
ai-proxy forwards client `Transfer-Encoding: chunked` but sends an unchunked body (upstream 400)Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days
-
As a user, I want the opa plugin to propagate trace context (traceparent) to OPA, so that OPA spans are linked to the APISIX request tracePossibly taken @GitNimay claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/apisix#14051 · 3 comments ·
Maintainers usually reply within 2 days
-
bug: splunk-hec-logging crashes with nil concatenation when error response json lacks text fieldPossibly taken @LiteSun claimed this 7 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/apisix#14011 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
bug: tcp-logger attempts to send nil data and crashes when json encoding failsPossibly taken @LiteSun claimed this 7 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/apisix#14003 · 1 assignee ·
Maintainers usually reply within 2 days
-
bug: datadog plugin drops service_name tag when service has no name configuredPossibly taken @bhuvan-somisetty claimed this 35 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nvim-tree/nvim-tree.lua#3383 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Balatro-Multiplayer/BalatroMultiplayerPvP#620 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Balatro-Multiplayer/BalatroMultiplayerAPI#55 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
silverbulletmd/silverbullet#2231 ·
Maintainers usually reply within 2 days