@daanrongen/grafana-mcp 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -30
- package/dist/main.js +6 -3
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -5,28 +5,28 @@ MCP server for [Grafana](https://grafana.com/) — manage dashboards, datasource
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
bunx @daanrongen/grafana-mcp
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Tools (17 total)
|
|
12
12
|
|
|
13
|
-
| Domain | Tools
|
|
14
|
-
| --------------- |
|
|
15
|
-
| **Dashboards** | `list_dashboards`, `get_dashboard`, `create_dashboard`, `update_dashboard`, `delete_dashboard` | Full dashboard lifecycle
|
|
16
|
-
| **Datasources** | `list_datasources`, `get_datasource`, `create_datasource`, `delete_datasource`
|
|
17
|
-
| **Alerts** | `list_alert_rules`, `get_alert_rule`, `list_alert_instances`
|
|
18
|
-
| **Folders** | `list_folders`, `create_folder`, `delete_folder`
|
|
19
|
-
| **Annotations** | `list_annotations`, `create_annotation`
|
|
20
|
-
| **Health** | `health_check`
|
|
13
|
+
| Domain | Tools | Coverage |
|
|
14
|
+
| --------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
15
|
+
| **Dashboards** | `list_dashboards`, `get_dashboard`, `create_dashboard`, `update_dashboard`, `delete_dashboard` | Full dashboard lifecycle |
|
|
16
|
+
| **Datasources** | `list_datasources`, `get_datasource`, `create_datasource`, `delete_datasource` | Datasource management |
|
|
17
|
+
| **Alerts** | `list_alert_rules`, `get_alert_rule`, `list_alert_instances` | Alert rules and firing Alertmanager instances |
|
|
18
|
+
| **Folders** | `list_folders`, `create_folder`, `delete_folder` | Folder organisation |
|
|
19
|
+
| **Annotations** | `list_annotations`, `create_annotation` | Dashboard and global annotations |
|
|
20
|
+
| **Health** | `health_check` | Grafana instance status |
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Configuration
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
| Variable | Required | Description |
|
|
25
|
+
| ----------------- | -------- | ----------------------------------------------- |
|
|
26
|
+
| `GRAFANA_URL` | Yes | Grafana base URL (e.g. `http://localhost:3000`) |
|
|
27
|
+
| `GRAFANA_API_KEY` | Yes | Grafana service account token or API key |
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
| ----------------- | -------- | --------------------------------------------------- |
|
|
28
|
-
| `GRAFANA_URL` | Yes | Grafana base URL (e.g. `http://localhost:3000`) |
|
|
29
|
-
| `GRAFANA_API_KEY` | Yes | Grafana service account token or API key |
|
|
29
|
+
## Setup
|
|
30
30
|
|
|
31
31
|
### Claude Desktop
|
|
32
32
|
|
|
@@ -37,8 +37,8 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
37
37
|
"mcpServers": {
|
|
38
38
|
"grafana": {
|
|
39
39
|
"type": "stdio",
|
|
40
|
-
"command": "
|
|
41
|
-
"args": ["
|
|
40
|
+
"command": "bunx",
|
|
41
|
+
"args": ["@daanrongen/grafana-mcp"],
|
|
42
42
|
"env": {
|
|
43
43
|
"GRAFANA_URL": "http://localhost:3000",
|
|
44
44
|
"GRAFANA_API_KEY": "your-service-account-token"
|
|
@@ -48,13 +48,13 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
### Claude Code CLI
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
claude mcp add grafana \
|
|
55
55
|
-e GRAFANA_URL=http://localhost:3000 \
|
|
56
56
|
-e GRAFANA_API_KEY=your-service-account-token \
|
|
57
|
-
--
|
|
57
|
+
-- bunx @daanrongen/grafana-mcp
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
## Development
|
|
@@ -63,25 +63,46 @@ claude mcp add grafana \
|
|
|
63
63
|
bun install
|
|
64
64
|
bun run dev # run with --watch
|
|
65
65
|
bun test # run test suite
|
|
66
|
+
bun run typecheck # type-check with tsc
|
|
67
|
+
bun run lint # biome lint
|
|
68
|
+
bun run format # biome format
|
|
66
69
|
bun run build # bundle to dist/main.js
|
|
67
|
-
bun run inspect # open MCP Inspector in browser
|
|
68
70
|
```
|
|
69
71
|
|
|
72
|
+
## Inspecting locally
|
|
73
|
+
|
|
74
|
+
Use the MCP Inspector to browse and call tools interactively against a real Grafana instance:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
GRAFANA_URL=http://localhost:3000 \
|
|
78
|
+
GRAFANA_API_KEY=your-service-account-token \
|
|
79
|
+
bun run inspect
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This opens the MCP Inspector UI in the browser, pointed at the locally built server.
|
|
83
|
+
|
|
70
84
|
## Architecture
|
|
71
85
|
|
|
72
86
|
```
|
|
73
87
|
src/
|
|
74
|
-
├── config.ts
|
|
75
|
-
├── main.ts
|
|
88
|
+
├── config.ts # Effect Config — GRAFANA_URL, GRAFANA_API_KEY
|
|
89
|
+
├── main.ts # Entry point — ManagedRuntime + StdioServerTransport
|
|
76
90
|
├── domain/
|
|
77
|
-
│ ├── GrafanaClient.ts
|
|
78
|
-
│ ├── errors.ts
|
|
79
|
-
│
|
|
91
|
+
│ ├── GrafanaClient.ts # Context.Tag service interface (port)
|
|
92
|
+
│ ├── errors.ts # GrafanaError, NotFoundError
|
|
93
|
+
│ ├── models.ts # Schema.Class models (Dashboard, Datasource, AlertRule, …)
|
|
94
|
+
│ ├── dashboards.test.ts # Domain tests using GrafanaClientTest
|
|
95
|
+
│ ├── datasources.test.ts # Domain tests using GrafanaClientTest
|
|
96
|
+
│ └── health.test.ts # Domain tests using GrafanaClientTest
|
|
80
97
|
├── infra/
|
|
81
|
-
│ ├── GrafanaClientLive.ts
|
|
82
|
-
│ └── GrafanaClientTest.ts
|
|
98
|
+
│ ├── GrafanaClientLive.ts # Layer using fetch against the Grafana HTTP API
|
|
99
|
+
│ └── GrafanaClientTest.ts # In-memory Ref-based test adapter
|
|
83
100
|
└── mcp/
|
|
84
|
-
├── server.ts
|
|
85
|
-
├── utils.ts
|
|
86
|
-
└── tools/
|
|
101
|
+
├── server.ts # McpServer wired to ManagedRuntime
|
|
102
|
+
├── utils.ts # formatSuccess, formatError
|
|
103
|
+
└── tools/ # dashboards.ts, datasources.ts, alerts.ts, folders.ts, annotations.ts, health.ts
|
|
87
104
|
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
package/dist/main.js
CHANGED
|
@@ -10984,7 +10984,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
|
|
|
10984
10984
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
10985
10985
|
var CursorSchema = string2();
|
|
10986
10986
|
var TaskCreationParamsSchema = looseObject({
|
|
10987
|
-
ttl:
|
|
10987
|
+
ttl: number2().optional(),
|
|
10988
10988
|
pollInterval: number2().optional()
|
|
10989
10989
|
});
|
|
10990
10990
|
var TaskMetadataSchema = object({
|
|
@@ -11138,7 +11138,8 @@ var ClientCapabilitiesSchema = object({
|
|
|
11138
11138
|
roots: object({
|
|
11139
11139
|
listChanged: boolean2().optional()
|
|
11140
11140
|
}).optional(),
|
|
11141
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
11141
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
11142
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
11142
11143
|
});
|
|
11143
11144
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
11144
11145
|
protocolVersion: string2(),
|
|
@@ -11163,7 +11164,8 @@ var ServerCapabilitiesSchema = object({
|
|
|
11163
11164
|
tools: object({
|
|
11164
11165
|
listChanged: boolean2().optional()
|
|
11165
11166
|
}).optional(),
|
|
11166
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
11167
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
11168
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
11167
11169
|
});
|
|
11168
11170
|
var InitializeResultSchema = ResultSchema.extend({
|
|
11169
11171
|
protocolVersion: string2(),
|
|
@@ -11278,6 +11280,7 @@ var ResourceSchema = object({
|
|
|
11278
11280
|
uri: string2(),
|
|
11279
11281
|
description: optional(string2()),
|
|
11280
11282
|
mimeType: optional(string2()),
|
|
11283
|
+
size: optional(number2()),
|
|
11281
11284
|
annotations: AnnotationsSchema.optional(),
|
|
11282
11285
|
_meta: optional(looseObject({}))
|
|
11283
11286
|
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daanrongen/grafana-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "MCP server for Grafana — manage dashboards, datasources, alerts, folders, and annotations over stdio",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin":
|
|
7
|
-
"grafana-mcp": "dist/main.js"
|
|
8
|
-
},
|
|
6
|
+
"bin": "./dist/main.js",
|
|
9
7
|
"main": "./dist/main.js",
|
|
10
8
|
"files": [
|
|
11
9
|
"dist"
|
|
12
10
|
],
|
|
13
11
|
"scripts": {
|
|
14
|
-
"start": "bun run src/main.ts",
|
|
15
12
|
"dev": "bun --watch src/main.ts",
|
|
16
|
-
"inspect": "DANGEROUSLY_OMIT_AUTH=true mcp-inspector bun
|
|
13
|
+
"inspect": "DANGEROUSLY_OMIT_AUTH=true mcp-inspector bun src/main.ts",
|
|
17
14
|
"build": "bun build src/main.ts --outfile dist/main.js --target bun",
|
|
18
15
|
"typecheck": "tsc -p tsconfig.check.json",
|
|
19
16
|
"test": "bun test",
|
|
@@ -25,6 +22,9 @@
|
|
|
25
22
|
"postversion": "git push --follow-tags"
|
|
26
23
|
},
|
|
27
24
|
"license": "MIT",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "git+https://github.com/daanrongen/grafana-mcp.git"
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"bun": ">=1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
44
|
-
"effect": "^3.
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
+
"effect": "^3.21.0",
|
|
45
45
|
"zod": "^3.24.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@biomejs/biome": "^2.4.
|
|
48
|
+
"@biomejs/biome": "^2.4.12",
|
|
49
49
|
"bun-types": "latest",
|
|
50
|
-
"lefthook": "^2.1.
|
|
50
|
+
"lefthook": "^2.1.5",
|
|
51
51
|
"typescript": "^5.8.3"
|
|
52
52
|
}
|
|
53
53
|
}
|