-
Notifications
You must be signed in to change notification settings - Fork 881
feat(cli): make MCP server work without user authentication #17688
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
Merged
ThomasK33
merged 1 commit into
main
from
thomask33/05-06-feat_mcp_add_support_for_running_mcp_server_without_user_authentication
May 7, 2025
Merged
feat(cli): make MCP server work without user authentication #17688
ThomasK33
merged 1 commit into
main
from
thomask33/05-06-feat_mcp_add_support_for_running_mcp_server_without_user_authentication
May 7, 2025
Conversation
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
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a0e7857
to
5ffda26
Compare
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 enables the MCP server to run without user authentication.
- Replaces the mandatory coder client check in the dependencies with support for a nil client for unauthenticated operation.
- Introduces a new TryInitClient middleware and updates logging and tool filtering for tools that don’t require an authenticated user.
- Updates tests to verify that the server runs correctly without user authentication while still supporting tools that rely solely on an agent token.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
codersdk/toolsdk/toolsdk.go | Updated dependency initialization and added a flag (UserClientOptional) to mark tools that can run without a user client. |
cli/root.go | Introduced TryInitClient to allow initialization without errors when credentials are missing. |
cli/exp_mcp_test.go | Updated error expectations in tests and added a new test to confirm operation with just an agent token. |
cli/exp_mcp.go | Modified middleware usage and adjusted authentication logging and tool filtering logic. |
Files not reviewed (1)
- flake.nix: Language not supported
937e55a
to
4deeaf3
Compare
5582625
to
6cc32e3
Compare
kylecarbs
approved these changes
May 7, 2025
…tion Change-Id: Iab480d38764eddee294a4e8cd35a9dc52add6010 Signed-off-by: Thomas Kosiewski <[email protected]>
6cc32e3
to
bc33d16
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Part of #17649
Allow MCP server to run without authentication
This PR enhances the MCP server to operate without requiring authentication, making it more flexible for environments where authentication isn't available or necessary. Key changes:
InitClient
withTryInitClient
to allow the MCP server to start without credentialscoder_report_task
tool available with just an agent token (no user token required)These changes allow the MCP server to function in more environments while still using authentication when available, improving flexibility for CI/CD and other automated environments.