Skip to content

fix(ai): the MCP benchmark tool takes no server URL - #2707

Merged
dan-petty merged 3 commits into
mainfrom
fix/2638-mcp-benchmark-no-server-url
Oct 29, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/2638-mcp-benchmark-no-server-url

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The MCP tool ai_benchmark published the option servers, and its models option took model@url entries. The model that calls the tool gave both. The benchmark sent POST {url}/api/chat to each URL, and a URL that ends in ?x= let the caller choose the path. So a model could send POST requests with a prompt body to any path of any loopback service of the host. The cause is the same as in #2480, #2634 and #2637: input from a caller is used as configuration.

  • The tool publishes no servers option. A call that gives it fails at the argument contract and sends no request. The change adds one entry to _PATH_PARAM_RESTRICTIONS.
  • The tool refuses a model@url entry of models before any command runs. The check uses parse_model_list and parse_model_spec, the functions that the command uses. A JSON Schema pattern does not fit: the refusal layer has no kind or text for it.
  • The tool benchmarks on the servers of ai.ollama_urls, at the configured egress level.
  • devops ai benchmark keeps --servers and model@url for a person at the command line.
  • The refusal reuses ERRORS.mcp.model_names_endpoint, which had no caller since the generated tool replaced the hand-written one. The --models help text says that the MCP tool refuses model@url. The generated documents carry the text.

Change: openspec/changes/archive/2026-10-29-2638-mcp-benchmark-no-server-url/

Closes #2638

The tests call ai_benchmark through a FastMCP client. A servers argument and a
model@url entry must fail and reach no socket. The tool must benchmark on the
configured server, and the command must keep both options for a person.
The MCP tool ai_benchmark published servers, and its models option took a
model@url entry. The model that calls the tool gave both, and the benchmark
sent POST requests to any path of any loopback service.

The tool now publishes no servers option and refuses a model@url entry before
any command runs. It benchmarks on the servers of ai.ollama_urls. The command
keeps --servers and model@url for a person at the command line.

Plans the change 2638-mcp-benchmark-no-server-url.
@dan-petty dan-petty added scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak labels Oct 29, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results after the rebase onto origin/main (b4669f6):

  • tests/test_ai_benchmark_mcp_tool.py, tests/test_ai_benchmark.py, tests/test_mcp.py and tests/test_fastmcp_contracts.py: 286 passed.
  • devops docs check and devops openspec check pass. The pre-push hook passed.

Fail-to-pass (devops ci fail-to-pass --base origin/main), 4 of the 10 new tests fail on the base tree and the other 6 pass on it. The 6 show that the configured server, the configured egress level and the command line options for a person did not change:

Bytecode compiled 18402 files in 445ms
ℹ Quality gate root: /workspaces/devops-cli/.data/agent/worktrees/w-2638
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[loopback without the flag]
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_command_runs_on_the_server_that_a_person_types[servers]
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_tool_benchmarks_each_model_on_the_configured_server
  failed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_tool_publishes_no_servers_parameter (AssertionError: assert {'ai_benchmar...rrency', ...]} ==
  failed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_a_model_endpoint_is_refused_and_reaches_no_socket[one entry] (AssertionError: assert (False, Fals
  failed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_a_servers_argument_is_refused_and_reaches_no_socket (AssertionError: assert (False, False...768}}
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[private without the flag]
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_command_runs_on_the_server_that_a_person_types[model endpoint]
  passed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[private with the flag]
  failed on base: tests.test_ai_benchmark_mcp_tool.TestBenchmarkToolTakesNoServerUrlFromTheModel::test_a_model_endpoint_is_refused_and_reaches_no_socket[second entry] (AssertionError: assert (False, F
4 failed on base (4 failed and 6 passed in tests/test_ai_benchmark_mcp_tool.py; 0 errored).
Elapsed: 55s

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 22:35
@dan-petty
dan-petty merged commit 7f7f84b into main Oct 29, 2026
18 checks passed
@dan-petty
dan-petty deleted the fix/2638-mcp-benchmark-no-server-url branch October 29, 2026 22:35
dan-petty pushed a commit that referenced this pull request Oct 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.21.0](v0.20.0...v0.21.0)
(2026-10-29)


### Features

* **telemetry:** count the project items by release tag, not by
milestone ([#2710](#2710))
([253a97d](253a97d))


### Bug Fixes

* **ai:** the MCP benchmark tool takes no server URL
([#2707](#2707))
([7f7f84b](7f7f84b)),
closes [#2638](#2638)
* **rag:** name the Qdrant span server by host and port
([#2705](#2705))
([57725c3](57725c3)),
closes [#2459](#2459)
* **roadmap:** take a plan that a person merged as a Planned item
([#2718](#2718))
([043463b](043463b)),
closes [#2714](#2714)
* **security:** pin tflint; remove dive and devops docker analyze-layers
([#2712](#2712))
([244bafb](244bafb))
* **vault:** the MCP tool vault_status takes no address
([#2706](#2706))
([68c226c](68c226c)),
closes [#2639](#2639)


---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/security Security linters (trivy, bandit, gitleaks, kubeconform) and Vault type/security Type security: a vulnerability or a leak

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ai): a server url that the mcp tool ai_benchmark gets from the model reaches loopback with post requests

1 participant