readonly-mcp
Provides read-only live search of a client's Gmail inbox, returning matching messages without storing them; mailbox reads are logged and writes are not possible.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Server Development: an AI assistant can answer questions about client data, but only after signing in, only by reading, and every question is logged
Part of Relationship Digest, a system I built and run in production for B2B creative agencies. See the hub repo.
The problem
Every question about a client (how is this account doing, what did we suggest, who replied) used to mean writing a new database query. An AI assistant could answer these in seconds, but handing it client data is only acceptable if it cannot change anything, only approved people can reach it, provider keys never leave the server, and every question can be traced.
Related MCP server: ClientDesk MCP
What this does
Serves the Model Context Protocol by hand: Streamable HTTP, stateless JSON-RPC, so Claude can use it as a claude.ai custom connector.
Signs people in with Google through the OAuth flow claude.ai runs, and gives a pass only to a verified email on an allowlist: a 1-hour access token and a 30-day refresh token that rotates on use. Only hashes are stored, and one switch revokes everything.
Reads, never writes. Every tool is read-only, and a test fails if a tool module contains a write call. Replies are capped at 200 rows and scrubbed of secrets.
Reads live data without keeping it. A mailbox search reads the client's Gmail at that moment and stores nothing; a third-party lookup adds the provider key on the server and scrubs it out of the reply.
Logs every tool call (who asked and which tool) to the activity feed, plus a separate row whenever a client's mailbox is read.
How it works
%%{init: {"htmlLabels": false, "flowchart": {"htmlLabels": false}}}%%
flowchart LR
C["Claude<br/>(custom<br/>connector)"] -->|"no pass"| R["Refuse, ask<br/>to sign in"]
C -->|"sign in"| G["Sign in<br/>(Google)"]
G --> A{"Email on<br/>the allow<br/>list?"}
A -->|"no"| N["No pass"]
A -->|"yes"| P["1-hour pass,<br/>30-day<br/>renewal"]
P --> C
C -->|"question<br/>+ pass"| T["Run a<br/>read-only<br/>tool"]
T --> D[("Client<br/>data")]
T --> M["Live inbox<br/>(Gmail)"]
T --> X["Other APIs,<br/>key kept<br/>here"]
T --> H["Hide<br/>secrets, cap<br/>the rows"]
H --> L[("Activity<br/>log")]
H -->|"answer"| CFind the connector. Claude calls the server with no pass and gets a refusal that points to where sign-in starts. It registers itself; only claude.ai, claude.com or localhost return addresses are accepted, so a sign-in code is never sent anywhere else.
Sign in with Google. The user signs in with Google. Only a Google-verified email that is on the allowlist gets a pass. The pass lasts an hour; the renewal lasts 30 days and is replaced each time it is used. A renewal used twice means it leaked, so its whole family is revoked.
Run a read-only tool. Each question names a tool. The tools only read: client and contact lookups, outcome counts, a live mailbox search, and lookups on third-party APIs.
Hide secrets and cap the rows. Tables that hold credentials are not readable at all, secret columns are dropped, the server's keys are removed from any third-party reply, long text is cut, and no reply carries more than 200 rows. (This repo also masks strings that look like keys.)
Log it. Every tool call is written to the activity log, whether it succeeds or not.
Where this repo simplifies production: the data is a synthetic JSON file instead of the live
database, the mailbox and the third-party provider in the demo are fixtures (real Gmail and
Serper adapters are in src/readonly_mcp/adapters/), and the five tools here stand in for a
larger set of the same kinds. Production logs who called which tool (and marks mailbox
reads); this repo's log also keeps the scrubbed arguments, the outcome and the row count.
More detail: docs/architecture.md.
Results in production
The operator connects Claude in the browser to the live system and asks about clients, digest suggestions, outcomes, maintenance runs and costs without writing a query. Claude can read a client's live inbox and calendar for an analysis through Google OAuth, verified for restricted scopes (read-only Gmail and Calendar), and nothing from those reads is stored. It can run lookups on the third-party APIs the system uses while the keys stay on the server. Nothing can be changed through the connector, by construction. The lessons that shaped it are in CHANGELOG.md.
Run it in 2 minutes
pip install -e .
python examples/run_demo.pyNo keys, no network. Everything runs on synthetic fixtures in data/sample/
(python scripts/make_sample_data.py regenerates them). Demo output:
=== 1. Claude finds the connector and signs in ============================
call with no token -> 401, points to oauth-protected-resource
register a non-Claude redirect -> refused (invalid_redirect_uri)
register claude.ai redirect -> client mcp-zAza...
Google sign-in, not allowed -> {'refused': 'access_denied'}
Google sign-in, allowed -> access token for 3600s + refresh token
=== 2. Tools over JSON-RPC (every one read-only) ==========================
initialize -> readonly-mcp protocol 2025-06-18
tools/list -> ['list_clients', 'find_contacts', 'outcome_metrics', 'search_inbox', 'third_party_lookup']
list_clients (first row) -> {'client_id': 'client-1', 'name': 'Demo Agency A', 'crm': 'attio', 'contacts': 23}
note: the client's dashboard token was scrubbed from the reply
outcome_metrics -> {'client': 'Demo Agency A', 'suggested': 21, 'reached_out': 13, 'replied': 3, 'meetings': 3, 'bounced': 1, 'reply_rate_of_reached': 0.231}
find_contacts(limit=5000) -> 4 rows (cap is 200); first: Diane Bell, Initech Labs
=== 3. Live inbox read: nothing stored, drafts dropped, bulk flagged ======
2026-11-17 Re: catching up, Troy bulk=False
2026-11-14 Re: catching up, Holly bulk=False
2026-11-11 Re: catching up, Brenda bulk=False
2026-11-08 Re: catching up, Tyler bulk=False
2026-11-05 Re: catching up, Amy bulk=False
2026-11-03 Invite: Northwind Media showcase bulk=True
2026-11-02 Re: catching up, Dakota bulk=False
(the unsent draft in the fixture mailbox is not listed)
client with no mailbox -> isError=True: Demo Agency B has not connected a mailbox.
=== 4. Third-party lookup: key added and scrubbed on the server ===========
GET /companies/lookup -> {'request': {'api_key_used': '[redacted]'}, 'company': {'name': 'Acme Studio', 'domain': 'acmestudio.example.com', 'industry': 'Media', 'employees': 20}}
key in reply? False
POST (not a lookup) -> isError=True: POST /companies/lookup is not an allowed lookup for company_data
delete_contact -> isError=True: Unknown tool 'delete_contact'.
=== 5. Tokens: rotation, reuse detection, kill switch =====================
refresh -> new access + refresh pair; old refresh used up
replay the old refresh token -> refused (refresh already used or revoked); new token now valid: False
kill switch -> revoked 2 tokens; call now -> 401
=== Activity log (one row per tool call) ==================================
operator@example.com list_clients ok=1 rows=3 mailbox=0 args={}
operator@example.com outcome_metrics ok=1 rows=0 mailbox=0 args={"client": "Demo Agency A"}
operator@example.com find_contacts ok=1 rows=4 mailbox=0 args={"client": "client-3", "query": "an", "limit": 5
operator@example.com search_inbox ok=1 rows=7 mailbox=1 args={"client": "Demo Agency A", "query": "example"}
operator@example.com search_inbox ok=0 rows=0 mailbox=1 args={"client": "Demo Agency B", "query": "hello"}
operator@example.com third_party_lookup ok=1 rows=0 mailbox=0 args={"provider": "company_data", "path": "/companies
operator@example.com third_party_lookup ok=0 rows=0 mailbox=0 args={"provider": "company_data", "method": "POST", "
operator@example.com delete_contact ok=0 rows=0 mailbox=0 args={"id": 1}Tests: pip install -e ".[dev]" && pytest -q (32 tests, no network: the real adapters are
checked with a fake HTTP opener). To try it over HTTP on your machine:
python -m readonly_mcp.wsgi serves the demo on http://localhost:8765/mcp.
Design decisions
Hand-written protocol, not an SDK. Four JSON-RPC methods fit in one small module that runs on Python 3.9 inside an ordinary web app; the cost is following spec changes by hand. (1)
Sign-in instead of a secret URL. A link can be pasted anywhere; a Google sign-in with an allowlist cannot be passed on. The cost is running a small OAuth server. (2)
Read-only proven by a test. The no-writes test is a stronger promise than a review comment; the cost is that any write needs its own, separate path. (3)
What I'd do next
Store the activity log beside a short summary of each answer, so a past conversation can be audited without re-running it.
Add per-tool rate limits for the paid third-party lookups.
Publish the server's tool schemas as a versioned file so a schema change shows up in review.
Stack
Production: a Flask route on DigitalOcean App Platform; Supabase Postgres (read-only queries, hashed token table, activity feed); Google OAuth for sign-in and for the client's read-only Gmail and Calendar access; claude.ai custom connector (MCP Streamable HTTP); third-party lookups such as RapidAPI, Serper, Apify, Postmark (read), Slack (read) and Attio (read), keys held in the server's environment.
This repo: Python 3.9+ standard library at runtime, SQLite in place of Supabase, a WSGI app on
wsgiref, fixtures by default, real Google, Gmail and Serper adapters, pytest, ruff, GitHub Actions, gitleaks.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only Google Ads, GA4 and Search Console data for Claude, with no Google Cloud setup.
Read-only access to a company's ERP for Claude, ChatGPT and Gemini, with OAuth and an audit trail.
Create contacts, move deals, send proposals and invoices, read your inbox, from Claude or ChatGPT.
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceEnables Claude to answer seller questions from previously saved research using read-only tools for accounts, initiatives, intent signals, key people, knowledge retrieval, and guarded dataset queries. It supports multi-tenant, authenticated access with tenant isolation and enforced read-only security.MIT- AlicenseNot gradedqualityBmaintenanceEnables Claude to query client and document data in plain English with cited answers, enforce per-client access, safely file incoming documents, and record audited actions through MCP tools.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to safely look up customers, orders and support tickets through typed, parameterized read-only tools with row limits and truncation flags, plus resources, a triage prompt and an audit trail. The only mutation path is a two-step guarded ticket-status change that requires a preview and a matching confirmation token, with every call logged.MIT
- AlicenseAqualityBmaintenanceEnables AI assistants such as Claude, Cursor, and ChatGPT to securely discover and call tools for querying a SQL database, searching documentation, and accessing CRM/ticketing data, with read-only enforcement, least-privilege scopes, PII redaction, and audit logging.8MIT