Add MCP OAuth device flow for protected namespaces#4
Draft
Copilot wants to merge 13 commits intoclient-mcpfrom
Draft
Add MCP OAuth device flow for protected namespaces#4Copilot wants to merge 13 commits intoclient-mcpfrom
Copilot wants to merge 13 commits intoclient-mcpfrom
Conversation
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix limitation for verification link prompt in protected namespace
Add pelican_auth MCP tool for protected namespace authentication
Feb 3, 2026
… version Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
Add pelican_auth MCP tool for protected namespace authentication
Add pelican_auth MCP tool for protected namespaces and fix server timeout
Feb 3, 2026
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
Add pelican_auth MCP tool for protected namespaces and fix server timeout
Add MCP pelican_auth tool for protected namespace authentication
Feb 3, 2026
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
Add MCP pelican_auth tool for protected namespace authentication
Add MCP tools for protected namespace authentication via OAuth device flow
Feb 3, 2026
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
Add MCP tools for protected namespace authentication via OAuth device flow
Add MCP authentication tools for protected namespaces via OAuth device flow
Feb 3, 2026
…quent operations Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
Copilot
AI
changed the title
Add MCP authentication tools for protected namespaces via OAuth device flow
Add MCP OAuth device flow for protected namespaces
Feb 4, 2026
Update the tool description to explicitly instruct AI assistants to ask users for a destination directory before downloading. This prevents the LLM from guessing paths that may have permission issues. Changes: - Updated tool description to emphasize asking users for destination - Updated destination parameter description with prompt suggestion Co-authored-by: h2zh <61568048+h2zh@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MCP server couldn't access protected namespaces: no TTY for browser OAuth, MCP clients timeout at ~60s, and token iterator doesn't discover tokens saved to OSDF config.
OAuth2 Device Flow (
oauth2/oauth2.go)InitiateDeviceAuth()— returns verification URL without blockingPollDeviceAuth()— polls with context cancellation supportDeviceAuthInfostruct holds flow state between callsClient Wrappers (
client/acquire_token.go)InitiateDeviceAuth()— federation discovery + client registrationCompleteDeviceAuth()— returns(token, namespace, error)for cache keyingMCP Server State (
mcp/server.go)pendingAuthsmap for in-flight auth statecachedTokensmap keyed by namespace prefixgetTokenForURL()matches URLs to cached tokens via path prefixPELICAN_SKIP_TERMINAL_CHECK=trueon initMCP Tools (
mcp/tools.go)pelican_auth— initiates device flow, returns verification URL immediatelypelican_auth_complete— polls (45s timeout), caches token by namespacehandleDownload/Stat/List— auto-inject cached tokenspelican_download— updated description to require user-provided destinationExample Flow
Note: The verification link validity (typically 15 min) is server-driven via the OAuth
expires_inresponse field, not hardcoded.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.