Skip to content

fix(ai): the MCP prewarm tool takes no URL from the model - #2677

Merged
dan-petty merged 4 commits into
mainfrom
fix/2637-ai-prewarm-mcp-url
Oct 29, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/2637-ai-prewarm-mcp-url

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The MCP tool ai_prewarm published the option url. A model could give a loopback URL that ends in ?x=. The tool then sent a POST request to any path of any loopback service. It also told the model if the answer was HTTP 200.

The tool now publishes no url option, through _PATH_PARAM_RESTRICTIONS. It prewarms the servers of ai.ollama_urls at the configured egress level. A call that gives url fails at the argument contract and sends no request. The command devops ai prewarm keeps --url for a person at the command line.

The cause is the same as in #2480 and #2634: input from a caller is used as configuration. The change adds the capability ai-prewarm and two tests that fail on main.

Related issues that this change does not cover: #2638 and #2639 (two other MCP tools with a URL option), #2670 (a wrong sentence in SECURITY.md) and #2676 (the prewarm output names a server by its configured URL).

Change: openspec/changes/archive/2026-10-29-2637-ai-prewarm-mcp-tool-no-url/

Closes #2637

The MCP tool ai_prewarm published the option url. A model could give a
loopback URL that ends in ?x=. The tool then sent a POST request to any
path of any loopback service, and told the model if the answer was
HTTP 200.

The tool now publishes no url option. It prewarms the servers of
ai.ollama_urls, at the configured egress level. A call that gives url
fails at the argument contract and sends no request. The command keeps
--url for a person at the command line.

This is the same cause as #2480 and #2634: input from a caller is used
as configuration. The change uses the _PATH_PARAM_RESTRICTIONS table of
the MCP generator and plans the work as an OpenSpec change.
The test of the configured servers checked only the request line, the
Host header and the reply text. It now reads the JSON body of each POST
request and checks the model name and the keep-alive value.
The design said that the model does not know the configured Ollama
URLs. The reply of the tool names each server by its URL, so the design
now says that and points to the issue for it. The proposal lists the
real callers of preload_models. The follow-up list names the new issue.
@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 at the head of this branch:

  • uv run devops ci test tests/test_ai_prewarm.py tests/test_mcp.py tests/test_fastmcp_contracts.py: 263 passed.
  • ruff check, ruff format --check, devops docs check and devops openspec check: passed.
  • An offline probe on main showed the defect. A loopback listener got POST /v1/sys/seal-status?x=/api/generate, and the tool replied "confirmed HTTP 200".

Output of uv run devops ci fail-to-pass --base origin/main (exit code 0):

ℹ Quality gate root: /workspaces/devops-cli/.data/agent/worktrees/w-2637
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmHelpers::test_resolve_prewarm_urls
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmHelpers::test_render_prewarm_results_console_and_json
  passed on base: tests.test_ai_prewarm.TestUnifiedLLMClientPrewarm::test_unified_client_prewarm_and_evict_delegation
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_cli_prewarm_evict_and_json_flag
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_a_prewarm_run_counts_once_by_model_evict_and_outcome[True-0-ok]
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_a_prewarm_run_counts_once_by_model_evict_and_outcome[False-1-failed]
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_cli_prewarm_single_node_flag
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_cli_prewarm_success_default_args
  passed on base: tests.test_ai_prewarm.TestCLIPrewarmCommand::test_cli_prewarm_failure_exits_code_1
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_preload_single_ollama_url_failure
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_execute_preload_all_callback_failure_handled
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_preload_single_ollama_url_success
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_preload_models_provider_guard
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_execute_preload_all_and_callback
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_preload_single_ollama_url_eviction_payload
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_preload_models_non_blocking_starts_thread
  passed on base: tests.test_ai_prewarm.TestOllamaProviderPrewarm::test_evict_models_and_prewarm_async_convenience_methods
  passed on base: tests.test_ai_prewarm.TestFastMCPPrewarmTool::test_ai_prewarm_tool_flag_injection_rejected
  passed on base: tests.test_ai_prewarm.TestFastMCPPrewarmTool::test_ai_prewarm_tool_dispatch
  passed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[loopback without the flag]
  passed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[private without the flag]
  passed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_tool_dials_the_configured_server_at_the_configured_level[private with the flag]
  failed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_a_url_argument_is_refused_and_reaches_no_socket (assert (False, False...ive":"1h"}')]) == (True, True, [], []))
  passed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_tool_prewarms_each_configured_server
  passed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_url_option_of_the_command_prewarms_the_host_that_a_person_types
  failed on base: tests.test_ai_prewarm.TestPrewarmToolTakesNoUrlFromTheModel::test_the_tool_publishes_no_url_parameter (AssertionError: assert {'ai_prewarm'...format', ...]} == {'ai_prewarm'...json_output']})
2 failed on base (2 failed and 24 passed in tests/test_ai_prewarm.py; 0 errored).

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 15:50
@dan-petty
dan-petty merged commit edf5325 into main Oct 29, 2026
17 checks passed
@dan-petty
dan-petty deleted the fix/2637-ai-prewarm-mcp-url branch October 29, 2026 15:51
dan-petty-release Bot added a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.16.6](v0.16.5...v0.16.6)
(2026-10-29)


### Bug Fixes

* **ai:** the MCP prewarm tool takes no URL from the model
([#2677](#2677))
([edf5325](edf5325)),
closes [#2637](#2637)

---
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 url that the mcp tool ai_prewarm gets from the model reaches loopback with a post request

1 participant