cd /news/ai-agents/building-a-read-only-remote-mcp-serv… · home › topics › ai-agents › article
[ARTICLE · art-182401] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Building a read-only remote MCP server for health data: OAuth, tools and limits

A developer built garmlink, a free hosted remote MCP server that connects a Garmin Connect account to assistants like Claude and ChatGPT, using OAuth 2.1 with PKCE and a single read-only scope. The server enforces read-only behavior architecturally by never holding write-capable credentials and never exposing write tools, rather than relying on advisory tool annotations such as readOnlyHint. The author notes that remote servers shift credential custody to the operator, who must encrypt tokens at rest and keep their lifetimes short.

recommendation

For read-only MCP servers, scope OAuth tokens to a single read permission, encrypt them at rest, keep lifetimes short, and omit any write-capable credential or tool.

more in playbook: Securing agents and AI tools
by read2 min views4 publishedDec 5, 2026

Health data is data you want an assistant to read and never to change. That makes it a good case study for the Model Context Protocol (MCP): you can design a server where "read-only" is a property of the architecture, not a sentence in the docs. Here is how the pieces fit together, and where the limits are.

A local MCP server runs on your machine and talks over stdio. It is simple, but every user must install and secure it, and it does not work from a phone or a browser-based assistant. A remote server speaks MCP over HTTP (the Streamable HTTP transport), so the assistant just connects to a URL and the user installs nothing. The cost moves to the author, who now holds credentials and has to protect them.

A remote server must know which person is calling. The MCP specification builds on OAuth 2.1, so an assistant can run an authorization-code flow with PKCE:

The consequences are good ones: tokens are per user and revocable, the assistant never sees the upstream password, and you decide what a token may do. For health data I would keep the scope list boring: one read scope, nothing else. Encrypt tokens at rest and keep their lifetime short.

Every tool is a function the model may call. Four rules that held up:

{
  "name": "get_sleep",
  "description": "Sleep sessions for a date range (90 days maximum).",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "idempotentHint": true,
    "openWorldHint": true
  }
}

Hints are advisory: a client may use them to skip a confirmation prompt, but nothing enforces them. Real read-only behavior comes from the server: never hold a credential that can write, never expose a write tool.

One subtlety: a "refresh" tool that asks your server to re-sync from the upstream source changes your own cache, not the user's account. Say so in its description instead of hiding it behind the word read-only.

I used these ideas in garmlink, my own project: a free hosted MCP server that connects a Garmin Connect account to assistants such as Claude and ChatGPT. It is read-only, signs in with OAuth, and is independent of Garmin (no affiliation, no endorsement). You can see the flow from the user's side at garmlink.

Which limits would you add to the list?

Sébastien from garmlink

── more in #ai-agents 4 stories · sorted by recency
── more on @garmlink 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/building-a-read-only…] indexed:0 read:2min 2026-12-05 · —