Skip to main content
Localdev has a built-in MCP server. A coding agent such as Claude Code can use it to look at your running project the way you would in the UI: which services crashed and why, what they printed, which requests failed, and what the logs and metrics say. The agent can then check its own changes against the real system: edit the code, restart the service, and see whether it still fails. Because Localdev runs the services itself, the agent also sees what an observability tool can’t: crashes, exit reasons, each service’s stdout and stderr, and the traces a crash cut short. The server is at http://localhost:2345/mcp, on the same address as the UI. It runs whenever Localdev runs, so there’s nothing to install or start. Localdev prints its address at start-up:
All its tools are read-only: none of them can change anything.

Connect an agent

Start Localdev first: the agent can only connect while Localdev runs. If you changed the address with -server, change the URL to match.

Claude Code

Run this in your project’s repository:
--scope project saves the server in .mcp.json at the root of the repository. Commit it next to your Projectfile, and everyone on the project gets the server without setting it up. Claude Code asks each person to approve it the first time. To check the connection, run claude mcp list, or /mcp inside Claude Code:

Cursor and VS Code

Localdev hasn’t been tested with Cursor or VS Code yet. These are the standard configuration files for an MCP server over HTTP.
For Cursor, create .cursor/mcp.json in your project, or ~/.cursor/mcp.json for every project:
.cursor/mcp.json
For VS Code with Copilot in agent mode, create .vscode/mcp.json:
.vscode/mcp.json

Other clients

The server uses the Streamable HTTP transport. Clients that only support stdio can’t connect to it. To try the tools by hand, use the command line of the MCP Inspector:

The tools

since takes a duration (15m, 2h, 1d) or an RFC 3339 time. Without it, the tools search everything Localdev still has in memory. The tools point to each other, and agents follow them: from project_status to service_output for a crashed service, from search_traces status=error to get_trace, from a trace ID to search_logs trace_id=…, and from list_metrics to get_metric.

What the output looks like

The tools return text written for a model, not JSON. Times are local clock times, with a date when they’re not today. Each result starts with the current time, so the agent can tell how old things are. search_traces:
get_trace:
  • Failed spans show ERROR: <message>, their attributes, and any exception with its stack trace, cut at 30 lines.
  • Three or more identical sibling spans that didn’t fail are folded into one line, such as gateway SELECT product (client) ×12, each 1ms to 2ms. That makes an N+1 query easy to spot.
  • A large trace is cut at 300 lines. Failed spans after the cut are still listed.
Errors tell the agent what to do next. For example, a misspelled service name returns no service named "wroker"; services are: demo. An unknown metric lists the service’s metrics, an attribute filter that matches nothing lists the values that exist, and an empty result names the filters that were used.
Spans and logs arrive up to about 10 seconds after a request, because OpenTelemetry SDKs send them in batches. The tools tell the agent to wait and search again. Most SDKs send metrics only every 60 seconds: set OTEL_METRIC_EXPORT_INTERVAL: "5000" in the Projectfile’s env to send them every 5 seconds.

What to expect

Ask about your project the way you’d ask a colleague:
  • “Checkout is failing. Find out why.”
  • “Why did the worker die?”
  • “I fixed the handler. Is it still failing?”
  • “What’s slow in this request?” or “What’s the p95 latency of the order endpoint?”
  • “Which services call inventory, and what does inventory call?”
Agents usually start with project_status, then follow the tools’ hints: service_output for a service that crashed, and get_trace for the IDs that search_traces and search_logs return. They often mention problems you didn’t ask about, such as a crashed service while you asked about latency. When your instrumentation records code.filepath on spans, the agent can tell where in your code a span comes from, and read the source next. A specific question gets a faster and cheaper answer than a vague one. Every tool call adds its result to the conversation, and a vague question takes more calls. If you know which service is involved, say so.

What the tools can see

Whatever a tool returns goes into the model’s context, and so to your model provider. That includes log messages, span attributes, exception messages and service output, which can contain passwords, tokens and personal data.
  • Never returned: the values of environment variables (from the Projectfile or Localdev’s own), and span resource attributes, such as process command lines and host details.
  • Only what’s in memory: the tools see the same telemetry as the UI, within the same limits (see store). It’s gone when Localdev stops.
  • Only from this machine: Localdev accepts MCP requests only from the machine it runs on. With -server 0.0.0.0:2345, other machines can open the UI, but they can’t use the MCP server.
  • Not from web pages: a request sent from another website’s page is refused, and so is a request with an unexpected Host header.
  • No login: like the rest of Localdev, any program you run on this machine can call it.

Troubleshooting

Several projects at once

Each instance of Localdev has its own MCP server on its own -server port. Add each one under its own name, for example localdev-shop on port 2345 and localdev-billing on port 2355:
See the CLI reference for running two instances side by side.