feat: auto-connect via RABBITMQ_* env vars for mcp-aggregator compatibility#42
Open
mrnicegyu11 wants to merge 2 commits into
Open
feat: auto-connect via RABBITMQ_* env vars for mcp-aggregator compatibility#42mrnicegyu11 wants to merge 2 commits into
mrnicegyu11 wants to merge 2 commits into
Conversation
Stdio MCP servers start fresh each session — no connection state survives. The LLM has to call initialize_connection before doing anything useful, and it forgets roughly half the time. Auto-connect from environment at startup when RABBITMQ_HOST, RABBITMQ_USERNAME, and RABBITMQ_PASSWORD are set. Optional: RABBITMQ_PORT, RABBITMQ_MANAGEMENT_PORT, RABBITMQ_USE_TLS, RABBITMQ_ALIAS. If env vars are absent, behavior is unchanged.
Member
the-mikedavis
left a comment
There was a problem hiding this comment.
This seems nice to have. Instead of many environment variables though we might be able to get away with a few URIs that contain all of the info:
export RABBITMQ_MANAGEMENT_ENDPOINT=http://guest:guest@localhost:15672
export RABBITMQ_AMQP_ENDPOINT=amqps://admin:pass@example.com:5671
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.
I run this server behind an MCP aggregator (fastmcp), and in that setup the subprocess of the mcp-server-rabbitmq does not stay around between calls. Whatever connection the LLM established through
initialize_connectionis gone by the next call. A bit tedious... This feature makes the situation a bit better.The env-var naming and such are fully up for discussion, in case you guys have preferences. I'd love to see this merged upstream, then I could basically stop using custom forks of the mcp-server-rabbitmq since it will work for my usecase fully then. :--) If not, no worries as well, thanks for your time and consideration.
Cheers
Issue #, if available: n/a
Description of changes:
This PR adds a small _auto_connect_from_env() step at startup. When RABBITMQ_HOST, RABBITMQ_USERNAME and RABBITMQ_PASSWORD are present in the environment, the server connects on spawn and registers a broker into the existing multi-broker registry. Tools are then usable from the first call. If the variables are not set, nothing changes — manual initialization still works exactly as before.
Optional variables: RABBITMQ_PORT (default 5671), RABBITMQ_MANAGEMENT_PORT, RABBITMQ_USE_TLS (default true), RABBITMQ_ALIAS.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.