Skip to content

fix: Auto-select free port for I/Q MCP server#169

Merged
hanno-becker merged 1 commit intoawslabs:mainfrom
ike-mulder-aws:iq-select-free-port
Mar 16, 2026
Merged

fix: Auto-select free port for I/Q MCP server#169
hanno-becker merged 1 commit intoawslabs:mainfrom
ike-mulder-aws:iq-select-free-port

Conversation

@ike-mulder-aws
Copy link
Copy Markdown
Contributor

@ike-mulder-aws ike-mulder-aws commented Mar 6, 2026

Description of changes:

Scan ports starting from 8765 to avoid conflicts when multiple Isabelle/jEdit sessions run concurrently. The actual bound port is published via a JVM system property so the Isabelle Assistant in the same process connects to the correct instance.

  • IQPlugin: scan ports 8765–8864, set/clear system property iq.mcp.port
  • IQMcpClient: read port from system property, deduplicate socket creation

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@hanno-becker
Copy link
Copy Markdown
Contributor

Have you looked into the other ports used as well? I/Q has a port for its MCP server, the ML repl has a port, and repl.py also offers direct MCP access to the I/R REPL outside of I/Q. By default, the ports 9148,9147,9146 are used IIRC.

@ike-mulder-aws
Copy link
Copy Markdown
Contributor Author

Have you looked into the other ports used as well? I/Q has a port for its MCP server, the ML repl has a port, and repl.py also offers direct MCP access to the I/R REPL outside of I/Q. By default, the ports 9148,9147,9146 are used IIRC.

I haven't, no. I mainly wanted to be able to open both a local and a remote Isabelle instance, both with functional I/Q and assistants. I'll point Kiro at it and see if it makes sense to combine these

@hanno-becker
Copy link
Copy Markdown
Contributor

hanno-becker commented Mar 16, 2026

I rebased your PR top #179 in this branch so we can see which port was chosen in the Isabelle GUI. I don't seem to be able to force-push here. Can you check and update your PR if you agree?

Copy link
Copy Markdown
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

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

LGTM! The other ports in use by the various I/Q and I/R components have been generalized elsewhere.

Scan ports starting from 8765 to avoid conflicts when multiple
Isabelle/jEdit sessions run concurrently. The actual bound port is
published via a JVM system property so the Isabelle Assistant in the
same process connects to the correct instance.

- IQPlugin: scan ports 8765–8864, set/clear system property iq.mcp.port
- IQMcpClient: read port from system property, deduplicate socket creation
@hanno-becker hanno-becker merged commit 71d6140 into awslabs:main Mar 16, 2026
17 checks passed
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.

2 participants