A [FastMCP](https://github.com/jlowin/fastmcp) server that allows querying Loki logs from Grafana.
Connect Grafana Loki MCP to Claude, Cursor or any other MCP client and it stops being a tab you switch to. A FastMCP server that allows querying Loki logs from Grafana. The grafana loki mcp mcp server is what makes that connection.
The toolset is worth reading before you wire it up, because it tells you what the integration is really for:
Testing — The Testing tool exposed by this serverquery_loki — Parameters: - query: Loki query string - start: Start time (ISO format, Unix timestamp, or Grafana-style relative time like 'now-1h', default: 1 hourget_loki_labels — The get_loki_labels tool exposed by this serverget_loki_label_values — The get_loki_label_values tool exposed by this serverformat_loki_results — Parameters: - results: Loki query results from query_loki - format_type: Output format ('text', 'json', or 'markdown', default: 'text') -Configuration is passed through the environment: GRAFANA_URL, GRAFANA_API_KEY. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.
The server ships on PyPI as grafana-loki-mcp, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.
Plenty of monitoring and observability servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Grafana Loki MCP's toolset — Testing, query_loki, get_loki_labels and 2 more — is a fair guide to whether it matches your workflow. It is maintained by tumf; worth a glance at recent repository activity before you build anything load-bearing on it.
We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.
| Tool | What it does |
|---|---|
| Testing | The Testing tool exposed by this server. |
| query_loki | Parameters: - query: Loki query string - start: Start time (ISO format, Unix timestamp, or Grafana-style relative time like 'now-1h', default: 1 hour ago) - end: End time (ISO format, Unix timestamp, or Grafana-style rel |
| get_loki_labels | The get_loki_labels tool exposed by this server. |
| get_loki_label_values | The get_loki_label_values tool exposed by this server. |
| format_loki_results | Parameters: - results: Loki query results from query_loki - format_type: Output format ('text', 'json', or 'markdown', default: 'text') - max_per_line: Maximum characters per log line (0 for unlimited, default: 0) |
{
"mcpServers": {
"loki": {
"command": "uvx",
"args": [
"grafana-loki-mcp",
"-u",
"GRAFANA_URL",
"-k",
"GRAFANA_API_KEY"
]
}
}
}Configuration as documented by the project. Restart the client after saving.
| Variable | Description | Required |
|---|---|---|
| GRAFANA_URL | Endpoint or connection string the server talks to. | Yes |
| GRAFANA_API_KEY | Credential the server authenticates with. | Yes |
Give your coding agent the full DevTools toolbox: traces, network, console, heap snapshots and Lighthouse.
Dashboards, Prometheus and Loki queries, incidents and alerts — observability by conversation.
Errors with full context — stack traces, issue triage and AI-powered root-cause analysis from Sentry's server.
Enables enhanced web research capabilities for large language models through intelligent search queuing and advanced content extraction.
Automates browser interactions and enables Large Language Models (LLMs) to interact with web pages through Playwright and Chrome DevTools Protocol
Guides tool usage by providing recommendations for MCP tools at each problem-solving stage.