Fix: Environment Variable Propagation for Algolia Search Client#37
Open
acarbone wants to merge 3 commits intoalgolia:mainfrom
Open
Fix: Environment Variable Propagation for Algolia Search Client#37acarbone wants to merge 3 commits intoalgolia:mainfrom
acarbone wants to merge 3 commits intoalgolia:mainfrom
Conversation
…ables to properly connect
Search client
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.
Fix: Environment Variable Propagation for Algolia Search Client
Problem Description
The current implementation fails to properly instantiate the Algolia search client with environment variables when the "search" MCP tool is included in
MCP_ENABLED_TOOLS. This results in connection failures when attempting to search for indices and documents, as the search client cannot reach the Algolia instance due to missing authentication credentials and configuration.Error Symptoms:
Solution
Created a unified function for instantiating the Algolia search client that properly propagates environment variables across all search operations. This ensures consistent client configuration regardless of which MCP tools are enabled.
Key Changes:
Testing
MCP_ENABLED_TOOLS=""(empty/all tools enabled)Changes Made
Files Modified:
cmd/mcp/main.gopkg/mcputil/client.gopkg/search/search.goFunctionality:
🚀 Impact
Before: Search operations would fail when MCP tools were enabled due to missing environment variable propagation.
After: All search operations work consistently regardless of MCP tool configuration, with proper authentication and connection to Algolia servers.