LocalCan

官方

为AI代理提供本地主机的公共URL(隧道)、实时HTTP流量检查、快照发布和访问控制。

你可以用 LocalCan MCP 做什么?

  • 检查捕获的流量 — 使用 list_traffic 查询最近的交换,按主机、项目、方法或状态码过滤,然后通过 get_exchange 深入查看详细信息。
  • 管理公共 URL — 使用 create_public_urladd_public_url 创建隧道,通过 get_public_url_status 检查状态,并根据需要暂停、恢复或移除它们。
  • 发布和刷新快照 — 使用 publish_snapshot 在新 URL 上共享文件夹,或使用 update_snapshot 重新发布现有快照,使其保持离线可访问。
  • 控制访问保护 — 使用 set_password 为公共 URL 设置密码保护,通过 get_access_status 检查其当前保护状态,或使用 clear_access 移除保护。
  • 监控捕获状态 — 使用 get_status 检查流量捕获是否处于活动状态以及缓冲了多少数据,并在需要时通过 enable_capture 启用捕获。

文档

MCP server


Run LocalCan's Model Context Protocol server and wire it into your MCP host, with a full reference of the tools and switches.

localcan mcp runs a Model Context Protocol server over stdio. An MCP host (Claude Code, Codex, Cursor, Claude Desktop, and others) launches it and calls LocalCan's tools to read captured traffic, manage Public URLs (tunnels), and publish Snapshots. LocalCan must be running for the tools to return data, so open the desktop app or run localcan start -d first.

Tools

The server exposes twenty tools. Reading works out of the box. The eleven tools that change things need write access, which is off by default (see the switches below). Creating or adding a Public URL needs an active license. Publishing a Snapshot and password-protecting a URL need a subscription plan, so a perpetual license is turned away even though it can still open Public URLs. Unlicensed, the gated tools return a clear activation message, while pausing, resuming, and removing existing URLs still work.

Traffic:

ToolWhat it doesParameters
get_statusReports whether capture is on and how much traffic is buffered.none
enable_captureTurns capture on. Capture is off by default and resets when the daemon restarts.none
list_trafficLists recent exchanges, newest first.last (default 20), host substring, project id, method, status (exact code or a class like 5xx)
get_exchangeReturns one exchange by id.id required (full id or any unique prefix), format one of markdown, curl, http, har, json (default markdown), include_response (default true)

An exchange is the request LocalCan forwarded to your backend, not a byte-for-byte copy of the client's original request. See Traffic for the data model.

Public URLs:

ToolWhat it doesParameters
list_servicesLists the services LocalCan serves, each with a / handle, its local target, and endpoint count.none
list_public_urlsLists your Public URLs, including paused ones, each with its state (active, paused, error, starting, inactive) and what it serves (live, snapshot, none). Every row also carries access: none, password, link, or a team-policy name. A parked URL that serves a Snapshot reads state paused but serving snapshot, so answer "is the link up?" from serving, not state.none
get_public_url_statusReports one Public URL's state, what it serves (live, snapshot, none), and its access protection, same vocabulary as the list.url required
create_public_urlCreates a Public URL for a local port in a new project and returns the assigned address, like my-app-12.localcan.dev. Takes a few seconds. If the tunnel is rejected (for example your plan's Public URL limit) or times out, the attempt is rolled back and nothing is left behind. For a link that stays reachable after your machine goes offline, add a Snapshot with add_snapshot.port required, name optional (shapes the address), protocol http or tcp (default http)
add_public_urlAdds a Public URL to a service you already have configured. The protocol follows the service's target, so a tcp:// target gets a TCP tunnel. Same rollback on failure as create.service handle required
pause_public_urlTakes a Public URL offline while keeping its address, so it can be resumed later. A generated *.localcan.dev address stays reserved for 7 days while paused, custom domains never expire.url required
resume_public_urlBrings a paused Public URL back online at the same address.url required
remove_public_urlPermanently removes a Public URL. A generated address is released, a custom domain stays yours and can be added again. Removing a service's last endpoint also removes the emptied service and project. To keep the address but stop serving a Snapshot, use remove_snapshot. Marked destructive, so hosts typically ask for confirmation.url required

Snapshots (see Snapshots):

ToolWhat it doesParameters
publish_snapshotPublishes a folder as a Snapshot on a new Public URL, so it stays reachable after your machine goes offline. Point it at built static output when you can, or at a project root for LocalCan to build (dependencies must already be installed). Returns the new address. Always creates a new URL, so to refresh an existing preview use update_snapshot.path required (absolute), name optional (shapes the address)
add_snapshotAdds a Snapshot to a Public URL you already have, so an existing link keeps serving offline. Points at update_snapshot if the URL already has one.url and path required
update_snapshotRe-publishes the Snapshot on a Public URL. Omit path to rebuild from the same source, or pass it to repoint at another folder. Points at add_snapshot if the URL has none.url required, path optional
remove_snapshotRemoves the Snapshot from a Public URL. The URL stays reserved and keeps serving live while your tunnel is up. Marked destructive.url required
get_snapshot_statusReports a Public URL's Snapshot: its source folder, when it was published, whether the source changed since (stale), and whether the URL serves live or the snapshot right now.url required

Access control (see Access control):

ToolWhat it doesParameters
set_passwordPassword-protects a Public URL so only people who have the password can open it. Enforced on LocalCan's servers, so it also covers a Snapshot on that URL. Generates a strong password unless you pass one, and returns it so you can share it. Needs a subscription plan.url required, password optional (omit to generate one)
clear_accessRemoves password protection, making the URL public again. Does not remove the URL or its Snapshot. Marked destructive, so hosts typically ask for confirmation.url required
get_access_statusReports a Public URL's protection and returns its current password when it is password-protected. The password is never returned by list_public_urls, only here.url required

Connecting an agent

How you connect depends on how the agent runs. Terminal agents (Claude Code, Codex) inherit your shell PATH, so a bare localcan command works. GUI apps (Cursor, Claude Desktop, VS Code, and others) do not load your shell PATH, so they need the absolute path to the binary, for example /Users/you/.localcan/bin/localcan. The desktop app's Settings can copy a ready-made config with the right path filled in, which is also the reliable route on Windows.

Claude Code

Shell

Copy

claude mcp add --scope user localcan -- localcan mcp

Flag --scope user registers the server for every project. Drop it to register it only in the current project.

Codex

Shell

Copy

codex mcp add localcan -- localcan mcp

This writes the server to ~/.codex/config.toml. For the Codex desktop app or IDE extension, pass the absolute path in place of localcan.

Cursor, Claude Desktop, and Windsurf

These share the same mcpServers format:

JSON

Copy

{
  "mcpServers": {
    "localcan": {
      "command": "/Users/you/.localcan/bin/localcan",
      "args": ["mcp"]
    }
  }
}

Add it to the right file, then reload:

  • Cursor: ~/.cursor/mcp.json, then enable the server in Settings.
  • Claude Desktop: claude_desktop_config.json (Settings, Developer, Edit Config), then quit and relaunch.
  • Windsurf: ~/.codeium/windsurf/mcp_config.json, then refresh the MCP panel.

VS Code

VS Code (Copilot agent mode) uses a servers key with an explicit type. Add this to .vscode/mcp.json in your workspace:

JSON

Copy

{
  "servers": {
    "localcan": {
      "type": "stdio",
      "command": "/Users/you/.localcan/bin/localcan",
      "args": ["mcp"]
    }
  }
}

You can also run code --add-mcp with the same server object.

Zed

Zed uses context_servers in its settings.json:

JSON

Copy

{
  "context_servers": {
    "localcan": {
      "source": "custom",
      "command": "/Users/you/.localcan/bin/localcan",
      "args": ["mcp"]
    }
  }
}

You can also add it from the Agent Panel settings.

Agent access, redaction, and write access

All three are controlled in the desktop app under Settings (the "AI Agents (MCP)" section), or from the terminal: localcan mcp enable / disable for agent access, localcan mcp redact <on|off> for redaction, localcan mcp access <read_only|read_write> for write access, and localcan mcp status to see the current state.

  • Agent access is on by default. Turn it off to stop agents from using LocalCan at all. The server still starts, but every tool returns a clear "access is disabled" message until you turn it back on.
  • Redaction is on by default for agents. Sensitive headers (Authorization, cookies, API keys) are removed from tool responses. URLs and bodies are not redacted. Turn it off to let your own agent receive raw values.
  • Write access is off by default. Reading works without it, but the write tools return a clear read-only message until you turn it on, in the app ("Allow agents to create and change Public URLs") or with localcan mcp access read_write. Turning on agent access does not grant write access. They are separate switches. Every write call is logged to the server's diagnostic output, which your host captures, so you have a record of what an agent changed. A password passed to set_password is masked in that log.

When a tool refuses

  • Every tool errors with a daemon connection message: LocalCan is not running. Open the desktop app or run localcan start -d.
  • list_traffic returns nothing: capture is off (it is off by default and resets when the daemon restarts). Run localcan traffic enable or let the agent call enable_capture.
  • "MCP access is disabled": agent access is switched off. Run localcan mcp enable or flip the Settings toggle.
  • "MCP is read-only": the tool changes things and write access is off. Run localcan mcp access read_write or turn on the Settings toggle.
  • "public URLs require a license": creating and adding a Public URL need an active license. Activate one in the app or with localcan license activate <key>.
  • "need a subscription plan": Snapshots and Access control are subscription-only. A perpetual license can open Public URLs but cannot publish a Snapshot or set a password. Subscribe from your dashboard↗, then retry.
  • "already has a snapshot" or "has no snapshot yet": use the tool the message names. add_snapshot attaches a Snapshot to a URL that has none, update_snapshot refreshes one that already does.
  • "Snapshot limit reached": your plan caps how many Public URLs can serve a Snapshot at once. The message lists the URLs already using a slot, which you can refresh with update_snapshot instead of publishing a new one.
  • The host shows the server as failed or with no tools: a GUI app cannot find localcan on the PATH. Use the absolute path, easiest via the Settings copy config.

© 2026 LocalCan™. All rights reserved.