Skip to content

Commit 8cb768a

Browse files
committed
Add optional docker-compose service for mcp-grafana; update Make targets
1 parent 18f06e2 commit 8cb768a

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ help: ## Print this help message.
66
@echo ""
77
@echo "Targets:"
88
@echo ""
9-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
9+
@grep -E '^[a-zA-Z_0-9-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1010

1111
.PHONY: build-image
1212
build-image: ## Build the Docker image.
@@ -28,7 +28,7 @@ test-unit: ## Run the unit tests (no external dependencies required).
2828
test: test-unit
2929

3030
.PHONY: test-integration
31-
test-integration: ## Run only the Docker-based integration tests (Requires docker containers to be up and running).
31+
test-integration: ## Run only the Docker-based integration tests (requires docker-compose services to be running, use `make run-test-services` to start them).
3232
go test -v -tags integration ./...
3333

3434
.PHONY: test-cloud
@@ -43,10 +43,15 @@ run: ## Run the MCP server in stdio mode.
4343
run-sse: ## Run the MCP server in SSE mode.
4444
go run ./cmd/mcp-grafana --transport sse
4545

46+
.PHONY: run-e2e-test-services
47+
run-e2e-test-services: ## Run the docker-compose services required for the Python E2E tests.
48+
COMPOSE_PROFILES=mcp docker-compose up -d --build
49+
50+
.PHONY: run-test-services
51+
run-test-services: ## Run the docker-compose services required for the unit and integration tests
52+
docker-compose up -d --build
53+
4654
.PHONY: test-python-e2e
47-
test-python-e2e: ## Run Python E2E tests (requires Docker, MCP server, and Python deps)
48-
docker-compose up -d
49-
nohup go run ./cmd/mcp-grafana -t sse > mcp.log 2>&1 &
50-
sleep 30
55+
test-python-e2e: ## Run Python E2E tests (requires docker-compose services to be running, use `make run-e2e-test-services` to start them).
5156
cd tests && uv sync --all-groups
5257
cd tests && uv run pytest

docker-compose.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,23 @@ services:
3636
command: -config.file=/etc/promtail/config.yml
3737
depends_on:
3838
- loki
39+
40+
mcp-grafana:
41+
profiles:
42+
- mcp
43+
build:
44+
context: .
45+
command:
46+
- /app/mcp-grafana
47+
- --transport
48+
- sse
49+
- --sse-address
50+
- 0.0.0.0:8000
51+
- --debug
52+
- --log-level
53+
- debug
54+
environment:
55+
MCP_PROMETHEUS_URL: http://prometheus:9090
56+
GRAFANA_URL: http://grafana:3000
57+
ports:
58+
- 8000:8000

0 commit comments

Comments
 (0)