Skip to content

fix(installer): keep IPv6 brackets in generated transport URLs - #529

Merged
mrexodia merged 2 commits into
mrexodia:mainfrom
Lesereingrape:fix/installer-ipv6-transport-url
Sep 21, 2026
Merged

mrexodia merged 2 commits into
mrexodia:mainfrom
Lesereingrape:fix/installer-ipv6-transport-url

Conversation

@Lesereingrape

@Lesereingrape Lesereingrape commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #528

Problem

installer.py rebuilt URL authorities from urlparse(...).hostname, and
urlparse strips the brackets from an IPv6 literal. Re-joining host and port
with ":" therefore produced http://::1:13337/mcp, which is not a valid
authority: --config aborted with a traceback, and --install aborted after
install_ida_plugin() had already copied the plugin, i.e. half an install.

This is the second half of #525. That change made a wildcard IPv6 bind
discoverable (_connectable_host("::") == "::1"), server._resolve_ida_rpc
copies the discovered host into installer.IDA_HOST (server.py:245), and the
installer then formatted it without brackets.

Change

One helper, _transport_authority(host, port), that re-brackets a host
containing a colon, used at the six sites that build an authority:
normalize_transport_url, force_mcp_path, the two streamable-http/sse
branches in generate_mcp_config, and the two literals in print_mcp_config.
server.py:194 (DEFAULT_IDA_RPC, help text) and
idalib_server.py:317 (download base URL) have the same shape; I left them out
to keep this PR to the client-configuration path — happy to follow up if you
want them in scope.

Measurements (Windows 11, Python 3.12, base cae2fa8)

Measured with a throwaway tests/test_installer_transport_url.py (6 tests),
which the review asked to remove, so the branch now carries the installer.py
change only:

  • on base: 4 failed, 2 passed — the two passing ones were the IPv4 / named-host
    controls, so the failure was specific to IPv6
  • with the patch: 8 passed (that file + the existing
    tests/test_installer_scope_messages.py)

Full pytest tests -q, A/B on the same interpreter:

  • base cae2fa8 without this change: 1 failed, 248 passed, 114 subtests passed
  • with this change and that test file: 1 failed, 254 passed, 114 subtests passed

The one failure in both runs is pre-existing and unrelated:
tests/test_mcp_spec_http_e2e.py::Http11TransportTests::test_single_threaded_stop_closes_idle_keepalive_connection
(I reproduced it on an untouched base worktree).

End to end, on base:

$ python -m ida_pro_mcp.server --ida-rpc "http://[::1]:13337" --config
...
Exception: Invalid transport URL: http://::1:13337/mcp     (exit 1)

and with the patch the same command exits 0 and prints
"url": "http://[::1]:13337/mcp".

ruff check reports 2 findings on installer.py (I001 on the import block,
TRY002 on the pre-existing raise Exception); it reports the same 2 on base,
so this change adds none.

Note on CI

.github/workflows/idalib-tests.yml is the only workflow and it runs
ida-mcp-test in the IDA containers, not pytest tests, so the suite above is
not exercised here. To run it without IDA installed:

uv sync --extra dev   # or any env with the package importable
python -m pytest tests -q

Authorship disclosure

This PR was authored by an AI agent (no human reviewed the diff before
submission). All measurements above were executed and recorded by the agent on
the commits in this branch; the diff is now 1 file, +22/-6, after 593600c
removed the test file at review.

urlparse() strips the brackets from an IPv6 literal, so re-joining
hostname and port with ":" produced authorities no client can parse
(http://::1:13337/mcp). Route every authority through one helper that
re-brackets a host containing a colon.
Comment thread tests/test_installer_transport_url.py Outdated
":" produces an authority that no client can parse: http://::1:13337/mcp.
"""

import unittest

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 593600c — the test file is gone and the installer change is untouched.

@mrexodia
mrexodia merged commit 2c0424e into mrexodia:main Sep 21, 2026
1 check failed

This branch had an error being deployed

1 failed deployment
external-pr — 593600cc Deployed Sep 21, 2026 by Lesereingrape via approval #402
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.

--config and --install abort on an IPv6 IDA host: generated transport URL loses its brackets

2 participants