Production Metrics as Agent Work Orders

articleaiinfrastructuredatabasesmcpagent-loopsperformancepostgresvitess

PlanetScale's MCP loop maps production database telemetry to reviewable agent PRs, which rhymes with joelclaw's telemetry-driven workload loops.

PlanetScale launched a hosted Model Context Protocol server that lets tools like Claude, Cursor, Notion, OpenCode, Claude Code, and Codex talk to PlanetScale data through an authenticated HTTP MCP endpoint.

The boring version is “AI can inspect your database.” The useful version is production metrics become agent work orders. PlanetScale Insights and Schema Recommendations point at slow queries or schema issues, then an agent can find the relevant app code, make one change, benchmark it, and open a GitHub pull request.

The clever bit is the boundary. OAuth controls access, the server works from any HTTP-hosted MCP client, query execution uses short-lived credentials, and there is an insights-only endpoint that excludes read/write query tools. That is the non-bullshit shape for database agents: give them telemetry and recommendations first, then make dangerous execution a deliberate permission.

For joelclaw, this is mostly a pattern note. We already care about OpenTelemetry, Typesense, Inngest, and Restate as the substrate for agent work. The useful move here is packaging operational evidence as an MCP surface that agents can turn into small, reviewable fixes instead of vague “optimize the system” sludge.

Key Ideas

  • PlanetScale exposes organizations, databases, branches, schema, and Insights through a hosted MCP server.
  • OAuth scopes let users grant no access, read-only access, or full access at organization or per-database levels.
  • The insights-only MCP endpoint, https://mcp.pscale.dev/mcp/planetscale-insights-only, removes planetscale_execute_read_query and planetscale_execute_write_query from the tool surface.
  • PlanetScale frames the workflow as a self-improving loop: inspect production Insights, find the code, make one fix, benchmark, and open a GitHub PR.
  • Cursor Automations are called out as a way to run the loop on a schedule, which makes this feel less like a demo and more like recurring maintenance work.
  • The guardrail that matters: one query or recommendation at a time, with before/after benchmarks and human review before merge.