Guardrails for AI Coding Agents That Open Tunnels
Safety guardrails for letting Claude Code or other AI agents create, start, and stop tunnels via our Localtonet MCP Server: tokens, review, cleanup, and audits.
In this article 12 sections

Let your assistant open tunnels without letting it decide what the internet can reach
With our Localtonet MCP Server, an AI coding assistant such as Claude Code can create, start, and stop tunnels from inside a conversation. That is a real productivity gain. It also means a language model can now make a local service publicly reachable. This guide covers what can go wrong when an agent controls exposure and a six-part guardrail model to prevent it: scoped tokens, narrow tunnel types, human review before start, mandatory cleanup, webhook-based auditing, and application-level authentication. It ends with a pre-flight checklist, a request-to-tunnel-type mapping table, and an FAQ.
📋 What's in this guide
Why agent-controlled tunnels need guardrails
A tunnel changes who can reach a service. Before the tunnel exists, a development server bound to your laptop is reachable only from that machine or your local network. After the tunnel starts, anyone who learns the public URL or host and port can send it traffic. That is exactly what you want when you are previewing a web app for a colleague or receiving a webhook from an external service. It is exactly what you do not want when the "service" is a database with a default password, a debug console, or a folder containing your SSH keys.
Until recently, a person always sat between intent and exposure. You decided to share something, opened the dashboard or ran the client, picked a port, and pressed Start. Our Localtonet MCP Server lets AI coding assistants such as Claude Code manage Localtonet tunnels directly from the assistant: create them, start them, and stop them. The assistant translates "let me see this on my phone" into a tunnel operation. This guide assumes you have already installed and connected the MCP Server using that post, and focuses only on how to operate it safely.
The core issue is not that agents are malicious. It is that they are literal, eager, and context-limited. An agent asked to "make the API reachable for the webhook test" might pick a raw TCP tunnel when an HTTP tunnel would do, might point it at the wrong port, might forget the tunnel exists once the conversation ends, and might happily paste an auth token into a file it is editing because that made the error go away. None of these are exotic failures. They are the same mistakes humans make, executed faster and with less hesitation.
Guardrails here mean a combination of three things: what the agent is technically able to do (which device and credential it can use), what your team's written policy tells it to do (which tunnel types, which ports, which steps require confirmation), and what you can observe after the fact (connection events and cleanup checks). No single layer is sufficient. Together they let you keep the speed of agent-driven tunnel management without making public exposure an unreviewed side effect.
We describe only capabilities documented for our platform: the tunnel lifecycle (create, start, stop, delete), device-specific tokens, the documented tunnel families, and the platform-wide Token/Tunnel webhooks. We do not describe MCP tool names, per-tool permission settings inside the MCP Server, or built-in approval workflows, because those details are not part of the documentation this guide is based on. Where a guardrail depends on such a capability, we say so and suggest a process-based alternative.
What can go wrong when an agent controls exposure
Before designing guardrails, it helps to name the failure modes precisely. Each one maps to a specific guardrail later in the article. Most incidents in this space are not dramatic breaches. They are quiet exposures that last longer or reach further than anyone intended.
Notice that only one of these (leaked tokens) is about the agent's credentials. The rest are about decisions: which service, which tunnel type, how long, and with what protection in front. That is why the guardrail model below mixes technical scoping with process.
The guardrail model at a glance
We recommend six guardrails, applied in this order because each one narrows the blast radius for the next:
- Scope the device and token the agent may use, and keep tokens out of prompts and repositories.
- Choose the narrowest tunnel type for the task: HTTP for web previews, raw TCP or UDP only when required, Proxy and File Server only when explicitly intended.
- Require human review before start, using the fact that creating a tunnel is separate from starting it.
- Make stop and delete part of every task so no tunnel outlives its purpose.
- Audit with platform-wide Token/Tunnel webhooks so every Connected and Disconnected event is recorded.
- Keep application-level authentication on anything you expose, because a tunnel URL is not an access control.
Guardrail 1: Scope which device and token the agent may use

In our platform, an auth token identifies the client device that will run a tunnel. Tokens are device-specific. That design gives you a natural boundary: the device whose token the agent uses defines what local services the agent's tunnels can possibly reach. A tunnel's local target has to be an IP address and port on, or reachable from, the client device. If the agent's tunnels run on a device that cannot reach your production database, no prompt can expose it.
Prefer a dedicated device for agent-driven tunnels
The strongest version of this guardrail is to let the agent work only with a device you set aside for development exposure. That might be your development laptop rather than a shared jump host, a development VM, or a container host that only runs the project you are working on. The question to ask is simple: "If this device's every reachable port were briefly public, what would be exposed?" If the honest answer includes a NAS, a router admin page, internal company services, or a database with real customer data, that device is a poor choice for agent-controlled tunnels.
Using a dedicated device and token also helps the audit guardrail later. Our platform-wide webhooks fire for tokens and tunnels in a selected Token Group. If the agent's device sits in its own group, its connection events are easy to isolate from the rest of your fleet.
Never paste tokens into prompts, chats, or repositories
Anything you type into an assistant conversation may be stored in session history, copied into files, summarized into commit messages, or echoed back in tool output. Treat the assistant's context window as a place where secrets leak, not a place where they live. Concretely:
- Configure whatever credential the MCP Server uses through its own setup, as described in our MCP Server introduction, not by pasting it into a prompt.
- Keep any local config or environment file that holds the credential out of version control. Add it to
.gitignorebefore the agent ever runs in that repository, not after. - Tell the agent explicitly, in your project instructions, that it must never print, copy, or commit tokens, and that if it encounters one it should stop and tell you.
- Review diffs produced by the agent for anything that looks like a credential before committing. Secret-scanning tools in your CI pipeline are a good second net.
Treat a leaked device token as compromised. Anyone holding it may be able to act as that device. Stop the affected tunnels, disconnect the client, and replace the credential through the dashboard using whatever regeneration or removal options your account currently offers. We are not documenting the exact rotation steps in this guide; check the current dashboard rather than assuming a specific flow. Then check your webhook log (Guardrail 5) for Connected events you did not expect.
Server and region selection
Every tunnel is created against a Localtonet relay server, selected by a server code. Available values come from the current dashboard and product, not from a fixed list, so do not let the agent guess or hardcode a server code it saw in an old example. If your team has a preferred region, state it in your project instructions and let the agent select it from what the product currently offers.
Guardrail 2: Choose the narrowest tunnel type
Our platform documents several tunnel and proxy families: HTTP/s, TCP, UDP, TLS, combined UDP/TCP, File Server, Proxy Server (HTTP and SOCKS5), and VPN Manager. They are not interchangeable flavors of "make it public". They differ in what they expose and how much protocol awareness sits in front of your service. An agent should always use the narrowest family that fulfills the request.
HTTP tunnels for web previews and webhooks
Most agent requests in a coding session are about web things: preview the frontend, let a teammate click through the UI, receive a webhook callback, test an OAuth redirect. An HTTP tunnel fits all of these. It points to a local IP and port and serves the content at a public HTTPS address. For HTTP and File Server tunnels, the Process Type can be a Random Sub Domain, a Custom Sub Domain, or a Custom Domain; all three serve the same content at a public HTTPS address.
For agent-created tunnels we recommend a random subdomain by default. It keeps throwaway previews visibly throwaway and avoids an agent attaching your brand's custom domain to a half-finished branch. Reserve custom subdomains and custom domains for tunnels a human sets up deliberately. Remember, though, that a random subdomain is not a secret in any security sense. URLs end up in browser history, chat logs, referrer headers, and screenshots. Guardrail 6 still applies.
Raw TCP or UDP only when the protocol requires it
TCP, UDP, and combined UDP/TCP tunnels forward raw traffic to a local IP and port. They are the right tool for non-HTTP protocols: a database client, a game server, an SSH session, a custom binary protocol. They are also the riskiest tunnels an agent can open casually, because the service behind them is often something that was never designed to face the internet. Database servers in development frequently run with default credentials, no TLS, and broad permissions.
Our rule of thumb: if the agent proposes a TCP or UDP tunnel, it must state in plain words which service and port it will expose and why HTTP is insufficient. If a teammate needs ongoing access to a private service rather than a one-off public endpoint, consider whether VPN Manager, our private mesh VPN with granular firewall rules, is a better fit than a public raw port. VPN Manager is a different feature with its own configuration, and it is not something we suggest delegating to an agent by default.
We also document a TLS tunnel type. If your task specifically requires it, consult the current documentation for its behavior rather than letting an agent infer it from the name.
No Proxy or File Server unless explicitly intended
These two families deserve special handling because they do not behave like "expose port X":
- Proxy tunnels (HTTP and SOCKS5) make the connected device the proxy exit node. They do not forward to a conventional local IP and port target. Traffic sent through the proxy leaves the internet from your device's network. An agent should never choose this because "the request needed to come from my IP" without a human explicitly deciding that this device may act as an exit node.
- File Server tunnels publish a local folder path rather than an IP and port. The path the agent chooses is the exposure. Our documentation uses examples like
C:\Users\Workon Windows or/rootand/usr/shareon Linux and macOS to show the field format, and those examples also illustrate the danger: an agent that publishes a home directory or/rootmay expose dotfiles, keys, and configuration.
If File Server is genuinely the right tool, for example sharing build artifacts with a reviewer, make the folder as narrow as possible (a dedicated output directory, not the project root). The Default web file manager includes protections worth using: global permission flags for Upload, Download, Delete, Create Folder, Move, and Share, with per-path overrides where the most specific path wins and changes apply without restarting the tunnel; public share links with an expiry date, download limit, and separate link password; and security defaults such as path-traversal protection, per-IP rate limiting, blocked executable extensions, and hidden dotfiles. For a read-only review share, turning off Upload, Delete, Move, and Create Folder is a sensible starting point. Note that our source material describes these features for the Default web manager; we do not assert here whether each one also applies to the SFTP and WebDAV sub-types.
Mapping common agent requests to tunnel types
Give this table to your team, and consider pasting a condensed version into your project instructions so the agent sees it too.
| Typical agent request | Narrowest appropriate type | Guardrail notes |
|---|---|---|
| "Let me preview the frontend on my phone" | HTTP tunnel, random subdomain | Point at the dev server port only. Stop and delete after the preview. |
| "Receive webhooks from an external service on my local API" | HTTP tunnel, random subdomain | Keep the API's signature verification enabled. Do not expose admin routes on the same port if avoidable. |
| "Share this branch with a reviewer for an afternoon" | HTTP tunnel | Keep app login on. Agree on an end time and stop the tunnel at that time. |
| "Expose my MCP server so a remote client can connect" | HTTP tunnel | Follow our guide on securing a Streamable HTTP MCP server with OAuth and Origin checks before starting. |
| "Let a colleague connect to my local database" | TCP tunnel, only with explicit approval | Strong DB credentials, non-production data. Consider VPN Manager for ongoing access instead. |
| "Test the game or voice server from outside" | UDP or combined UDP/TCP tunnel | Human names the exact port. Time-box the test. |
| "Send the build artifacts to the client" | File Server, only if explicitly intended | Dedicated output folder, restrictive permissions, expiring share link with password. |
| "Make requests appear to come from my network" | Proxy, never by agent default | Requires a deliberate human decision that this device may be an exit node. |
If the MCP Server version you run supports more or fewer tunnel types than the dashboard, follow what it actually exposes. The table describes which type a careful operator would choose; it is not a statement that every type is available through every interface or plan. Plan coverage varies, and you should confirm availability on your account.
Guardrail 3: Require human review before the agent starts a tunnel
The single most useful property of our tunnel lifecycle, from a governance point of view, is that creating a tunnel does not mean it is running. A tunnel must be started before it serves traffic, and it can later be stopped or deleted. That separation gives you a natural checkpoint: the agent can prepare the tunnel, and a human confirms before it goes live.
What the reviewer should check
Ask the agent to present the following before it starts anything, in a short, fixed format so the review takes seconds rather than minutes:
- Tunnel type and why it is the narrowest one that works.
- Local target: the exact IP and port, or the exact folder path for File Server.
- What runs there: the process or service name, and whether it has authentication enabled.
- Device: which device and token the tunnel will run on.
- Process Type for HTTP and File Server tunnels: random subdomain unless a human asked otherwise.
- Duration: when the tunnel will be stopped and deleted.
This mirrors a good pattern for agents generally: read, plan, propose, and wait for a go-ahead before any change that affects what the outside world can reach. Agents are good at gathering context and drafting a configuration; the final "make it public" decision should stay with a person.
Enforcing review in practice
We do not document a built-in approval workflow or per-tool permission controls inside the Localtonet MCP Server, so do not assume one exists. Enforcement therefore comes from two other places:
- Your MCP client's tool-confirmation settings. Many MCP clients, Claude Code among them, can ask for confirmation before invoking a tool. Keep confirmations on for tunnel management tools and avoid adding them to any "always allow" or auto-approve list. Check your client's current documentation for how its permission settings work, since they change between versions.
- Written project instructions. Put the policy where the agent reads it at the start of every session, such as a project instructions file. Instructions are not a hard security boundary, because a model can misread or ignore them, but they substantially change default behavior and they make expectations explicit for human teammates too.
A policy block like the following works well in a project instructions file. Adapt it to your team; it is plain text policy, not a Localtonet configuration format.
## Tunnel policy (Localtonet MCP Server)
- You may CREATE tunnels, but never START one without my explicit "go" in chat.
- Before asking, show: tunnel type, local IP:port (or folder path), service name,
whether the service requires login, device used, process type, planned stop time.
- Default to an HTTP tunnel with a random subdomain.
- TCP/UDP tunnels: only if I asked for a non-HTTP protocol. Explain why HTTP won't work.
- Never create Proxy or File Server tunnels unless I name that type explicitly.
- Never use a custom domain or custom subdomain unless I ask for it.
- Never disable authentication in the app to make a tunnel "work". Ask me instead.
- Never print, copy, commit, or summarize auth tokens or API keys.
- At the end of every task: stop the tunnel, delete it if it is no longer needed,
and report which tunnels you created, started, stopped, and deleted.
The confirmation step catches the most common agent mistakes: a wrong port picked from a stale config, a File Server path one directory too high, or a TCP tunnel where HTTP would do. Each of these is obvious to a human in a one-line summary and invisible once the tunnel is already serving traffic.
Guardrail 4: Make stop and delete part of every agent task
A tunnel is available only while the selected client device is connected and the tunnel is running. That means exposure ends when either condition stops being true. It also means a tunnel the agent started at 3 p.m. for a five-minute preview is still public at 3 a.m. if nobody stopped it and the laptop never slept.
Stop versus delete
Stopping a tunnel ends its availability but keeps its configuration, so it can be started again. Deleting removes it. For agent-driven work, we suggest:
- Stop at the end of every task, without exception.
- Delete when the tunnel was a one-off, such as a preview or a test. Fewer stored tunnels means fewer things a future agent session can restart by mistake.
- Keep (stopped) only tunnels that a human deliberately set up for repeated use, and give them names that make their purpose obvious.
Our MCP Server introduction describes creating, starting, and stopping tunnels from the assistant. If the version you run does not expose deletion, do the deletion from the dashboard as part of your end-of-day routine. Do not assume the agent cleaned up just because it said so; verify in the dashboard or through your webhook log.
Define "done" to include cleanup
Agents tend to treat a task as finished when the user's visible goal is met: the preview loaded, the webhook arrived. Make cleanup part of the definition of done in your instructions, and ask the agent to end each tunnel-related task with a short report listing every tunnel it touched and its final state. That report doubles as a log entry you can compare against webhook events.
The emergency stop
Because a tunnel requires its client to be connected, stopping or disconnecting the Localtonet client on the device ends availability for every tunnel running on that device. If you are ever unsure what an agent opened, that is your fastest, broadest kill switch. Then review the dashboard calmly, stop and delete what should not exist, and reconnect.
Guardrail 5: Audit agent activity with Token/Tunnel webhooks

Review and cleanup reduce mistakes. Auditing tells you when they happened anyway. Our platform-wide Token/Tunnel webhooks fire when a token or tunnel in a selected Token Group changes to Connected or Disconnected. Each event is a POST with a WebHookRequest JSON body containing four fields:
| Field | Meaning | Audit use |
|---|---|---|
Id |
The tunnel id, or the authtoken when the event concerns a token | Correlate events to a specific tunnel or device. Mask token values before storing. |
ActionDate |
When the status change happened | Build a timeline and measure how long tunnels stayed up. |
Type |
"Token" or "Tunnel" |
Separate device connections from individual tunnel state changes. |
Status |
"Connected" or "Disconnected" |
Detect unexpected starts and tunnels that never disconnected. |
For the configuration details, see our webhook documentation. Do not confuse these with File Server webhooks, which are a separate system that fires on file-level events (upload, delete, rename, move) and supports HMAC request signing. The two systems serve different purposes, and the HMAC signing feature belongs to File Server webhooks, not to the Token/Tunnel webhooks described here.
Put the agent's device in its own Token Group
Because webhooks are scoped to a selected Token Group, place the device the agent uses into a group of its own. Every Connected and Disconnected event for that group is then, by construction, related to agent-capable activity. This is much easier to reason about than filtering a mixed stream from every device your team owns.
What to alert on
- Tunnel Connected outside working hours. A start at an unusual time deserves a look.
- Tunnel Connected with no Disconnected after a threshold. Pick a window that matches your policy, for example a few hours for previews. This catches forgotten tunnels.
- Token Connected from a device you did not expect to be online. Combined with Guardrail 1, this is an early signal of a leaked or misused token.
- Mismatch with the agent's report. If the agent says it stopped a tunnel but no Disconnected event arrived, verify in the dashboard.
A minimal receiver sketch
The following is a generic example using only the Python standard library. It accepts the documented JSON body, masks the Id when the event concerns a token, appends each event to a log file, and prints a line you could replace with a chat or paging integration. It is illustrative, not production-ready: run it behind HTTPS, protect the endpoint, and adapt storage to your environment.
import json
from datetime import datetime, timezone
from http.server import BaseHTTPRequestHandler, HTTPServer
LOG_FILE = "tunnel-events.jsonl"
def mask(value: str) -> str:
# The Id field carries the authtoken for Token events. Never store it in full.
if not value or len(value) < 8:
return "****"
return value[:4] + "..." + value[-2:]
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
length = int(self.headers.get("Content-Length", 0))
try:
event = json.loads(self.rfile.read(length))
except json.JSONDecodeError:
self.send_response(400)
self.end_headers()
return
record = {
"received_at": datetime.now(timezone.utc).isoformat(),
"type": event.get("Type"),
"status": event.get("Status"),
"action_date": event.get("ActionDate"),
"id": mask(str(event.get("Id", ""))) if event.get("Type") == "Token"
else event.get("Id"),
}
with open(LOG_FILE, "a", encoding="utf-8") as f:
f.write(json.dumps(record) + "\n")
if record["type"] == "Tunnel" and record["status"] == "Connected":
print(f"ALERT: tunnel {record['id']} connected at {record['action_date']}")
self.send_response(200)
self.end_headers()
HTTPServer(("127.0.0.1", 8080), Handler).serve_forever()
A few notes on this sketch. It stores ActionDate exactly as received and adds its own received_at timestamp, because this guide does not specify the ActionDate format; parse it only after you have confirmed the format from real events. It binds to 127.0.0.1, which means it must sit behind something that can receive the POST from our platform, such as a reverse proxy on a server you control. A stale-tunnel check can then be a scheduled job that scans the log for Tunnel Connected events without a matching Disconnected for the same Id within your threshold.
For Token events, the Id field is the authtoken itself. An unmasked webhook log is therefore a credential store. Mask or hash token values before writing them anywhere, restrict who can read the log, and never let the coding agent read the raw log into its context. Request signing is documented for File Server webhooks, not for the platform-wide Token/Tunnel webhooks, so protect the receiving endpoint with the controls you have available, such as HTTPS, a hard-to-guess path, and network restrictions where your infrastructure allows them.
Guardrail 6: Keep application-level authentication on every exposed service
A tunnel provides reachability. It does not decide who is allowed in. Whatever authentication, authorization, and network policy your application enforces locally is what protects it once it is public. Tunnels do not bypass those controls, and they do not add them for you. A random subdomain is an unlisted address, not a password.
This matters more with agents than with humans because of a specific, very common pattern: the agent hits an authentication error while testing through the tunnel, and the shortest path to a passing test is to disable authentication. In a local-only environment, that is a bad habit. Behind a public URL, it is an exposure. Your project instructions should forbid it outright, as in the policy block above, and reviewers should look for auth-related changes in any diff produced during a tunnel task.
Practical expectations per service type
- Web apps and previews: keep the app's login enabled, use test accounts rather than real ones, and avoid exposing ports that also serve admin or debug routes.
- Webhook receivers: keep provider signature verification on. A public URL means anyone can POST to it, not only the provider you are testing.
- MCP servers: if an agent is exposing an MCP server for a remote client, follow our guide to securing a Streamable HTTP MCP server with OAuth and Origin checks before the tunnel starts. For exposing a locally running McpNet Gateway, see our post on the MCP Gateway tunnel.
- Databases and raw TCP services: strong, non-default credentials, non-production data, and TLS where the database supports it.
- File Server: restrictive permissions, expiring share links with passwords, and, for sensitive folders in the Default web manager, per-folder encryption. That feature uses AES-256-CBC with a folder password and a PBKDF2-derived key (100,000 iterations); the password and key are never stored, and there is no admin override or password recovery, so keep the password safe.
Least privilege applies inside the application as well: if a reviewer only needs to view a page, give them a read-only test account rather than an administrator.
A guarded agent tunnel task, step by step

The following sequence ties the six guardrails into a single routine. It is our recommended operating procedure for agent-driven tunnel work, layered on top of the standard workflow (run the client on a device that can reach the service, select the device by token, select a relay server, create the configuration, start it, then stop or delete it). It is not a replacement for the MCP Server setup steps, which are covered in our introduction post.
Confirm the device and credential
Make sure the agent will use the dedicated device and token you scoped for this work, configured outside the conversation, with no secrets in the prompt or repository.
State the goal, not the mechanism
Ask for the outcome ("let me preview the signup page on my phone") and let the agent propose a tunnel type from your policy. This surfaces its reasoning for review instead of hiding it in your instructions.
Let the agent create, not start
The agent creates the tunnel and presents the review summary: type, local target, service and its authentication, device, Process Type, and planned stop time.
Review and approve the start
A human checks the summary against the request-to-type table and confirms. Only then does the agent start the tunnel and share the public URL or host and port.
Do the work and verify behavior
Use the tunnel for its purpose. Confirm the exposed service still requires login where expected, and that no unrelated routes are reachable.
Stop, delete, and report
The agent stops the tunnel, deletes it if it was a one-off (or you delete it in the dashboard), and lists every tunnel it touched with its final state.
Reconcile with the webhook log
Check that a Disconnected event followed every Connected event for the agent's Token Group, and investigate any mismatch.
Pre-flight checklist before letting an agent manage tunnels
Run through this list once when you first connect an assistant to our MCP Server, and again whenever you change devices, repositories, or team members. If any answer is "no" or "not sure", fix that first.
Credentials and devices
- The agent uses a device whose reachable services you are comfortable briefly exposing.
- The credential is configured outside the conversation and excluded from version control.
- Project instructions forbid printing, copying, or committing tokens.
- You know how to replace a compromised token in the current dashboard.
Policy
- A written tunnel policy exists where the agent reads it at the start of each session.
- HTTP with a random subdomain is the default; TCP and UDP need justification; Proxy and File Server need explicit human request.
- Custom domains and custom subdomains are reserved for human-initiated tunnels.
- The policy forbids disabling authentication to make a tunnel work.
Review and cleanup
- Your MCP client asks for confirmation before tunnel tool calls, and those tools are not on an auto-approve list.
- The agent presents a review summary before every start.
- "Done" includes stop, delete for one-off tunnels, and a final report.
- Someone owns a daily check of the dashboard for leftover tunnels.
Audit and application security
- The agent's device is in its own Token Group with platform-wide webhooks configured.
- The webhook receiver masks token values and is not readable by the agent.
- Alerts exist for unexpected starts and tunnels without a matching Disconnected.
- Every service the agent might expose has its own authentication enabled.
Troubleshooting and incident response
Even with guardrails, things go sideways. Here is how to handle the situations teams most often run into.
The agent says it stopped a tunnel, but it still seems reachable
Check the dashboard for the tunnel's actual state and look for a Disconnected event in your webhook log. The agent may have stopped a different tunnel, or its tool call may have failed silently in a long session. Stop it manually. If you cannot identify which tunnel is serving traffic, stop or disconnect the Localtonet client on that device, which ends availability for every tunnel on it.
The agent keeps choosing TCP for web services
This usually means the instructions describe ports rather than goals. Make the default explicit ("web content means HTTP tunnel"), add the request-to-type table to your instructions, and require a written justification for raw tunnels. Rejecting the first wrong proposal during review also teaches the session quickly.
A File Server tunnel exposed more than intended
Stop it immediately. Then review what the folder contained, whether share links were created, and whether anything sensitive (keys, credentials, environment files) was inside. Rotate any secrets that were in the folder, regardless of whether you can prove they were accessed. When you recreate the share, use a dedicated folder and restrictive permissions.
A token appeared in a commit or chat transcript
Treat it as compromised: stop tunnels on that device, replace the credential in the dashboard, and remove the secret from the repository history using your version control platform's guidance. Removing it in a new commit is not enough because the old commit still contains it. Check webhook events for unfamiliar Token Connected activity.
You are getting webhook events you cannot explain
Correlate them with the agent's task reports and your own dashboard actions. If the Token Group contains more than the agent's device, events from other devices will appear too; this is one more reason to give the agent's device its own group.
Frequently asked questions
Can Claude Code create and start Localtonet tunnels on its own?
Yes. Our Localtonet MCP Server lets AI coding assistants such as Claude Code create, start, and stop tunnels directly from the assistant. Whether it does so without asking depends on your MCP client's tool-confirmation settings and your project instructions. We recommend keeping confirmations on and requiring explicit approval before any start.
Does the Localtonet MCP Server have per-tool permissions or a built-in approval step?
Per-tool permissions and built-in approval workflows inside the MCP Server are not part of the documentation this guide is based on, so do not rely on them. Enforce review through your MCP client's confirmation prompts, a written tunnel policy in your project instructions, and the create-then-start separation of our tunnel lifecycle.
Is a tunnel public as soon as the agent creates it?
No. Creating a tunnel does not mean it is running. It must be started, and it stays available only while the selected client device is connected and the tunnel is running. That gap between create and start is the ideal place for human review.
How do I find tunnels an agent forgot to stop?
Check the dashboard regularly, and configure platform-wide Token/Tunnel webhooks for the Token Group containing the agent's device. Each event carries Id, ActionDate, Type, and Status, so a Tunnel Connected event without a matching Disconnected after your chosen threshold points to a forgotten tunnel.
Why is my webhook log considered sensitive?
For Token events, the Id field contains the authtoken. Storing those events unmasked creates a file full of credentials. Mask or hash token values before writing them, restrict access, and keep the raw log out of the agent's context.
Which tunnel type should an agent use for a web preview?
An HTTP tunnel pointing at the dev server's local IP and port, with a random subdomain. It serves the content at a public HTTPS address. Use raw TCP or UDP only for non-HTTP protocols, and never use Proxy or File Server for a preview.
Is a random subdomain enough to keep a preview private?
No. A random subdomain is hard to guess but it is not access control. URLs leak through chat, browser history, and screenshots. Keep the application's own authentication enabled on anything you expose.
What is the fastest way to shut everything down if an agent misbehaves?
Stop or disconnect the Localtonet client on the device the agent uses. Tunnels are available only while their client device is connected, so this ends exposure for every tunnel on that device. Then review the dashboard, delete what should not exist, and check your webhook log.
Should I let an agent manage VPN Manager or Proxy tunnels?
We recommend against delegating them by default. Proxy tunnels make your device an exit node for other traffic, and VPN Manager builds a private mesh network with firewall rules that bridge LANs. Both deserve a deliberate human decision rather than an agent's interpretation of a task.
Give your coding agent tunnels, with guardrails
Set up our Localtonet MCP Server on a scoped device, keep review before every start, and record every Connected and Disconnected event with Token/Tunnel webhooks. Create your account to start building a safe agent workflow today.
Get Started Free →Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.