Conversation
pkg/cmd/mcpserver/main.go
Outdated
| } | ||
|
|
||
| func ValidatePlugin(ctx context.Context, req *mcp.CallToolRequest, input Input) (*mcp.CallToolResult, Output, error) { | ||
| return nil, Output{}, nil |
There was a problem hiding this comment.
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.
abbd531 to
8b5e130
Compare
pkg/service/validator.go
Outdated
| @@ -0,0 +1,228 @@ | |||
| package service | |||
There was a problem hiding this comment.
Extracted from plugincheck2/main.go.
scripts/install-mcp.sh
Outdated
| 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\"" |
There was a problem hiding this comment.
.local/bin exists both on macos and linux
pkg/utils/utils.go
Outdated
|
|
||
| // HasProperArchiveStructure checks if the archive has the proper structure: | ||
| // single top-level directory containing plugin.json | ||
| func HasProperArchiveStructure(archiveDir string) bool { |
There was a problem hiding this comment.
plugincheck2 used to check this using GetIdAndVersion from quickmeta and if it returns error it would add an invalid structure report to the result.
1fd98f8 to
8ef2faf
Compare
| } | ||
|
|
||
| func main() { | ||
| if err := run(); err != nil { |
There was a problem hiding this comment.
https://grafana.com/blog/how-i-write-http-services-in-go-after-13-years/ -> func main() only calls run()
academo
left a comment
There was a problem hiding this comment.
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:
- 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.
- 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.
fd63cb4 to
e98427b
Compare
pkg/cmd/mcpserver/main_test.go
Outdated
|
|
||
| func TestValidatePlugin_InvalidZip(t *testing.T) { | ||
| // Skip if neither docker nor npx is available (e.g., in CI/CD) | ||
| if !isDockerAvailable() && !isNpxAvailable() { |
There was a problem hiding this comment.
We are running the tests locally. In CI it will be skipped due to docker and npx not present.
There was a problem hiding this comment.
Validator itself is tested in https://github.com/grafana/plugin-validator/blob/main/pkg/cmd/plugincheck2/main_test.go
There was a problem hiding this comment.
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.
adcd348 to
f23a7f9
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
7f1d1b1 to
947a09d
Compare
.github/workflows/release-mcp.yml
Outdated
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - run: git fetch --force --tags |
There was a problem hiding this comment.
curious on why we need this step. actions/checkout doesn't fetch tags?
There was a problem hiding this comment.
Yeah it came in from release.yml -> which was a requirement for old gorealeaser for generating the correct changelog.
.github/workflows/release-mcp.yml
Outdated
| - run: cd mcp-package && npm install | ||
| - run: cd mcp-package && npm publish | ||
|
|
||
| release-mcp-to-dockerhub: |
There was a problem hiding this comment.
since the running docker inside docker is so problematic,. let's skip the docker release?
| @@ -0,0 +1,183 @@ | |||
| # Grafana Plugin Validator MCP Server | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Exposes plugin-validator CLI as MCP server. Tool:
validate_plugin