-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Add multiple LLM API support for MCP Server #147785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple LLM API support for MCP Server #147785
Conversation
Hey there @allenporter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for selecting and handling multiple LLM APIs in the MCP Server integration.
- Config flow updated to use a multi-select for
CONF_LLM_HASS_API
and validate that at least one API is chosen. - The
create_server
function signature now accepts either a single ID or a list of IDs. - Tests and fixtures have been updated to use
list[str]
forCONF_LLM_HASS_API
and new error handling.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/components/mcp_server/test_http.py | Adapted to expect a list of LLM API IDs in config entry |
tests/components/mcp_server/test_config_flow.py | Updated form tests to use list input and added error test for empty selection |
tests/components/mcp_server/conftest.py | Changed fixtures to return `str |
homeassistant/components/mcp_server/strings.json | Added new llm_api_required error message |
homeassistant/components/mcp_server/server.py | Modified create_server signature to accept multiple IDs |
homeassistant/components/mcp_server/config_flow.py | Switched LLM API selector to multiple=True and added validation |
Comments suppressed due to low confidence (3)
homeassistant/components/mcp_server/server.py:44
- Add a test case that calls
create_server
with multiple API IDs to verify the new list support and expected behavior.
async def create_server(
homeassistant/components/mcp_server/server.py:44
- Update the docstring to reflect that
llm_api_id
can now bestr | list[str]
and describe how multiple IDs are handled.
async def create_server(
homeassistant/components/mcp_server/server.py:44
- The signature now allows a list of IDs, but the implementation likely only handles a single string. Ensure
create_server
iterates over the list of IDs (or otherwise handles multiple values) so it doesn’t break when more than one API is passed.
async def create_server(
Co-authored-by: Copilot <[email protected]>
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Co-authored-by: Allen Porter <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying it, appreciate it.
* Add multiple LLM API support for MCP Server * Update homeassistant/components/mcp_server/config_flow.py Co-authored-by: Copilot <[email protected]> * ruff * Update tests/components/mcp_server/conftest.py Co-authored-by: Allen Porter <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Allen Porter <[email protected]>
Proposed change
Add multiple LLM API support for
mcp_server
.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: