Skip to content

chore: allow MCP to use reduced agent token scope #17858

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
merged 3 commits into from
May 15, 2025

Conversation

johnstcn and others added 3 commits May 15, 2025 18:08
This test was failing inside a Coder workspace due to
`CODER_AGENT_TOKEN` being set.

Signed-off-by: Thomas Kosiewski <tk@coder.com>
Part of #17649

Signed-off-by: Thomas Kosiewski <tk@coder.com>

---

# 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:

- Replaced `InitClient` with `TryInitClient` to allow the MCP server to start without credentials
- Added graceful handling when URL or authentication is missing
- Made authentication status visible in server logs
- Added logic to skip user-dependent tools when no authenticated user is present
- Made the `coder_report_task` tool available with just an agent token (no user token required)
- Added comprehensive tests to verify operation without authentication

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.
Change-Id: I67d271a426be98270ff4b3114466e16718e9a7d6
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 changed the title cherry pick: Allow MCP to use reduced agent token scope chore: cherry pick - Allow MCP to use reduced agent token scope May 15, 2025
@ThomasK33 ThomasK33 changed the title chore: cherry pick - Allow MCP to use reduced agent token scope chore: allow MCP to use reduced agent token scope May 15, 2025
@ThomasK33 ThomasK33 merged commit 4a70bdc into release/2.22 May 15, 2025
45 of 46 checks passed
@ThomasK33 ThomasK33 deleted the cherry-pick-release/2.22 branch May 15, 2025 18:13
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants