-
Notifications
You must be signed in to change notification settings - Fork 32
Pelican MCP for public namespaces #2808
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
Open
h2zh
wants to merge
7
commits into
PelicanPlatform:main
Choose a base branch
from
h2zh:client-mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
26f2b16 to
1279c1a
Compare
Member
jhiemstrawisc
left a comment
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.
I was mostly poking around the PR out of curiosity -- these comments were small things I noticed while nosing around.
1. mcp/types.go - All MCP protocol message structures (JSONRPCRequest, JSONRPCResponse, RPCError) - MCP-specific structures (InitializeParams, Tool, CallToolResult, etc.) 2. mcp/server.go - Server struct and core server logic - Request handling (initialize, list tools, call tools) - Response/error sending functions 3. mcp/tools.go - getToolsList() - Returns tool definitions - handleDownload() - Pelican download implementation - handleStat() - File metadata retrieval - handleList() - Directory listing
- Move config.InitClient() from server startup to lazy initialization - Initialize Pelican client only when first tool is called - Prevents corrupting JSON-RPC stream with startup errors - Fixes 'Invalid input' error in Claude Desktop - All logs go to stderr, stdout is clean JSON-RPC only (cherry picked from commit e8df70f)
- Handle 'initialized' notification (sent after initialize) - Don't respond to notifications (JSON-RPC requests without ID) - Remove omitempty from response ID field for spec compliance This fixes the 'Invalid input' error in Claude Desktop caused by responding to the 'initialized' notification when we shouldn't. (cherry picked from commit 4babe40)
- The global PersistentPreRunE in cmd/root.go already sets the logging level via config when --debug is present.
- Update the MCP docs to the requested one‑sentence‑per‑line style - Wording improvement
7 tasks
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.
This PR comes with Pelican Docs updates. Check out how to use this feature there (spoiler: only one command required!)
Benefits
This Model Context Protocol (MCP) integration enables researchers to access scientific datasets using natural language through AI assistants like Claude Code and VSCode Copilot. This positions Pelican at the forefront of the AI-powered scientific computing revolution and reach a wider user base.
MCP is the emerging standard for connecting AI to the real world. Think of it as "USB for AI assistants" - a standardized protocol that allows any MCP-compatible AI assistant (Claude, VS Code Copilot, Cline, etc.) to interact with external tools and data sources. As a data federation CLI tool, Pelican Client is a perfect fit as a MCP to plug in the Agentic AI world.
For users, no more sophisticated commands memorization required - AI can understand the most download demands. What's more, it can suggest the next step, even accomplish the entire workflow from data downloads to data analysis, eventually provides a report on its own.
System design in a nutshell
AI Assistant (e.g. VS Code Copilot) spawns a MCP server process, which is just a thin JSON-RPC wrapper around existing client API. The MCP server does NOT execute
pelican object getas a subprocess. Instead, it imports and calls the client library functions (e.g. client.DoGet) directly.Limitation
This MCP only supports public namespaces, because MCP cannot open an external browser to complete the OAuth flow. But since a large portion of Pelican usage is public data, this documented feature is ready for the production.