{{ message }}
Repository navigation
fix(rpc): treat a blank IDA_MCP_URL as unset for download URLs - #539
Merged
Merged
Conversation
A blank or whitespace-only IDA_MCP_URL made truncated tool output advertise relative download paths like "/output/<id>.json", so the curl hint could not be used. The other IDA_MCP_* knobs already fall back to defaults for blank values; the download base url now does the same.
Covers blank/whitespace/unset values falling back to the local default and keeps the truncated-output download hint an absolute URL.
Owner
Contributor
Author
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Symptom
When
IDA_MCP_URLis present but empty (or whitespace only), truncated tool output advertises anunusable download location.
IDA_MCP_URLis a documented knob (README "Worker behavior") and.codex-plugin/mcp.jsonforwards it into the server environment, so an empty entry in a clientconfig or an env file is enough to hit this:
In the blank cases the
download_hintthe agent is told to run becomescurl -o .ida-mcp/<id>.json /output/<id>.json(or the same with leading spaces), which cannotresolve to any host, so the full result is effectively lost.
Two details make the blank value sticky:
ida_mcp/rpc.pyreados.environ.get("IDA_MCP_URL", "http://127.0.0.1:13337"), so an emptystring is accepted as a base URL and replaces the default.
idalib_server.pyonly applied the host/port fallback when the variable was absent(
if not "IDA_MCP_URL" in os.environ), so the blank value survived that guard too.What changes
A blank or whitespace-only
IDA_MCP_URLis now treated as "not set" by both readers.configured_download_base_url()returns the stripped value orNone, so the two call sites shareone rule:
ida_mcp/rpc.py: the module-level base URL falls back tohttp://127.0.0.1:13337instead of"".idalib_server.py: the host/port override triggers on "no usable URL configured" rather than"variable absent".
This is the same blank-value convention
e67d32cintroduced for the otherIDA_MCP_*knobs(
_env_float/_env_int/_parse_bool_env), and it keeps what #383 asked for: a non-blankconfigured URL is still used verbatim, once stripped.
How to reproduce
No IDA installation needed — it goes through the same seam the truncation tests use. Save as
_repro.pyin the repo root and runPYTHONPATH=src python _repro.py:On this branch all four lines come back absolute:
Checks
DownloadBaseUrlFromEnvTests, appended to the existingtests/test_mcp_spec_truncation.py(second commit, droppable on its own): on base
4e4b855that file reports4 failed, 14 passed, 13 subtests; with the fix16 passed, 15 subtests.PYTHONPATH=src python -m pytest tests/ -qwith the ida venv:4e4b855+ the new tests:5 failed, 252 passed, 115 subtests1 failed, 254 passed, 117 subtests(
test_mcp_spec_http_e2e.py::Http11TransportTests::test_single_threaded_stop_closes_idle_keepalive_connection,also the target of fix(zeromcp): let stop() return while a keep-alive client idles #527) and unrelated to this change.
ruff check src/ida_pro_mcp/ida_mcp/rpc.py src/ida_pro_mcp/idalib_server.py: clean.