tunnel-client

tunnel-client is an agent for Claude Code from Monkopedia/rouse-context. It costs 21 tokens per session (625 once invoked), scanned A, original, Apache-2.0.

An Android networking module that wakes a device, connects it securely to a relay server, and manages the lifetime of that connection.

In plain words
What is it for?
Use it for Firebase Cloud Messaging wakeups, TLS relay connections, Android certificate setup, wakelocks, and session timeouts.
Why use it?
It handles device wakeups, encrypted connections, certificates, and clean disconnects so the app layer can use a raw data stream.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/monkopedia/rouse-context/tunnel-client
Clone the repo
git clone --depth 1 https://github.com/Monkopedia/rouse-context

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tunnel-client

README.md
[![agentmods](https://agentmods.dev/badge/agents/monkopedia/rouse-context/tunnel-client.svg)](https://agentmods.dev/agents/monkopedia/rouse-context/tunnel-client)
Your own site
<a href="https://agentmods.dev/agents/monkopedia/rouse-context/tunnel-client"><img src="https://agentmods.dev/badge/agents/monkopedia/rouse-context/tunnel-client.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 625 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00021 $0.00625
Opus 5 $0.00010 $0.00313
Sonnet 5 $0.00004 $0.00125
Haiku 4.5 $0.00002 $0.00063

Measured 3d ago against content hash 067ca712268a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tunnel-client scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/tunnel-client.md · 46 lines

How it starts

The opening of the file, as written. The whole thing — 46 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tunnel Client Agent

You work on the :tunnel Android module. This module bridges the relay server to the on-device MCP session. It handles networking, wakeup, and session lifecycle but has ZERO knowledge of MCP.

What the Tunnel Module Does

  1. FCM Wakeup — Receives high-priority FCM messages that wake the device. Extracts the session/device ID from the push payload.
  2. TLS Connection — Connects back to the relay server over TLS using the device's cert (stored in Android Keystore). The cert was provisioned during onboarding via ACME.
  3. Session Lifecycle — Acquires a wakelock during active sessions. Provides raw InputStream/OutputStream to the app layer. Tears down cleanly on idle timeout, disconnect, or explicit close.
  4. ACME Cert Provisioning — On first run (onboarding), generates a keypair in Android Keystore, creates a CSR, sends it to the backend, receives a signed cert for the device's subdomain.

Module Boundaries

  • :tunnel MUST NOT depend on :mcp-core or :mcp-health. It knows nothing about MCP.
  • :tunnel exposes raw I/O streams. The :app module wires those streams to McpSession.
  • :tunnel depends on: Firebase Messaging, AndroidX Lifecycle, ACME4J, AndroidX Core.

Key Technical Details

  • Android Keystore — Private key generated with KeyPairGenerator using AndroidKeyStore provider. Key is hardware-backed (HSM) on supported devices. The key NEVER leaves the secure element.
  • TLS — The device acts as a TLS server (it has the cert for its subdomain), but initiates the TCP connection to the relay. The relay splices this connection to the waiting MCP client.
  • FCM — High-priority messages target sub-500ms wakeup on non-Dozing devices. Must handle manufacturer-specific battery optimization (Samsung, Xiaomi).
  • Wakelocks — Acquired when session starts, released on teardown. Use PowerManager.PARTIAL_WAKE_LOCK.

What You Should NOT Touch

  • relay/ — server-side code
  • mcp-core/, mcp-health/ — MCP protocol layer
  • app/ UI code (but you may need to understand how app wires tunnel to MCP)

Read the full file on GitHub · 46 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 46 lines · 21 tokens per session scan A 067ca712268a

Subscribe to this mod's changes

tunnel-client is an agent published in the GitHub repository Monkopedia/rouse-context (3 stars, last pushed 3d ago), licensed Apache-2.0. It adds 21 tokens to every session and 625 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories