Open
Conversation
sdks/mcp/src/openrag_mcp/config.py
Outdated
| def __init__(self): | ||
| self.openrag_url = os.environ.get("OPENRAG_URL", "http://localhost:3000") | ||
| self.api_key = os.environ.get("OPENRAG_API_KEY") | ||
| ibm_auth_enabled = _parse_bool("IBM_AUTH_ENABLED", False) |
Collaborator
There was a problem hiding this comment.
This is the tricky part since MCP app / pip install would not know about IBM Auth.
how about we handle it wrt to keys/ variables provided.
lets connect async on it
Collaborator
There was a problem hiding this comment.
Like the X-USERNAME etc?
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.
This pull request introduces support for IBM authentication as an alternative to API key authentication throughout the OpenRAG codebase. It updates configuration handling, client instantiation, and authentication logic to enable seamless use of IBM credentials when the
IBM_AUTH_ENABLEDenvironment variable is set. The changes ensure that API key requirements are relaxed when IBM authentication is available, and headers are constructed dynamically based on the authentication method in use.Authentication logic updates:
src/dependencies.pynow accepts IBM authentication via theX-IBM-LH-CredentialsandAuthorization: Bearer <jwt>headers whenIBM_AUTH_ENABLEDis set, constructing theUserobject accordingly.Configuration and client improvements:
Configclass insdks/mcp/src/openrag_mcp/config.pyno longer requires an API key if IBM authentication is enabled, and dynamically builds headers to include the API key only when present. [1] [2]get_openrag_clientfunction now instantiates theOpenRAGClientwith the API key from the config, supporting cases where the API key may be absent due to IBM authentication.OpenRAGClientinsdks/python/openrag_sdk/client.pyno longer raises an error if the API key is missing, and its headers property only adds theX-API-Keyheader when an API key is available, supporting IBM authentication scenarios. [1] [2]