android

An Android and Kotlin codebase for an MCP server, health-data access, and its mobile app shell. Health Connect is Android’s system for sharing health information between apps.

In plain words
What is it for?
Use it to build MCP sessions and tool registration, expose steps, heart rate, sleep, HRV, and workout data, record tool calls, and run the Android service and interface.
Why use it?
It separates the protocol, health queries, and user interface into modules, making each part’s responsibilities clear and limiting unwanted Android dependencies.

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/android
Clone the repo
git clone --depth 1 https://github.com/Monkopedia/rouse-context

Made for: Claude Code.

Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 560 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.00017 $0.00560
Opus 5 $0.00009 $0.00280
Sonnet 5 $0.00003 $0.00112
Haiku 4.5 $0.00002 $0.00056

Measured yesterday against content hash 9bcbf4b2cc5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

android 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 yesterday.

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/android.md · 56 lines

How it starts

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

Android App Agent

You work on the pure Android/Kotlin modules: :mcp-core, :mcp-health, and :app. These handle MCP server logic, health data exposure, and the user-facing app.

Modules

:mcp-core

The MCP contract layer. Defines McpServerProvider (interface for registering tools/resources on the SDK Server), McpSession (session orchestrator over raw I/O streams), and AuditListener (callback for tool-call logging).

  • Built on the official MCP Kotlin SDK (io.modelcontextprotocol:kotlin-sdk)
  • Providers use SDK types directly (server.addTool(), server.addResource())
  • McpSession.run(input, output) suspends until session ends
  • MUST NOT depend on Android framework APIs beyond androidx.core

:mcp-health

Health Connect MCP server. Implements McpServerProvider to expose live health data (steps, heart rate, sleep, HRV, workouts) as MCP tools and resources.

  • Depends only on :mcp-core and androidx.health.connect
  • Registers tools/resources in register(server: Server)
  • Health Connect queries run on the calling coroutine context

:app

The shell that wires everything together:

  • Foreground service during active MCP sessions
  • Per-tool-call audit log (implements AuditListener)
  • Session history UI
  • Trust/permission management
  • Settings
  • Creates McpSession(providers, auditListener) and connects it to tunnel streams

Key Patterns

  • MCP SDK types used directly — no wrapper types unless there's a clear value add
  • McpSession uses CompletableDeferred + server.onClose to suspend until session ends
  • Tests use loopback sockets with SDK ClientStdioServerTransport for end-to-end verification

What You Should NOT Touch

  • relay/ — server-side code, different language/domain
  • tunnel/ — networking layer, different concerns (FCM, TLS, wakelocks)
  • You CAN read tunnel code to understand the stream interface, but don't modify it

Build & Test

JAVA_HOME=/usr/lib/jvm/java-17-openjdk ./gradlew :mcp-core:assembleDebug :mcp-health:assembleDebug
JAVA_HOME=/usr/lib/jvm/java-17-openjdk ./gradlew :mcp-core:testDebugUnitTest
JAVA_HOME=/usr/lib/jvm/java-17-openjdk ./gradlew ktlintCheck detekt

Read the full file on GitHub · 56 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. yesterday First seen · 56 lines · 17 tokens per session scan A 9bcbf4b2cc5a

Subscribe to this mod's changes

android is an agent published in the GitHub repository Monkopedia/rouse-context (3 stars, last pushed yesterday), licensed Apache-2.0. It adds 17 tokens to every session and 560 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