{"_id":"@seungje.jun/grafana-mcp","_rev":"8-da5925d06a3bbfdea7ff2b0267dcedef","name":"@seungje.jun/grafana-mcp","dist-tags":{"beta":"0.0.1-beta.0","latest":"0.1.4"},"versions":{"0.0.1-beta.0":{"name":"@seungje.jun/grafana-mcp","version":"0.0.1-beta.0","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.0.1-beta.0","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"0853a9f20733ff3515e6e30bd6f9ef0267bfaefb","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.0.1-beta.0.tgz","fileCount":98,"integrity":"sha512-K1SL/Ti6zmMPM2TxoD7PVOxoggM4QlieHPNIaUWgk5PwQsyrA/qRHcXaCZsrpTShL1/sw8UWY/NfL3EsSH4SDQ==","signatures":[{"sig":"MEUCIQDrNW+p4dChK4g9fj4yQYyrhe+f7WYypnnyXB4Qs6QLlAIgHYtdlccc1jlYB3rhfa2PZtVqaT/gwxFjxSA22plFtFU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":132566},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"760d3c3c6d74f1ec3c7fa575176f2c70483d0e07","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.0.1-beta.0_1776235337833_0.00026504844893859847","host":"s3://npm-registry-packages-npm-production"}},"0.0.1":{"name":"@seungje.jun/grafana-mcp","version":"0.0.1","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.0.1","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"1a7d8a8a09816fe133a3ff20ab6582273175d1c3","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.0.1.tgz","fileCount":107,"integrity":"sha512-DeHTO2ZRiTb8UMI/9LjFDVL9qKiz/zeBbJjiHBAsdgd2+obz3d5H7w1ECHKjiRB2ydRko0svGIWsQ/lruO+LRg==","signatures":[{"sig":"MEUCIQD7NJBjEE97LWzF6+Q+w4odJgVJJAnrY+WhrkrmTSf/zAIgI0SFnlaqMznmE372nSfIRuyYcob9MT8pW0eDbAC9Aes=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":162359},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"62b52f9f578c05420aa1754e8ab6216f980c251d","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.0.1_1776245932974_0.06462766438751211","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@seungje.jun/grafana-mcp","version":"0.0.2","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.0.2","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"c35e3856e24ffecf50bda1d7c570226b7c485cdf","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.0.2.tgz","fileCount":107,"integrity":"sha512-zjYYjxCVKVkVQcK+uXlcEFnazfKtvHofoMC4ilzSdplv4n89rAe39wSyDWR09cJ+pS1+HzL+fglmCb4DzFB92g==","signatures":[{"sig":"MEUCIDvgg82Djez2zjORZC4tMUwexTZdUuGX0TW2yLyCM1iCAiEAn0ZhQ+1kgcJpiz8QIWtS+oAAkGNVB3FhiEhGfFr1nfw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":162359},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"7d63ec9359c006bf70a73b3ccdcb4d7aa07028bd","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.0.2_1776304092461_0.7612217142802575","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@seungje.jun/grafana-mcp","version":"0.1.0","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.1.0","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"eba7d8e9fa2fbce90c3bcf6d6581da8355c41a9e","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.1.0.tgz","fileCount":127,"integrity":"sha512-3ThPM4RFO7F0/3ZvRXZ9+85H+h9JcLYCqv2HediDJmnCBjsmNqscuwp0/Z1mfi1TUSMpmsx/goeGDQzFSfnraA==","signatures":[{"sig":"MEUCIQCu/CWmDseDw0PQj4lz7WYO83m68I1OxdEdfTSy/m1mVwIgQpwfMv7kBI89/pduOAX3PuqSRt5Q3Q2biD7S1udsMio=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDiMiYnK0o1fEU28vh4VUgWVsPTjASpV3wvJ34YFCr8YQIgY6rlpKMJHc2m8z1CQBEr5yPb+xhdHOHZFnKD9ZI38MQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":202931},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"94f9fdb654a9db316b8fcd7bb97c087c7f116344","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.1.0_1791958539172_0.7680614930782226","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@seungje.jun/grafana-mcp","version":"0.1.1","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.1.1","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"0f4c9793e51f14b1b4a22995d51f69c9f529c34e","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.1.1.tgz","fileCount":131,"integrity":"sha512-Y3Earx4GYQCZ73/8N59cHDz+k73srgvIs/29EKpxqHD/7BV7PDhkD7uUAOK6DRr8EswKaEOilHMEP/Dmj7YlNg==","signatures":[{"sig":"MEUCIBO9Li7pMzMCimIFmDHqTjNbIWQygFpW/tws9qOPXTdEAiEAw9NLOdpzm59Kp1rNaa57XCwswZSOBX2jto5v+tJtOkY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIBo7n3LOL83cr9xAnH1vBF/i3ZRdz6wME6QjvaXiV+WsAiEAyCsRDrx4o/SBCru2AJhgb4VMdaMVeHplNWUNGHd33V0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":205984},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"c7a2a144cc10b5d4e29c43f726a9dec85aff6bd1","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.1.1_1791958960051_0.25650823831630776","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@seungje.jun/grafana-mcp","version":"0.1.2","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.1.2","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"018878b4526391d325e9ec99d53affbb4a393390","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.1.2.tgz","fileCount":135,"integrity":"sha512-IMe5yq3W8f2iqlgX6yLkaMWm3Z35tjxuo12XSNDJrR2j/Ds2yTGcWIXKyd5666yZcAWTZ08ac4U/Va+tZnJzRg==","signatures":[{"sig":"MEUCIQCPjjT0gh+IWcoS7QVzbPBYFw1IVV42ESsmpcssLEVciQIgRAM9GPs/IeaBcFNSdipIAK30X1gja6sHT9LloqqHnAg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDe6cFxKnElHW2Ug4bQoDXjGrYvlvG73Srj5jTuU0oWAQIgJdvX8AwlFOKw94BKFwjRNP/ktwobZ99ky7q4HL9Iu3A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":223566},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"gitHead":"763dd90432963628f1f17e6621e1586624089bab","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^20.9.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.1.2_1792035627363_0.9711840994041225","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@seungje.jun/grafana-mcp","version":"0.1.3","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"license":"MIT","_id":"@seungje.jun/grafana-mcp@0.1.3","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"bin":{"grafana-mcp":"dist/cli.js"},"dist":{"shasum":"7157e4a4d0fe12ac8c3f3f179b1959204715e3c6","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.1.3.tgz","fileCount":135,"integrity":"sha512-1l4tsbwCtD6SuwV8aN13GsXcJbWK9d/ljL6YNrPhDwHMGtjrQ6clwoEf2FEXUYZ15+9r2GO+M9ezk6X3wTDoSQ==","signatures":[{"sig":"MEUCIGOj79K9Q16SZIEz7ne8wtq8aXHilVU8+pwGS9ClyHCBAiEA+kn5Ni3G+q3D2XbF7RsNEhiwrDBSfWi91o30c/sjn/8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIHgcXTyF1YiNMEKA3QRviwAnx+3IoqEG3prcYJO0mImgAiB2T8lpfi6DQ5+wxB8HvHVByJy4GY9I04WFcUXN7ZnU9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":223598},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"gitHead":"c59d51f237a39157ec955bb70dcf3b8bbe47d39d","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"_npmUser":{"name":"seungje.jun","email":"ninanung0503@gmail.com"},"_npmVersion":"10.8.2","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"_nodeVersion":"20.19.0","dependencies":{"@modelcontextprotocol/sdk":"^1.32.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^22.0.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"tmp":"tmp/grafana-mcp_0.1.3_1793003964104_0.5274057127072789","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"_id":"@seungje.jun/grafana-mcp@0.1.4","bin":{"grafana-mcp":"dist/cli.js"},"bugs":{"url":"https://github.com/ninanung/grafana-mcp/issues"},"dist":{"shasum":"11d4ad2d629a701858044c2252c6da7bc308fdee","tarball":"https://registry.npmjs.org/@seungje.jun/grafana-mcp/-/grafana-mcp-0.1.4.tgz","fileCount":143,"integrity":"sha512-QA8fHKv2RK67bI7NwGb00DS0DhRKVnEsCvqHLiSvQ8r06vj5Jrez2wQCg944uqR89RCalAfGDkxS1JidO0BbFg==","signatures":[{"sig":"MEUCIGs96sEOtB7xrlbkJWOMUFlyL+hJyn90T4oyFipH93ydAiEAnzjGLa/J5yOrIS+cADHXyWUkr5qD83eZCu26p6P5Xuc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCuCwZ05zx0zqL7HzZu0pasKe/HZuWNIh93fw83PhAGZgIhANgO87AzHqeerh/RtXq5+/xIhif9DSqqvsFQ6FrjfF1m"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@seungje.jun%2fgrafana-mcp@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":225196},"main":"./dist/index.js","name":"@seungje.jun/grafana-mcp","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22"},"gitHead":"e0603ccfdaf5185afe47185c8442fdcf4985fa7e","license":"MIT","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc && tsc-alias && chmod +x dist/cli.js","start":"node dist/cli.js"},"version":"0.1.4","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"bd8981f9-f82b-4200-9733-4fa74e149857"}},"homepage":"https://github.com/ninanung/grafana-mcp#readme","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"repository":{"url":"git+https://github.com/ninanung/grafana-mcp.git","type":"git"},"_npmVersion":"11.19.0","description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","directories":{},"maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"_nodeVersion":"24.21.0","dependencies":{"@modelcontextprotocol/sdk":"^1.32.0"},"_hasShrinkwrap":false,"devDependencies":{"jiti":"^2.6.1","eslint":"^10.2.0","tsc-alias":"^1.8.16","typescript":"^5.2.2","@types/node":"^22.0.0","@typescript-eslint/parser":"^8.58.1","@typescript-eslint/eslint-plugin":"^8.58.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/grafana-mcp_0.1.4_1793004823449_0.279786060429974"}}},"time":{"created":"2026-04-15T06:42:17.739Z","modified":"2026-10-26T08:53:43.906Z","0.0.1-beta.0":"2026-04-15T06:42:17.988Z","0.0.1":"2026-04-15T09:38:53.113Z","0.0.2":"2026-04-16T01:48:12.650Z","0.1.0":"2026-10-14T06:15:39.259Z","0.1.1":"2026-10-14T06:22:40.173Z","0.1.2":"2026-10-15T03:40:27.463Z","0.1.3":"2026-10-26T08:39:24.190Z","0.1.4":"2026-10-26T08:53:43.538Z"},"license":"MIT","keywords":["grafana","mcp","model-context-protocol","dashboard","observability","claude","ai"],"description":"Grafana MCP server with multi-auth support (Service Account / API Key / Cloud / Basic)","maintainers":[{"name":"seungje.jun","email":"ninanung0503@gmail.com"}],"readme":"# grafana-mcp\n\n[![npm version](https://img.shields.io/npm/v/@seungje.jun/grafana-mcp.svg)](https://www.npmjs.com/package/@seungje.jun/grafana-mcp)\n[![license](https://img.shields.io/npm/l/@seungje.jun/grafana-mcp.svg)](./LICENSE)\n[![node](https://img.shields.io/node/v/@seungje.jun/grafana-mcp.svg)](https://nodejs.org)\n\nExpose a slice of the Grafana API as an MCP (Model Context Protocol) server, focused on natural-language log querying. The main goal: say \"show me error logs from the api service in the last 30 minutes\" and get the actual log lines back — without juggling LogQL, labels, or datasource UIDs by hand.\n\nLog datasources, Loki labels, and the mapping from a service name to its hosting datasource/label are cached on disk, so repeat calls skip redundant label scans.\n\n[한국어 문서 / Korean README](./README_kr.md)\n\n## Installation & Setup\n\nRequires Node.js 22 or later.\n\n### 1. Register Grafana instances\n\nCreate `~/.grafana-mcp/instances.json` with one or more Grafana URL + credential pairs, named however you like. One instance is enough to start.\n\n```json\n{\n  \"default\": \"dev\",\n  \"instances\": [\n    { \"name\": \"dev\", \"url\": \"https://grafana-dev.example.com\", \"service_account_token\": \"glsa_xxx\" },\n    { \"name\": \"prod\", \"url\": \"https://grafana.example.com\", \"service_account_token\": \"glsa_xxx\" }\n  ]\n}\n```\n\n```bash\nchmod 600 ~/.grafana-mcp/instances.json\n```\n\nSee [Multiple Grafana instances](#multiple-grafana-instances) for every field and rule.\n\n### 2. Register the MCP server\n\nNo `env` is needed — the server reads the instances file.\n\n**Claude Code** — user scope makes it available in every project (stored in `~/.claude.json`):\n\n```bash\nclaude mcp add grafana -s user -- npx @seungje.jun/grafana-mcp\n```\n\nUse `-s project` instead to share it through a `.mcp.json` at the project root.\n\n**Other MCP clients** (e.g. Claude Desktop) — add this to the client's MCP config:\n\n```json\n{\n  \"mcpServers\": {\n    \"grafana\": {\n      \"command\": \"npx\",\n      \"args\": [\"@seungje.jun/grafana-mcp\"]\n    }\n  }\n}\n```\n\nRestart the client (or start a new Claude Code session) to activate the MCP tools.\n\n### Build from source\n\n```bash\ngit clone https://github.com/ninanung/grafana-mcp.git\ncd grafana-mcp\nnpm install\nnpm run build\nclaude mcp add grafana -s user -- node /path/to/grafana-mcp/dist/cli.js\n```\n\nFor other clients, use `\"command\": \"node\"` and `\"args\": [\"/path/to/grafana-mcp/dist/cli.js\"]` in the JSON above.\n\n### Single instance via environment variables\n\nThe env-only setup still works: `GRAFANA_URL` + one credential variable is registered as an instance named `default`, and is merged with the instances file when both exist.\n\n```bash\nclaude mcp add grafana -s user \\\n  -e GRAFANA_URL=https://grafana.example.com \\\n  -e GRAFANA_SERVICE_ACCOUNT_TOKEN=glsa_xxx \\\n  -- npx @seungje.jun/grafana-mcp\n```\n\n```json\n{\n  \"mcpServers\": {\n    \"grafana\": {\n      \"command\": \"npx\",\n      \"args\": [\"@seungje.jun/grafana-mcp\"],\n      \"env\": {\n        \"GRAFANA_URL\": \"https://grafana.example.com\",\n        \"GRAFANA_SERVICE_ACCOUNT_TOKEN\": \"glsa_xxx\"\n      }\n    }\n  }\n}\n```\n\n### Multiple Grafana instances\n\nRegister as many URL + credential pairs as you need and switch between them in conversation — no MCP config edits or restarts.\n\n```json\n{\n  \"default\": \"dev\",\n  \"instances\": [\n    { \"name\": \"dev\", \"url\": \"https://grafana-dev.example.com\", \"service_account_token\": \"glsa_xxx\" },\n    { \"name\": \"prod\", \"url\": \"https://grafana.example.com\", \"service_account_token\": \"glsa_xxx\" },\n    { \"name\": \"team-b\", \"url\": \"https://grafana.example.com\", \"api_key\": \"eyXxx...\", \"org_id\": 2 }\n  ]\n}\n```\n\n- **Fields per instance**: `url` (required), one credential (`service_account_token` / `cloud_access_policy_token` / `api_key` / `username` + `password`), optional `name`, `org_id`, `tls_skip_verify`.\n- **Names are free-form** (`dev`, `qa`, `team-b`, ...) and matched case-insensitively. If `name` is omitted, the URL hostname is used. Names must be unique.\n- **Default**: the instance named by `default`, otherwise the first entry. A plain array of instances (without the wrapper object) is also accepted.\n- **Switching**: `use_instance name=\"prod\"` changes the active instance for the session; passing `instance: \"prod\"` to any tool targets it for that call only. Every Grafana tool result (including errors) is tagged with `[instance: <name>]` so you always know which Grafana answered.\n- **Hot reload**: edits to the file are picked up on the next tool call. If the edited file is invalid, the previous list stays in effect and the result carries a warning. (At startup, an invalid file stops the server with the reason.)\n- **Sources are merged**: the file, `GRAFANA_INSTANCES`, and `GRAFANA_URL` (registered as `default`) can be combined. At least one instance is required, otherwise the server refuses to start with setup instructions.\n- The file stores credentials in plain text — restrict it with `chmod 600 ~/.grafana-mcp/instances.json` (the server warns if other users can read it).\n\n### Authentication\n\nEach instance needs one credential. Use the field name in the instances file, or the environment variable for the `GRAFANA_URL` instance. They are checked in the order below — the first one present wins.\n\n| Instances file field | Environment variable | When to use |\n|----------------------|----------------------|-------------|\n| `service_account_token` | `GRAFANA_SERVICE_ACCOUNT_TOKEN` | Grafana 9.1+ (recommended) |\n| `cloud_access_policy_token` | `GRAFANA_CLOUD_ACCESS_POLICY_TOKEN` | Grafana Cloud |\n| `api_key` | `GRAFANA_API_KEY` | Legacy API Keys (deprecated in 10.x) |\n| `username` + `password` | `GRAFANA_USERNAME` + `GRAFANA_PASSWORD` | Basic Auth fallback |\n\nAll bearer-style tokens are sent as `Authorization: Bearer <token>`. The server does not care which kind of token it is — it only picks the one that is set.\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `GRAFANA_URL` | Grafana server URL, registered as an instance named `default`. Optional when an instances file or `GRAFANA_INSTANCES` provides at least one instance. |\n| `GRAFANA_INSTANCES_FILE` | (optional) Path of the instances file. Defaults to `~/.grafana-mcp/instances.json`. A leading `~/` is expanded to the home directory. See [Multiple Grafana instances](#multiple-grafana-instances). |\n| `GRAFANA_INSTANCES` | (optional) JSON array of instance objects (same shape as the file's `instances`). Merged with the file and `GRAFANA_URL`. Example: `[{\"name\":\"prod\",\"url\":\"...\",\"service_account_token\":\"...\"}]` |\n| `GRAFANA_ORG_ID` | (optional) Sent as `X-Grafana-Org-Id` header for the `GRAFANA_URL` instance. For multi-org setups. |\n| `GRAFANA_TLS_SKIP_VERIFY` | (optional) `true` / `1` to skip TLS verification for the `GRAFANA_URL` instance (self-signed Grafana). |\n| `GRAFANA_MCP_LOG` | (optional) Log level: `debug`, `info` (default), `warn`, `error`, `silent`. Logs go to stderr to avoid corrupting the MCP stdio channel. |\n| `GRAFANA_MCP_AUDIT_LOG` | (optional) Audit log file path. Defaults to `~/.grafana-mcp/audit.log`. Set to `off` to disable. Each line is a JSON record with tool name, resolved instance, args, duration, status, and the error message on failure. |\n| `GRAFANA_MCP_CACHE` | (optional) Set to `off` to disable the on-disk log cache. |\n| `GRAFANA_MCP_CACHE_PATH` | (optional) Log cache file path. Defaults to `~/.grafana-mcp/log-cache.json`. |\n| `GRAFANA_MCP_CACHE_TTL_DATASOURCES_MS` | (optional) TTL for the log-datasource list cache. Default `86400000` (24h). |\n| `GRAFANA_MCP_CACHE_TTL_LABELS_MS` | (optional) TTL for the Loki label-key cache. Default `86400000` (24h). |\n| `GRAFANA_MCP_CACHE_TTL_LABEL_VALUES_MS` | (optional) TTL for the Loki label-value cache. Default `3600000` (1h). |\n| `GRAFANA_MCP_CACHE_TTL_SERVICE_MS` | (optional) TTL for the `{service → (ds_uid, label)}` resolution cache. Default `3600000` (1h). |\n\n## Tools\n\nAll tools except `list_instances`, `use_instance`, and `get_log_cache` / `export_log_cache` / `import_log_cache` accept an optional `instance` argument to target a registered instance for that call only.\n\n| Tool | Description |\n|------|-------------|\n| `list_instances` | List registered instances (name, url, auth kind, source) and which one is active/default. Secrets are never shown |\n| `use_instance` | Switch the active instance for the session |\n| `self_test` | Diagnostic check — connectivity, version, auth, and capability probes (`list_datasources`, `datasource_proxy`, `ds_query`), including which fallback route is in use, with guidance on which arguments are required. Flags invalid/expired credentials (401) and tells you to replace them |\n| `list_datasources` | List all configured datasources. Falls back to `/api/frontend/settings` when the key is denied `/api/datasources` (403) |\n| `search_dashboards` | Search dashboards by query/tag/type |\n| `get_dashboard` | Fetch a dashboard's full JSON by uid |\n| `extract_dashboard_queries` | Extract panel queries (LogQL/PromQL) from a dashboard, with `datasource_uid`. Use to discover args for `query_logs.raw_logql` from a dashboard URL |\n| `list_log_datasources` | List only log-type datasources (Loki, Elasticsearch, CloudWatch, OpenSearch, Splunk). Cached |\n| `list_services` | List service names discoverable from Loki labels — useful before calling `query_logs`. A Loki datasource whose label API fails (e.g. unreachable) is listed with an `error` field instead of failing the whole call |\n| `query_logs` | Query logs for a service/time-range/level. Auto-detects the log datasource and service label. Supports `raw_logql` for multi-label/advanced selectors. On Grafana <9.0 (no uid-based datasource proxy) it uses the numeric-id proxy instead, and falls back to `/api/ds/query` when the proxy is unavailable. Output mode: `raw` / `summarize` / `json` |\n| `get_log_cache` | Inspect what is currently cached (log datasources, labels, resolved services) |\n| `refresh_log_cache` | Invalidate one service's resolution, or clear all entries of the active instance (or the one given by `instance`) |\n| `export_log_cache` | Export the log cache to a JSON file |\n| `import_log_cache` | Import a log cache from a JSON file (merge/replace) |\n\n## Usage Example\n\nA typical natural-language flow, as orchestrated by the MCP client:\n\n1. User: \"Show me error logs from the api service in the last 30 minutes.\"\n2. `query_logs` with `service: \"api\"`, `level: \"error\"`, `time_from: \"now-30m\"` → the server auto-detects which Loki datasource owns the `service=\"api\"` label and runs LogQL.\n3. (First call) the service → datasource/label mapping is saved to the cache; subsequent calls skip the detection step.\n4. User: \"Summarize those errors by pattern.\" → same call with `output: \"summarize\"` returns pattern-grouped counts.\n5. User: \"What other services do we have?\" → `list_services` returns the full service list.\n6. User: \"Check the same thing on prod.\" → `use_instance name=\"prod\"`, then the same `query_logs` call runs against prod. \"Compare with dev\" can be a one-off `query_logs` with `instance: \"dev\"`.\n\nIf the service name has a typo, `query_logs` surfaces close matches (e.g. `Did you mean: checkout, checkout-api?`).\n\n## How the Auto-Detection Works\n\n`query_logs` picks the target datasource and label on its own:\n\n1. List datasources (`/api/datasources`, or `/api/frontend/settings` when the key is denied) and filter down to log types (Loki/ES/CloudWatch/OpenSearch/Splunk).\n2. For each Loki datasource, fetch `/loki/api/v1/labels` and walk common service-label candidates (`service`, `service_name`, `app`, `app_name`, `application`, `container`, `job`) first, then any remaining labels. A datasource whose label API fails is skipped; if nothing matches, the error names the skipped datasources.\n3. For each candidate label, fetch its values and check whether the requested `service` name is in that list.\n4. If exactly one `(datasource, label)` pair matches, use it. If multiple match, require `datasource_uid` to disambiguate. If none match, return close-name suggestions.\n5. The resolved `(service → ds_uid, label)` is cached; `refresh: true` or `refresh_log_cache` forces re-detection.\n\nGrafana 8.x works as well: where `/api/datasources/proxy/uid/{uid}` does not exist (Grafana <9.0), Loki label and query requests go through `/api/datasources/proxy/{id}`, with the numeric id looked up from the datasource list. Run `self_test` to see which routes your instance uses.\n\nAuto-detection currently supports Loki only. For Elasticsearch / CloudWatch / Splunk datasources, pass `datasource_uid` and `service_label` explicitly (and expect LogQL-specific filters not to apply).\n\n## Output Modes\n\n`query_logs` accepts `output`:\n\n- `raw` (default): `<ISO timestamp>  <log line>` — good for direct reading in a terminal.\n- `summarize`: groups lines by normalized pattern (numbers → `N`, UUIDs → `UUID`) with counts and a sample per pattern. Use when lines are noisy or too many.\n- `json`: structured objects `{ ts, line, labels }` — for downstream tooling.\n\n## Cache\n\n- **Log cache**: persisted to `~/.grafana-mcp/log-cache.json`. Keyed by Grafana base URL (plus `org_id` when set) so multiple instances don't collide.\n- Each category has its own TTL (datasources / labels / label values / service resolution) — see the env-var table above.\n- A cached service resolution that later fails (e.g. label got renamed) is invalidated automatically so the next call re-detects.\n- Use `get_log_cache` to inspect, `refresh_log_cache` to clear, and `export_log_cache` / `import_log_cache` to share with teammates.\n\n### Cache Location & Reset\n\n| Cache | Location | Reset |\n|-------|----------|-------|\n| Log cache | `~/.grafana-mcp/log-cache.json` | `refresh_log_cache all=true` clears the active (or `instance`) Grafana's entries; delete the file to clear every instance |\n\nThe cache file is a plain JSON document — safe to inspect, edit, or back up manually.\n\n## Safety & Constraints\n\n- **Read-only**: the server does not expose any endpoint that mutates Grafana state. No dashboard/datasource CRUD, no alerting changes.\n- **Stdio logs**: all logs go to stderr, keeping the MCP stdio channel clean.\n- **TLS skip**: `GRAFANA_TLS_SKIP_VERIFY=true` / `tls_skip_verify: true` sets `NODE_TLS_REJECT_UNAUTHORIZED=0` process-wide. With multiple instances, enabling it on one disables TLS verification for **all** of them (the server warns at startup and in `list_instances`). Use only for self-signed Grafana in trusted networks.\n- **Credentials file**: `instances.json` holds tokens in plain text. Keep it `chmod 600`; the server warns when other users can read it.\n- **No secret logging**: auth tokens are never written to audit logs.\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"README.md","homepage":"https://github.com/ninanung/grafana-mcp#readme","repository":{"url":"git+https://github.com/ninanung/grafana-mcp.git","type":"git"},"bugs":{"url":"https://github.com/ninanung/grafana-mcp/issues"}}