- Notifications
You must be signed in to change notification settings - Fork905
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
feat(cli): make MCP server work without user authentication#17688
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ThomasK33 commentedMay 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This stack of pull requests is managed byGraphite. Learn more aboutstacking. |
a0e7857
to5ffda26
CompareThere 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
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
937e55a
to4deeaf3
Compare5582625
to6cc32e3
Compare…tionChange-Id: Iab480d38764eddee294a4e8cd35a9dc52add6010Signed-off-by: Thomas Kosiewski <tk@coder.com>
6cc32e3
tobc33d16
Compare29bce8d
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.