Enterprise Open source

Build, test, and lint

Contributions are welcome. Open an issue or pull request on GitHub. This project is written in Go.

What you’ll achieve

You can run the server from source, execute the test suites, and run linters locally.

Before you begin

  • Go installed for your platform.
  • Optional: Docker for integration tests.

Run the server locally

STDIO (default for local development):

Bash
make run

SSE:

Bash
go run ./cmd/mcp-grafana --transport sse

Build and run the Docker image

Build the image:

Bash
make build-image

Run in SSE mode (image default):

Bash
docker run -it --rm -p 8000:8000 mcp-grafana:latest

Run in stdio mode:

Bash
docker run -it --rm mcp-grafana:latest -t stdio

Run tests

There are three types of tests available: unit tests, integration tests, and cloud tests.

Unit tests (no external dependencies required):

Bash
make test-unit

You can also run:

Bash
make test

Integration tests (requires Docker containers):

Bash
make test-integration

Cloud tests (requires Grafana Cloud instance and credentials):

Bash
make test-cloud

Note: Cloud tests are automatically configured in CI. For local development, you’ll need to set up your own Grafana Cloud instance and credentials.

For the full integration suite, start the supporting services first (Grafana and its dependencies on port 3000):

Bash
make run-test-services
make test-integration

If you add tools, add integration tests; existing tests are a good template.

Run linters

Bash
make lint

The repository includes a custom linter for unescaped commas in jsonschema struct tags (description fields must be escaped with \\, to avoid truncation). Run only that linter:

Bash
make lint-jsonschema

Refer to the JSONSchema linter README in the repository.

Next steps