
Last9 MCP Server
OfficialConnect AI to Last9 production observability: logs, metrics, traces, exceptions and alerts.
Add to your client
Copy the config for your MCP client and paste it into its config file.
npx -y @last9/mcp-server@latestPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"last9-mcp-server": {
"command": "npx",
"args": [
"-y",
"@last9/mcp-server@latest"
],
"env": {
"LAST9_REFRESH_TOKEN": "<your-refresh-token>"
}
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- A Last9 account (app.last9.io) with admin access — only admins can generate API tokens
- For self-hosted stdio: a Last9 refresh/access token from Settings → API Access (app.last9.io/settings/api-access), generated with Write permission, set as LAST9_REFRESH_TOKEN
- For self-hosted: the binary via Homebrew (brew install last9/tap/last9-mcp), npm (npm install -g @last9/mcp-server@latest), or a GitHub release download (macOS/Linux/Windows, x64/ARM64)
- For hosted HTTP: your Last9 org slug from the app URL and an MCP client that supports OAuth (Claude, Cursor, VS Code 1.99+, Windsurf)
About Last9 MCP Server
Last9 MCP Server connects AI coding agents to your Last9 production telemetry so they can read real logs, metrics, traces, exceptions, alerts and change events while debugging. It bridges the gap between local code and what is actually happening in production — an agent can pull a service's error rate, fetch slow database queries, run a PromQL query, or inspect a trace without you leaving the editor.
It exposes a broad tool surface (50+ tools) spanning service health, databases, Prometheus-style metric queries, logs, traces, alerts, change events and dashboard CRUD. There is also a did_you_mean helper for fuzzy resolution of service/entity names.
Last9 offers two ways to run it: a hosted HTTP transport with OAuth (no binary, no token to manage) and a self-hosted stdio binary (Homebrew, npm, or a release binary) authenticated with a Last9 refresh token. The hosted path is the quickest for most users; the stdio path suits local clients and multi-cluster setups.
Tools & capabilities (12)
get_service_summaryHigh-level health summary for a service
get_exceptionsList server-side exceptions for a service/time range
get_logsQuery logs across the platform
get_service_logsFetch logs scoped to a specific service
get_tracesRetrieve distributed traces
prometheus_range_queryRun a PromQL range query over metrics
prometheus_instant_queryRun a PromQL instant query
get_database_slow_queriesSurface slow database queries
get_alertsList alerts and their firing state
get_change_eventsList deployments and change events for correlation
create_dashboardCreate a dashboard (also list/get/update/delete variants)
did_you_meanFuzzy-resolve a service or entity name
When to use it
- Use it when an agent should debug a production incident with real logs, traces and exceptions instead of guesses
- Use it when you want to correlate an error spike with recent deployments via change events
- Use it when you need ad-hoc PromQL metric queries answered from inside your editor or chat
- Use it when investigating slow database queries flagged in production
- Use it when you want the agent to check alert state or notification channels before paging someone
- Use it when you want to create or update Last9 dashboards programmatically from a prompt
Quick setup
- 1Pick a transport: hosted HTTP (recommended) or self-hosted stdio
- 2Hosted: run `claude mcp add --transport http last9 https://app.last9.io/api/v4/organizations/<org_slug>/mcp`, then `/mcp` and complete OAuth
- 3Self-hosted: install via Homebrew or `npm install -g @last9/mcp-server@latest`
- 4Generate a Write-scoped token at Settings → API Access and set it as LAST9_REFRESH_TOKEN (plus any datasource/API host vars)
- 5Add the stdio server to your MCP client config and restart the client
- 6Verify by asking the agent to call get_service_summary or get_alerts
Security notes
The refresh token authenticates to your full Last9 org telemetry, so store it securely and prefer the hosted OAuth endpoint where no static token is stored locally. Limit LAST9_MAX_GET_LOGS_ENTRIES to avoid pulling excessive log volume into the model context.
Last9 MCP Server FAQ
How do I authenticate?
Either use the hosted HTTP transport with OAuth (no token to manage), or self-host the stdio binary with a LAST9_REFRESH_TOKEN. Only Last9 admins can generate the token from Settings → API Access.
Do I need to install anything for the hosted version?
No. The hosted HTTP transport requires no binary and no token — you add the org-scoped MCP URL and authenticate via OAuth in your client.
Which MCP clients are supported?
Claude (Code/Desktop/Web), Cursor, VS Code 1.99+, and Windsurf are documented as supported clients.
What can it actually access?
Logs, metrics (PromQL), traces, exceptions, alerts, change events, database performance, and dashboards — read access plus dashboard and drop-rule writes.
Why does token creation fail for me?
Token generation requires admin privileges in your Last9 org; non-admin users cannot create API tokens.
Alternatives to Last9 MCP Server
Compare all alternatives →Official Elastic server: list indices, read mappings, and search with Query DSL.
Official PostHog server: product analytics, feature flags, experiments, error tracking and SQL.
Run PromQL queries and analyze Prometheus metrics from any MCP client.