Skip to content

Conversation

@amondnet
Copy link

Summary

Add Claude Code plugin configuration to enable this MCP server as a Claude Code plugin.

Closes #315

Changes

  • Add .claude-plugin/plugin.json with plugin metadata
  • Add .claude-plugin/install-binary.sh for automatic binary installation
  • Plugin automatically downloads and extracts the correct binary for user's OS/architecture
  • Supports Linux (x86_64, arm64, i386), macOS (x86_64, arm64), and Windows (x86_64, arm64, i386)
  • Version pinned to v0.7.6

How it works

The install script:

  1. Detects user's OS (Darwin/Linux/Windows) and architecture (x86_64/arm64/i386)
  2. Downloads the appropriate archive (tar.gz or zip) from GitHub releases
  3. Extracts the binary to the plugin directory
  4. Caches the binary and only re-downloads if version changes

Installation

Users can add this plugin via a marketplace:

{
  "plugins": [
    {
      "name": "grafana",
      "description": "A Model Context Protocol (MCP) server for Grafana",
      "source": {
        "source": "github",
        "repo": "grafana/mcp-grafana"
      }
    }
  ]
}

Then install via:

/plugin install grafana@your-marketplace

The plugin will automatically download and configure the mcp-grafana binary on first use.

Platform Support

Platform Architectures
Linux x86_64, arm64, i386
macOS x86_64 (Intel), arm64 (Apple Silicon)
Windows x86_64, arm64, i386

Testing

The install script has been designed to work with Grafana's release format:

  • macOS/Linux: mcp-grafana_${OS}_${ARCH}.tar.gz containing mcp-grafana binary
  • Windows: mcp-grafana_${OS}_${ARCH}.zip containing mcp-grafana.exe binary

Related

@amondnet amondnet requested a review from a team as a code owner October 15, 2025 14:29
@CLAassistant
Copy link

CLAassistant commented Oct 15, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@sd2k sd2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! thanks for contributing this. I would like to solve the hardcoded version issue before merging. I'll work on this separately since it'll require a new CI workflow to bump versions I suspect.

The other question I had is around Windows compatibility. The script does handle the Windows OS case but still relies on Cygwin/Git Bash etc, so we would need a separate script for Powershell users, which I don't really want to maintain... I'm curious if there is a nicer solution. It's not a blocker though.

Add SHA256 checksum verification after downloading binary archives to ensure integrity. Downloads checksums.txt from the release and verifies using sha256sum (Linux) or shasum (macOS). Falls back gracefully with a warning if neither tool is available.

Addresses feedback from PR grafana#333 review.
Dynamically fetch the latest version from GitHub API and use the /latest/download redirect for downloading binaries and checksums. This eliminates the need to manually update the version in the script.

- Fetch latest tag_name from GitHub API
- Use /latest/download redirect URLs
- Compare against stored version to detect updates
- Gracefully handle API failures

Resolves the hardcoded version issue mentioned in PR grafana#333 review.
Add Node.js implementation as an alternative to bash script for better cross-platform support, especially for Windows PowerShell users.

Changes:
- Add install-binary.mjs with full Node.js implementation
- Fix checksum file URL to use correct format: mcp-grafana_VERSION_checksums.txt
- Improve JSON parsing in bash script (jq preferred, better grep fallback)
- Both scripts tested and working correctly

Node.js script benefits:
- Full cross-platform support (macOS, Linux, Windows)
- Uses Node.js built-in APIs (no external dependencies)
- SHA256 checksum verification
- Dynamic latest release detection

Bash script improvements:
- Better JSON parsing (supports jq and improved grep)
- Correct checksum file URL format

Both scripts now properly:
1. Fetch latest version from GitHub API
2. Download binary archives
3. Verify SHA256 checksums
4. Extract and install binaries
5. Track versions for updates

Addresses Windows compatibility discussion in PR grafana#333.
Add comprehensive CI testing for both bash and Node.js install scripts across multiple platforms.

Tests:
- Bash script on Linux and macOS
- Node.js script on Linux, macOS, and Windows
- Multiple Node.js versions (18, 20, 22)
- Checksum verification for both scripts
- Version update detection (skip re-download)

This ensures:
1. Both scripts work on all supported platforms
2. Checksums are properly verified
3. Version tracking prevents unnecessary downloads
4. Scripts remain compatible with new releases

Workflow triggers:
- Pull requests affecting .claude-plugin/**
- Pushes to main
- Manual dispatch
Add support for GITHUB_TOKEN environment variable to avoid API rate limiting in CI environments.

Changes:
- Bash script: Use Authorization header when GITHUB_TOKEN is available
- Node.js script: Use Authorization header when GITHUB_TOKEN is available
- CI workflow: Pass GITHUB_TOKEN to all test steps

This fixes the 403 errors encountered in GitHub Actions when calling the GitHub API without authentication. The scripts remain backward compatible and work without the token in normal usage.
Capture and display full script output in checksum verification tests to help diagnose failures. This makes it easier to debug issues when tests fail in CI.
Copy link
Collaborator

@sd2k sd2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks for the extra changes!

I might be missing something here but how is the mjs script being executed right now? Should we just remove the bash script and always use the JS one instead in plugin.json?

The project uses Apache License 2.0, not AGPL-3.0. Update plugin.json to reflect the correct license.
@amondnet
Copy link
Author

For Windows support, I've implemented Option 2 (Node.js script) as an alternative:

  • Full cross-platform support (macOS, Linux, Windows PowerShell)
  • Since Claude Code users have Node.js available, no additional dependencies needed
  • Uses only Node.js built-in APIs
  • Both bash and Node.js scripts tested and working

The bash script remains the default, but the Node.js script provides a path forward for better Windows-native experience. Both scripts now:

  • Dynamically fetch latest version from GitHub API
  • Verify SHA256 checksums properly
  • Support automatic updates

Let me know your preference on which script to use as the primary implementation!

Drop Node.js 18 as it reaches EOL in April 2025. Test with currently supported LTS versions (20, 22) and latest stable (24).
@sd2k
Copy link
Collaborator

sd2k commented Oct 28, 2025

Thanks so much. I think we can use the Node script as the primary (or even only) implementation, since it's cross platform.

Remove install-binary.sh in favor of install-binary.mjs for better cross-platform compatibility. Update plugin.json to use Node.js as the command runner and remove all bash-related workflow tests.
@amondnet
Copy link
Author

@sd2k I've migrated the plugin to use Node.js-only installation.

@amondnet amondnet requested a review from sd2k November 1, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Claude Code Plugin / Marketplace

3 participants