Skip to content

Comments

feat: mcp server for validate plugin#518

Merged
s4kh merged 23 commits intomainfrom
feat-mcp-server
Feb 24, 2026
Merged

feat: mcp server for validate plugin#518
s4kh merged 23 commits intomainfrom
feat-mcp-server

Conversation

@s4kh
Copy link
Contributor

@s4kh s4kh commented Feb 17, 2026

Exposes plugin-validator CLI as MCP server. Tool: validate_plugin

  1. Separate release for mcpserver - published to npm
  2. MCP server uses npx to run the latest validator CLI
  3. Includes configs for vscode extension, claude code, openAI codex configs in the README

@s4kh s4kh moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Feb 17, 2026
}

func ValidatePlugin(ctx context.Context, req *mcp.CallToolRequest, input Input) (*mcp.CallToolResult, Output, error) {
return nil, Output{}, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to do same stuffs we do in plugincheck2/main.go (reading archive, checksum, etc.) Maybe extract those into separate package and reuse it.

@s4kh s4kh self-assigned this Feb 17, 2026
@s4kh s4kh force-pushed the feat-mcp-server branch 2 times, most recently from abbd531 to 8b5e130 Compare February 17, 2026 15:20
@@ -0,0 +1,228 @@
package service
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted from plugincheck2/main.go.

@s4kh s4kh marked this pull request as ready for review February 17, 2026 16:50
@s4kh s4kh requested review from a team as code owners February 17, 2026 16:50
echo -e "${YELLOW}Warning: $INSTALL_DIR is not in your PATH${NC}"
echo "Add the following to your ~/.bashrc or ~/.zshrc:"
echo ""
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.local/bin exists both on macos and linux


// HasProperArchiveStructure checks if the archive has the proper structure:
// single top-level directory containing plugin.json
func HasProperArchiveStructure(archiveDir string) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

plugincheck2 used to check this using GetIdAndVersion from quickmeta and if it returns error it would add an invalid structure report to the result.

}

func main() {
if err := run(); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@academo academo left a comment

Choose a reason for hiding this comment

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

I would like you to reconsider the approach for the mcp server

the validator already supports outputting as json, could you invoke the validator binary here and parse the output instead?

here are my two concerns with this approach:

  1. single source of truth: now we are effectively creating two different software that embed the same engine. I much rather prefer we keep a single entry point (the validator cli binary) and make MCP just another user, like for example github actions is an user of the validator, and ci-workflows, and the community pipeline.

We don't need to create separate binaries for those cases because we have a common serialized output any user can read.

  1. updates: this binary will be out of date very quickly. instead we can have this wrapper checking the latest version (once a day?), downloading it and executing it to get the json output.

I don't see a mechanism to update mcp servers, they need to auto-update. People that use the validator mainly use it via docker or npx that always pulls the latest version (except NPM when it wants to be a pain)

my bottom line: we can make this wrapper simply call npx or docker or yarn dlx or similar (support several fallbacks) and parse the json output.


func TestValidatePlugin_InvalidZip(t *testing.T) {
// Skip if neither docker nor npx is available (e.g., in CI/CD)
if !isDockerAvailable() && !isNpxAvailable() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are running the tests locally. In CI it will be skipped due to docker and npx not present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

CI has docker available.

Copy link
Contributor Author

@s4kh s4kh Feb 20, 2026

Choose a reason for hiding this comment

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

So we run the tests using mage -v build:ci inside a container which uses goalpine(Dockerfile) thus no docker or npm. I have created a new job inside the test.yml of the github workflows.

@s4kh s4kh requested a review from academo February 18, 2026 14:30
fetch-depth: 0
persist-credentials: false

- run: git fetch --force --tags
Copy link
Collaborator

Choose a reason for hiding this comment

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

curious on why we need this step. actions/checkout doesn't fetch tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it came in from release.yml -> which was a requirement for old gorealeaser for generating the correct changelog.

- run: cd mcp-package && npm install
- run: cd mcp-package && npm publish

release-mcp-to-dockerhub:
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the running docker inside docker is so problematic,. let's skip the docker release?

@@ -0,0 +1,183 @@
# Grafana Plugin Validator MCP Server
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel these instructions are going too far on how to set up. trying to cover every possible single client that could use it.

In reality most agents will work with adding

"mcpServers": {
    "grafana-plugin-validator": {
      "command": "npx",
      "args": ["-y", "@grafana/plugin-validator-mcp@latest"]
    }
  }

in the correct place and developers already know how to do that in their agent or can figure out how to do it.

What if we reduce all this text to a simple "hey, put this in your agent mpc settings. most of the times is in .mpc.json file" or something like that?

maybe we can give a direct command for agents that allow one-command setup without messing with files (e.g. claude code has a mcp command to add servers from the cli)

I feel most of these instructions will quickly be outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is mainly codex and claude code/desktop the content itself is same but the file locations are different. Codex uses .toml files for the config.

@s4kh s4kh requested a review from academo February 23, 2026 15:02
@s4kh s4kh merged commit 4de19a1 into main Feb 24, 2026
9 checks passed
@s4kh s4kh deleted the feat-mcp-server branch February 24, 2026 02:12
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

2 participants