Skip to content

Conversation

@xingyaoww
Copy link
Contributor

No description provided.

@xingyaoww xingyaoww changed the title Router / API Key Change Set API Key by setting constructor in router Apr 22, 2025
@xingyaoww xingyaoww changed the title Set API Key by setting constructor in router Set API Key by setting in router constructor Apr 22, 2025
@niechen niechen marked this pull request as ready for review April 25, 2025 11:52
Copilot AI review requested due to automatic review settings April 25, 2025 11:52
@niechen niechen changed the title Set API Key by setting in router constructor chore(router): Set API Key by setting in router constructor Apr 25, 2025
Copy link
Contributor

Copilot AI left a 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 API key support to the router by updating the RouterSseTransport and MCPRouter classes, and it refactors related tests.

  • Introduces an optional api_key parameter to RouterSseTransport and MCPRouter constructors.
  • Updates _validate_api_key methods in both transport and router modules to check the API key.
  • Adds tests in tests/test_profile.py to validate profile configuration functionality.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/test_profile.py Adds tests for profile operations without altering existing functionality.
src/mcpm/router/transport.py Introduces API key handling in RouterSseTransport, including new constructor parameter and updated _validate_api_key logic.
src/mcpm/router/router.py Updates the router's constructor to support API key and router_config, passing the API key to the transport, and adds global configuration logic.
Comments suppressed due to low confidence (1)

src/mcpm/router/router.py:241

  • The fallback block in _validate_api_key is unreachable due to the exhaustive preceding conditions; refactor the logic to ensure clarity and remove dead code.
        # Otherwise, fall back to the original validation logic

@JoJoJoJoJoJoJo JoJoJoJoJoJoJo requested a review from niechen April 28, 2025 03:33
@JoJoJoJoJoJoJo
Copy link
Contributor

JoJoJoJoJoJoJo commented Apr 28, 2025

Updated:

  • auth enable/disable and custom secret can be set with mcpm router set --auth/--no-auth --secret [custom secret]
  • if auth disabled for router, secret key check will be skipped
  • share will use the configured auth secret rather than generate a different one every time

@JoJoJoJoJoJoJo JoJoJoJoJoJoJo changed the title chore(router): Set API Key by setting in router constructor feat(router): Support custom api key and auth enable/disable in router Apr 30, 2025
@JoJoJoJoJoJoJo JoJoJoJoJoJoJo merged commit bf21d42 into pathintegral-institute:main Apr 30, 2025
3 checks passed
mcpm-semantic-release bot pushed a commit that referenced this pull request Apr 30, 2025
# [1.8.0](v1.7.1...v1.8.0) (2025-04-30)

### Features

* **router:** Support custom api key and auth enable/disable in router ([#106](#106)) ([bf21d42](bf21d42))
@mcpm-semantic-release
Copy link

🎉 This PR is included in version 1.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

4 participants