Gopher & Gemini MCP Server
This server enables AI assistants to browse and interact with resources from both Gopher and Gemini protocols through four core tools:
gopher_fetch: Retrieve Gopher menus (type 1), text files (type 0), search results (type 7), and binary file metadata, with structured JSON responses optimized for LLM consumption.gopher_batch_fetch: Fetch multiple Gopher URLs concurrently in parallel for improved performance.gemini_fetch: Access Gemini pages with full TLS security, Trust-on-First-Use (TOFU) certificate validation, client certificate support, and native gemtext parsing — handling redirects, input prompts, and error statuses.gemini_batch_fetch: Fetch multiple Gemini URLs concurrently in parallel.
Security & Safety: Built-in SSRF protection (rejecting loopback/private IPs by default), host allowlists, timeouts, size limits, and input sanitization protect against misuse.
Performance: Async/await patterns and intelligent per-protocol caching reduce redundant network requests.
Configurable: Behavior is tunable via environment variables for response size limits, timeouts, caching, and allowed hosts.
Overall, it lets AI assistants like Claude Desktop naturally explore Gopherspace and Geminispace — directories, gemlogs, search servers, and text archives — safely and efficiently.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gopher & Gemini MCP Serverfetch the Gopher root menu from gopher.floodgap.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gopher & Gemini MCP Server
A modern, cross-platform Model Context Protocol (MCP) server that enables AI assistants to browse and interact with both Gopher protocol and Gemini protocol resources safely and efficiently.
Overview
The Gopher & Gemini MCP Server bridges vintage and modern alternative internet protocols with AI assistants, allowing LLMs like Claude to explore the unique content and communities that thrive on both Gopherspace and Geminispace. Built with FastMCP and modern Python practices, it provides secure, efficient gateways to these distinctive internet protocols.
Key Benefits:
Discover alternative internet content - Access unique resources on both Gopher and Gemini protocols
Safe exploration - Built-in security safeguards, TLS encryption, and content filtering
Modern implementation - Uses FastMCP framework with async/await patterns
Developer-friendly - Comprehensive testing, type hints, and documentation
Advanced security - TOFU certificate validation and client certificate support for Gemini
Related MCP server: Tor MCP Server
Features
Dual Protocol Support:
gopher_fetchandgemini_fetchtools for comprehensive protocol coverageComprehensive Gopher Support: Every standard RFC 1436 item type — menus (
1) and Index-Search servers (7) as structured menus, text (0), HTML (h), info (i) and error (3) lines as text, the fourteen binary types as metadata only, and the three interactive ones (2,8,T) refused without opening a connection. The one standard type with no category of its own is+(redundant server), which names an alternate host for the preceding item rather than content to render; it takes the unknown-type path below. An unknown type is read as text, best-effort, and an hURLURL:<target>selector is followed to the destination the server actually statedFull Gemini Implementation: Native gemtext parsing, TLS security, and status code handling
Advanced Security: TOFU certificate validation with dedicated inspection and recovery tools, scoped client certificates, and secure TLS connections
Safety First: Built-in timeouts, size limits, input sanitization, SSRF protection, per-host rate limiting, and host allowlists
LLM-Optimized: Returns structured JSON responses designed for AI consumption
Cross-Platform: Works seamlessly on Windows, macOS, and Linux
Modern Development: Full type checking, linting, testing, and CI/CD pipeline
High Performance: Async/await patterns with intelligent caching — and cached results say so, with a per-request
refreshbypassContinuable Reads: A menu or page cut at the render limit reports where it stops, so
offsetreads the rest instead of leaving a partial view
Protocols in scope
Gopher (RFC 1436, including the de-facto item types in common use) and Gemini, both read-only. That is the whole surface, and the neighbouring protocols are deliberately out of scope rather than merely unbuilt:
Titan and Misfin are write protocols — upload and mail. A tool an LLM drives should not be able to publish to someone's capsule or send mail as them, and adding either would make every safeguard here (robots, rate limits, allowlists) protect a much smaller share of what the tool can do.
Spartan and Nex are separate protocols with their own parsers and their own failure modes, serving a small fraction of the hosts these two do. They would double the security-relevant surface for a rounding error in reach.
Gopher+ is not implemented. The
:item type is recognised because it appears in ordinary menus, but no Gopher+ attribute or metadata request is ever sent.
If you need one of these, an MCP server that does it well is a better answer than a flag on this one.
Documentation
Complete documentation is available at cameronrye.github.io/gopher-mcp
Migration Guide and Changelog — what changed, and what an upgrade asks of you
Quick Start
Prerequisites
Python 3.11+ - Download here
uv package manager - Install uv
Installation
Option 1: Zero-install with uvx (Recommended)
No clone, no checkout — uv fetches and runs the published package on demand:
uvx gopher-mcpOption 2: PyPI Installation
# Install from PyPI
pip install gopher-mcp
# Or with uv
uv add gopher-mcpOption 3: Development Installation
# Clone the repository
git clone https://github.com/cameronrye/gopher-mcp.git
cd gopher-mcp
# Set up development environment
./scripts/dev-setup.sh # Unix/macOS
# or
scripts\dev-setup.bat # Windows
# Run the server
uv run task serveOption 4: Docker
Tagged releases publish a slim, non-root image to
ghcr.io/cameronrye/gopher-mcp, tagged with the release version plus :latest
for stable (non-pre-release) tags:
# The default CMD serves streamable-http on 0.0.0.0:8000
docker run --rm -p 8000:8000 \
-v gopher-mcp-state:/home/app/.local/share/gopher-mcp \
ghcr.io/cameronrye/gopher-mcp:latest
# Or run over stdio, e.g. for an MCP client
docker run --rm -i --no-healthcheck \
-v gopher-mcp-state:/home/app/.local/share/gopher-mcp \
ghcr.io/cameronrye/gopher-mcp:latest --transport stdioTo run a modified tree, the repository ships the Dockerfile the published
image is built from: docker build -t gopher-mcp .
Mount a volume, or Gemini trust is meaningless. Without one, the TOFU pins and the client certificates' private keys die with the container, so every start re-arms blind trust-on-first-use — the pin is the only thing that authenticates a Gemini capsule — and destroys any identity you minted, whose private key cannot be recovered.
Mount it at that exact path. /home/app/.local/share/gopher-mcp is where
the server writes (tofu.json and certs/), and it is the one directory the
image pre-creates owned by the runtime user and mode 700 — which is what lets
a named volume come up writable instead of root-owned. Mounting anywhere else
persists an empty directory. ~/.gemini is not the path: it is only a
read-in-place upgrade route for installs that pinned certificates before
gopher-mcp had a directory of its own, and it is honoured only when its store
file is already there, which it never is in a fresh image.
Health checks. The HTTP transports serve GET /health, which answers
{"status": "ok", "version": "..."} and nothing else — no configuration, no
allowlists, no store paths. It bypasses authorization by SDK design, which is
what makes it usable as a probe. The image's HEALTHCHECK polls it on the
hard-coded port 8000 to match the default CMD, so override the healthcheck
alongside --port, and pass --no-healthcheck when running stdio — a stdio
container serves no HTTP and would otherwise be reported unhealthy while working
perfectly.
Note: the default
CMDbinds0.0.0.0so the container is reachable out of the box. A non-loopback--hostalso turns off FastMCP's DNS-rebindingHost/Origincheck, matching what the SDK does when it is constructed with such a host — otherwise every client that was not on localhost got421 Misdirected Request. Keep the check on by naming the hostnames the deployment answers to with--allowed-host NAME(repeatable; a bare name matches any port). The HTTP transports are unauthenticated and have no TLS either — put the container behind a trusted reverse proxy, or use--transport stdio, before exposing it beyond your machine.
MCP Client Integration
Every client below runs the server over stdio — no ports, no TLS, no listening socket. The entry is the same three fields everywhere; only the file and the top-level key change:
Client | Where the entry goes | Top-level key |
Claude Desktop |
|
|
Claude Code |
|
|
Cursor |
|
|
VS Code |
|
|
Zed |
|
|
Windsurf |
|
|
{
"mcpServers": {
"gopher": {
"command": "uvx",
"args": ["gopher-mcp"]
}
}
}That is the whole entry: every setting in Configuration has a
working default, so add an "env" block only when you actually want to change
one. Installed with pip rather than uvx? Use "command": "gopher-mcp" and
"args": [] instead.
The Installation Guide
has the exact JSON for each client, including the two that do not use the
mcpServers key.
If a GUI client reports that the server failed to start, it is almost always
PATH: a GUI-launched application does not inherit your shell's, so uvx may
not be found. Use the absolute path (which uvx) as "command", and restart
the application fully rather than reloading the window.
{
"mcpServers": {
"gopher": {
"command": "uv",
"args": ["--directory", "/path/to/gopher-mcp", "run", "task", "serve"]
}
}
}On Windows use the absolute path with escaped backslashes
(C:\\path\\to\\gopher-mcp).
Usage
The server registers eight MCP tools:
Tool | Purpose |
| Fetch one Gopher resource |
| Fetch one Gemini resource |
| Fetch several Gopher URLs at once (bounded concurrency, max 50) |
| Fetch several Gemini URLs at once (bounded concurrency, max 50) |
| Inspect the Gemini TOFU trust store (read-only) |
| Remove or re-pin one host's certificate (destructive) |
| Inspect the stored Gemini client identities (read-only) |
| Create or remove one client identity (destructive) |
The four fetch tools are annotated read-only and open-world. The four certificate tools never touch the network, and each pair is split read from write so a client can gate the destructive one on its own.
Alongside them the server exposes one resource, gopher-mcp://policy, which
renders the fetch policy this process is actually running with — the allowlists,
caps and robots settings a refusal is decided from, with the two store paths
reduced to <configured> / <default>. There is deliberately no tool that
edits it: a fetched page talked into widening an allowlist would have widened it
for every later fetch. Two prompts, Explore a capsule or Gopher hole and
Summarize a gemlog or phlog, package the navigation and safety rules as a
one-click starting point.
gopher_fetch Tool
Fetches Gopher menus, text files, or metadata by URL with comprehensive error handling and security safeguards.
Parameters:
url(string, required): Full Gopher URL (e.g.,gopher://gopher.floodgap.com/1/)search(string, optional): Terms for a type-7 (Index-Search) selector. They are percent-encoded and sent as the query string, so pass the user's words raw — a query holding#,+,&or non-ASCII is truncated or mangled when written into the URL by hand. RFC 1436 gives only type 7 a query field, so leave it unset for every other item typerefresh(boolean, optional, defaultfalse): Skip the cached copy and re-fetch from the serveroffset(integer, optional, default0): Continue a truncated result — pass the previous result'snext_offset, which counts menu items for a menu
Response Types:
MenuResult (
kind: "menu"): For Gopher menus (type 1) and search results (type 7)Structured menu items with type, title, selector, host and port, each with a
next_urlto follow. An emptynext_urlmarks a display-only info line
TextResult (
kind: "text"): For text files (type 0)Returns the text content with metadata
BinaryResult (
kind: "binary"): Metadata only for the binary item types (4,5,6,9,g,I,d,s,;,p,P,:,M,<)Provides
bytesandmime_typewithout downloading binary content
ErrorResult (
kind: "error"): For errors and unfetchable contenterror.codeanderror.message; nothing was fetched. The interactive types (2CSO,8telnet,Ttn3270) have no fetchable body at all and answerNOT_FETCHABLEwithout opening a connection
gemini_fetch Tool
Fetches Gemini content with full TLS security, TOFU certificate validation, and native gemtext parsing.
Parameters:
url(string, required): Full Gemini URL (e.g.,gemini://geminiprotocol.net/)input(string, optional): Text to answer a Gemini input prompt (status 10/11); it is percent-encoded into the query stringrefresh(boolean, optional, defaultfalse): Skip the cached copy and re-fetch from the serveroffset(integer, optional, default0): Continue a truncated result — pass the previous result'snext_offset, which counts characters for a page body
Response Types: seven, one per kind.
GeminiGemtextResult (
kind: "gemtext"): For gemtext content (text/gemini)Parsed document in
document.linesanddocument.links, whoseurlfields are already resolved. A line carries its owntype,contentand whatever the marker cannot say (text,level,alt_text,language); there is no nested per-line object and no whole-documentraw_contentin the payload
GeminiSuccessResult (
kind: "success"): For other text content typesDecoded text in
content, with MIME type information
GeminiBinaryResult (
kind: "binary"): For binary contentMetadata only —
sizeand the detectedmime_type, never the bytes. A 1 MB body would be ~350k tokens of base64 the model cannot render anyway
GeminiInputResult (
kind: "input"): For input requests (status 1x)The capsule's
prompt, withsensitive: trueon status 11. Answer it by calling again withinput=, never by hand-building a query string
GeminiRedirectResult (
kind: "redirect"): For redirects (status 3x, where 31 is permanent)new_urlis the target. Redirects are not followed for you, so the result also carriescross_host(the target belongs to a different party than the one you asked for) andscheme(anything butgeminileaves Geminispace and cannot be fetched with this tool). Follow at most five in a row and stop on a URL already seen
GeminiErrorResult (
kind: "error"): For errors (status 40-59), and for failures raised on this side of the wire — SSRF and allowlist refusals, a robots block, a certificate mismatch, a timeouterror.codeanderror.message, wheremessageis written by this server. The capsule's own untrustedMETAtext is kept apart inerror.meta, so a hostile51 <instruction>cannot be read as this server's guidance. Where a status has a defined remedy — the whole temporary 4x family included — that remedy is inerror.next_step
GeminiCertificateResult (
kind: "certificate"): For certificate statuses (60-69)Certificate requirement information, plus a
next_stepwritten by this server (messageis the capsule's own text). A certificate that already exists for the host/port/path scope is attached automatically and the fetch path never creates one, so retrying unchanged returns status 60 again;gemini_client_cert_updatemints one for that scope, but only once the user has agreed to hold a persistent identity on that capsule.
GeminiErrorResult is an alias for the same ErrorResult model gopher_fetch
returns, not a separate type — its error object simply carries the extra
status, temporary and meta keys when the capsule actually answered.
Gemini results name the content length size where the Gopher results name the
same fact bytes. One concept, two wire names, kept apart only because renaming
either would break every existing consumer.
Cached Results and refresh
Successful bodies are cached per protocol for a few minutes. A result that came from the cache says so, so a replay is never mistaken for the current state of a resource:
cached—truewhen the result was replayed from the local cachecached_at— when that copy was actually fetched, as an ISO-8601 UTC timestamp (2026-09-02T12:00:00+00:00)cache_age_seconds— how old the copy was when it was returned
These appear only on the kinds that are actually cached (Gopher menu, text,
binary; Gemini gemtext, success, binary). Errors, redirects and
input/certificate prompts are never cached.
Pass refresh: true when the user wants the current state — it skips the cache
for that one call and still stores the fresh response. All four fetch tools take
it, the batch pair included.
Truncated Results and offset
Menus and page bodies are capped before they reach the model
(*_MAX_RENDERED_CHARS, GOPHER_MAX_MENU_ITEMS), but a cap is not a dead end.
A result cut short sets truncated: true and says where to resume:
next_offset— where the part that was cut begins, ornullwhen there is nothing moretotal_items(Gophermenu) /total_chars(text,success,gemtext) — how big the whole resource is.total_itemsisnullwhen the directory was larger than the render cap, because the total is not counted in that case
Call the same tool again with offset set to the previous next_offset and keep
going until next_offset comes back null. The unit is items for a menu and
characters for a body; bytes and size are byte counts and are never
offsets. For gemtext, a window ends on the last complete line, so consecutive
windows abut exactly and half a link never parses as a whole one.
Neither batch tool takes offset: one offset cannot mean anything sensible
across a list of different URLs. Continue a truncated batch item with the
single-URL tool, which is where next_offset is answerable.
Gemini Trust-Store Tools
Gemini has no certificate authorities: the first certificate seen for a host is
pinned, and every later connection must present the same one. When a host reissues
its certificate — routine for self-signed certs, usually at expiry — the fetch
fails with CERTIFICATE_CHANGED. Two tools handle that without hand-editing the
trust store on disk — $XDG_DATA_HOME/gopher-mcp/tofu.json, falling back to
~/.local/share/gopher-mcp/, ~/Library/Application Support/gopher-mcp/ on
macOS and %LOCALAPPDATA%\gopher-mcp\ on Windows, and overridable with
GEMINI_TOFU_STORAGE_PATH. An install that already has ~/.gemini/tofu.json
keeps using it exactly where it is, permanently: moving pins would lose them or,
worse, make a pinned host look unpinned. The full rules are in
Where Gemini state is stored.
gemini_trust_list(read-only) reports what is pinned, optionally for onehost: fingerprint, port, first/last seen and expiry as ISO-8601 UTC, plus a precomputedexpired— an ended validity window makes a routine reissue the likely explanation for a changed fingerprint.gemini_trust_update(destructive) removes (action: "remove") or replaces (action: "pin") the pin of one namedhost. There is no wildcard.
A fingerprint change is also exactly what an active machine-in-the-middle attack
looks like, and the two are indistinguishable from the client. So a pin is only
ever changed after the user confirms the new certificate is expected — checked
against the operator or another device, never on the say-so of a fetched page. To
enforce that, action: "remove" requires the fingerprint currently pinned
(as reported by gemini_trust_list); a mismatch returns FINGERPRINT_MISMATCH
and changes nothing. On a client that supports MCP elicitation the change is
also put to you before it is made, and declining returns USER_DECLINED with
the pin untouched; a client without that capability is never asked, and behaves
as it always has.
Gemini Client-Identity Tools
A client certificate is the other half of Gemini's certificate story, and the opposite direction: it is the identity this server presents to a capsule, not the one a capsule presents to us. Capsules with accounts ask for it with status 60 (certificate required). The fetch path attaches a certificate that already covers the requested scope but never creates one, so answering a 60 is an explicit call:
gemini_client_cert_list(read-only) reports the scopes that hold an identity — each as a ready-to-use scope URL with its fingerprint, validity window and whether it has expired. Never a private key or its location.gemini_client_cert_update(destructive) creates the identity for the scope of a namedgemini://URL, or removes the one covering it. Like the trust-store tool, it asks first on a client that supports elicitation — creating an identity is a decision about being linkable across visits, and removing one destroys a private key that nothing can recreate.
The certificate covers that URL's path and everything below it, so
gemini://host/app/page.gmi covers one page, gemini://host/app/ the section,
and gemini://host/ the whole capsule. While it exists, every request in that
scope carries it, which is what lets the capsule link those visits — so it is
the user's decision, never a reaction to a page or META string asking for one.
Creation refuses to replace a certificate already covering the scope, because
the private key cannot be recovered, and action: "remove" requires the
fingerprint being destroyed, exactly as the trust tools require the pinned one.
Example URLs to Try
Gopher Protocol
# Classic Gopher menu
gopher://gopher.floodgap.com/1/
# Gopher news and information
gopher://gopher.floodgap.com/1/gopher
# Search example (type 7)
gopher://gopher.floodgap.com/7/v2/vs
# Text file example
gopher://gopher.floodgap.com/0/gopher/welcomeGemini Protocol
# Gemini protocol homepage
gemini://geminiprotocol.net/
# Gemini software directory
gemini://geminiprotocol.net/software/
# Example personal capsule
gemini://skyjake.fi/
# A large, browsable aggregator capsule
gemini://kennedy.gemi.dev/Geminispace has no search engine this tool can drive. Kennedy and tlgs.one are
worth browsing, but both Disallow: /search in their robots.txt, so a search
URL on either comes back BLOCKED_BY_ROBOTS. That is a stop, not a setting to
change: the operators asked automated clients to stay off those paths.
Example AI Interactions
Once configured, you can ask Claude:
Gopher Exploration:
"Browse the main Gopher menu at gopher.floodgap.com"
"Search for 'python' on the Veronica-2 search server"
"Show me the welcome text from Floodgap's Gopher server"
"What's available in the Gopher community directory?"
Gemini Exploration:
"Fetch the Gemini protocol homepage"
"Show me the software directory on geminiprotocol.net"
"Browse the latest posts from a gemlog"
"What's the difference between Gopher and Gemini protocols?"
Development
Task Runner
Every development command is a task in [tool.taskipy.tasks] (pyproject.toml),
which is the single definition of each one — there is no second table to keep in
sync. Run them the same way on every platform:
uv run task dev-setup # install dependencies and pre-commit hooks
uv run task quality # lint + typecheck + test
uv run task ci # what CI runs: check + test-cov
uv run task help # list every task (alias for `task --list`)On Unix and macOS, make <command> is a thin catch-all onto the same table, and
bare make runs help. uv run task help is the authoritative list; the tasks
and the reasoning behind the ones that are not obvious are described in
CONTRIBUTING.md.
Project Structure
gopher-mcp/
├── src/gopher_mcp/ # Main package
│ ├── __init__.py # Package initialization
│ ├── __main__.py # CLI entry point (--transport/--host/--port/--allowed-host)
│ ├── server.py # FastMCP server + the eight MCP tool definitions
│ ├── client_base.py # Shared fetch scaffolding for both clients
│ ├── gopher_client.py # Gopher protocol client
│ ├── gopher_transport.py # Low-level Gopher transport
│ ├── gopher_parse.py # Gopher URL and menu parsing
│ ├── gemini_client.py # Gemini protocol client
│ ├── gemini_tls.py # Gemini TLS connection handling
│ ├── gemini_parse.py # Gemini URL and response parsing
│ ├── gemtext.py # Gemtext document parsing
│ ├── mime.py # MIME type detection and filtering
│ ├── tofu.py # Trust-on-First-Use certificate store
│ ├── client_certs.py # Gemini client certificate storage
│ ├── identity.py # Trust/identity decision and wording helpers
│ ├── ssrf.py # SSRF protection / address filtering
│ ├── ratelimit.py # Per-host rate limiting
│ ├── robots.py # robots.txt fetching and policy gate
│ ├── cache.py # Shared TTL + LRU response cache
│ ├── config.py # Pydantic settings models
│ ├── models.py # Pydantic data models
│ ├── helpers.py # Shared URL/IO/sanitization helpers
│ └── utils.py # Backward-compatible facade re-exporting the above
├── tests/ # Comprehensive test suite
├── docs/ # MkDocs documentation
├── scripts/ # Development scripts
├── config/ # Example configuration (example.env)
├── .github/workflows/ # CI/CD pipelines
├── Dockerfile # Slim, non-root container image
├── Makefile # Unix/macOS shortcut onto the taskipy tasks
├── server.json # MCP registry manifest
└── pyproject.toml # Modern Python project configDevelopment Workflow
Setup:
uv run task dev-setup- Install dependencies and pre-commit hooksCode: Make your changes with full IDE support (type hints, linting)
Quality:
uv run task quality- Run all quality checks (lint + typecheck + test)Test:
uv run task test-cov- Run tests with coverage reportingCommit: Pre-commit hooks ensure code quality automatically
Testing
# Run all tests
uv run task test
# Run with coverage
uv run task test-cov
# Run specific test types
uv run task test-unit
uv run task test-integration
# Run one file
uv run pytest tests/test_server.pyConfiguration
The server can be configured through environment variables for both protocols:
Gopher Configuration
Variable | Description | Default | Example |
| Maximum response size in bytes |
|
|
| Request timeout in seconds |
|
|
| Enable response caching |
|
|
| Cache TTL in seconds; |
|
|
| Max cached entries (LRU) |
|
|
| Allowed hosts (list) | unset (all) |
|
| Allowed ports (list) | unset (any) |
|
| Permit loopback/private hosts |
|
|
| Per-host request cap (0 = off) |
|
|
| Simultaneous fetches (0 = off) |
|
|
| Honour |
|
|
Gemini Configuration
Variable | Description | Default | Example |
| Maximum response size in bytes |
|
|
| Whole-fetch wire-time budget |
|
|
| Enable response caching |
|
|
| Cache TTL in seconds; |
|
|
| Max cached entries (LRU) |
|
|
| Allowed hosts (list) | unset (all) |
|
| Allowed ports (list) | unset (any) |
|
| Permit loopback/private hosts |
|
|
| Enable TOFU certificate validation |
|
|
| Store and attach client certs |
|
|
| Per-host request cap (0 = off) |
|
|
| Simultaneous fetches (0 = off) |
|
|
| Honour |
|
|
SSRF protection: by default both tools reject targets that resolve to loopback, link-local (including cloud metadata
169.254.169.254), or private/RFC1918 addresses. SetGOPHER_ALLOW_LOCAL_HOSTS/GEMINI_ALLOW_LOCAL_HOSTStotrueonly when you deliberately need to reach local hosts (e.g. testing a server on localhost).
Timeouts. *_TIMEOUT_SECONDS is one overall deadline per fetch, not a
per-phase timeout. For Gemini, DNS, connect and TLS handshake, the trust-store
write, send and read all draw down the same budget, and when robots checking is
enabled the /robots.txt probe spends from it too — so a slow host cannot spend
the full value on each step in turn.
List-valued variables. *_ALLOWED_HOSTS, *_ALLOWED_PORTS and
GEMINI_DENIED_MIME_TYPES accept either the comma-separated form (a,b) or a
JSON array (["a", "b"]); whitespace around entries is stripped. Leave one
unset (or empty) to mean "no restriction". A value that is present but names
no entries — " , ", or "$A,$B" where both shell variables are empty — is a
startup error, because an empty allowlist cannot be told apart from an absent
one and would silently drop the restriction you meant to apply. A port outside
1–65535 in an allowlist is a startup error for the same reason: it could
never match, so every fetch would be refused at runtime instead.
Caching. *_CACHE_TTL_SECONDS=0 disables caching rather than storing entries
that expire the instant they are written.
The tables above cover the most common settings. Additional options include
robots policy caching and retry (*_ROBOTS_CACHE_TTL_SECONDS,
*_ROBOTS_HONOR_AI_TOKENS, *_ROBOTS_FAILURE_BACKOFF_SECONDS),
rendered-output limits (*_MAX_RENDERED_CHARS, GOPHER_MAX_MENU_ITEMS), Gemini
TOFU/certificate storage paths and expiry policy (GEMINI_TOFU_STORAGE_PATH,
GEMINI_TOFU_REJECT_EXPIRED, GEMINI_CLIENT_CERTS_STORAGE_PATH), MIME filtering
(GEMINI_DENIED_MIME_TYPES), and server/logging settings under the GOPHER_MCP_
prefix. See the full
Configuration Guide for
every variable, its type, range, and default, or config/example.env for a
ready-to-edit starting point.
Example Configuration
# Gopher settings
export GOPHER_MAX_RESPONSE_SIZE=2097152
export GOPHER_TIMEOUT_SECONDS=60
export GOPHER_CACHE_ENABLED=true
export GOPHER_ALLOWED_HOSTS="gopher.floodgap.com,gopher.quux.org"
# Gemini settings
export GEMINI_MAX_RESPONSE_SIZE=2097152
export GEMINI_TIMEOUT_SECONDS=60
export GEMINI_TOFU_ENABLED=true
export GEMINI_CLIENT_CERTS_ENABLED=true
export GEMINI_ALLOWED_HOSTS="geminiprotocol.net,skyjake.fi"
# Run with custom config
uv run task serveNetwork Etiquette
Gopherspace and Geminispace are served largely by individuals running small machines. This server is built to be a guest there.
What this tool does and does not do
gopher-mcp fetches a resource when someone asks their assistant for it, and
returns the content to that conversation. It does not train on what it
fetches, archive it, rehost it, or make it searchable. It does not follow links
on its own: every URL it retrieves was named by the caller.
Neither protocol has a user-agent field, so nothing identifies this client on
the wire and a server cannot recognise or block it by name. That is a property
of Gopher and Gemini, not a choice made here. What it does do, when robots
checking is enabled below, is honour rules written against the token
gopher-mcp, so an operator who wants to single it out has a way to.
Rate limiting
Both clients space out requests to the same host and cap how many fetches run at
once. Unlike earlier versions, these are on by default: one request per
second per host (*_REQUESTS_PER_MINUTE=60) and five concurrent fetches
(*_MAX_CONCURRENT_REQUESTS=5). Set either to 0 to disable it. A Gemini server
answering 44 SLOW_DOWN is always honoured regardless of these settings.
Robot exclusion (robots.txt)
The server fetches /robots.txt from the host root and honours it before
retrieving anything. This is on by default: these are overwhelmingly
hobbyist-run servers, and ignoring a stated policy is not a reasonable default
for a tool an LLM drives unattended. Policies are cached per host for 24 hours
(*_ROBOTS_CACHE_TTL_SECONDS), so the extra round-trip is paid once per host,
not per fetch.
GOPHER_RESPECT_ROBOTS_TXT=false / GEMINI_RESPECT_ROBOTS_TXT=false turns it
off, but the override is for a host you operate — a blanket Disallow: / on
someone else's server is a decision, not a misconfiguration. The error messages
are written that way too, because they are read by the model, not by you: a
blocked fetch returns BLOCKED_BY_ROBOTS and says to stop and tell the user
rather than retry or try another spelling of the path. A fetch refused because
the policy could not be read at all returns ROBOTS_UNAVAILABLE instead — a
separate code because it is transient and means nothing disallowed you.
Which convention applies depends on the protocol:
Gemini follows the official companion specification, which defines the virtual agents
archiver,indexer,researcherandwebproxy. This server matchesgopher-mcp,webproxy,indexerand*. It does not claimarchiverorresearcher: nothing here retains content, andresearcheris defined for tools that operate without surfacing what they fetch.Gopher follows the convention Veronica-2 documents at
gopher://gopher.floodgap.com/0/v2/help/indexer(written out rather than linked, because agopher://href does not survive PyPI's sanitizer). This server matchesgopher-mcpand*. It does not claimveronica, which belongs to Floodgap's indexer.
Both use the original 1994 robots.txt grammar rather than RFC 9309, so only
#, User-agent: and Disallow: are recognised and every other field,
including Allow:, is ignored. This matters: an RFC 9309 parser would act on
Allow: lines that authors on these networks expect to be dropped, making it
more permissive than intended.
By default the server also honours rules naming AI crawler tokens such as
ClaudeBot, GPTBot and CCBot (*_ROBOTS_HONOR_AI_TOKENS). These are not
part of either protocol's convention, but an operator who wrote one meant "no
LLM tooling", and that is the request being made.
When a policy cannot be retrieved at all, the host is left alone for a short
while before being probed again (*_ROBOTS_FAILURE_BACKOFF_SECONDS, 60s by
default) rather than paying a fresh connect timeout on every request. Set it to
0 to re-probe immediately, or raise it if you routinely fetch from hosts that
are down. A Gemini capsule answering 44 SLOW_DOWN is the exception: it named
its own retry period, so that is used instead.
Two known limitations, both documented rather than papered over:
Gopher fails open. The protocol has no status codes, so a missing selector, an error document and an empty file are indistinguishable on the wire. RFC 9309 §2.3.1.4 would have an unreachable policy deny everything, which would block most of Gopherspace. Instead the parser is lenient: content that yields no
User-agent:group imposes no rules. Gemini, which does have status codes, fails closed and treats51 NOT FOUNDas "no policy". Note that failing closed covers more than a 4x status: a capsule that is unreachable — connection refused, TLS failure, timeout, malformed reply — also has no retrievable policy, so it is refused too — but under the separateROBOTS_UNAVAILABLEcode, since the capsule never disallowed anything. The message names the underlying cause, and turning robots checking off will not make such a capsule reachable.Gopher path rules are best-effort. A Gopher URI carries the item type as the first path character, so
gopher://host/1/archivehas the URI path/1/archivebut the on-wire selector/archive. Rules are tested against both spellings, butDisallow: /is the only form guaranteed to behave the way its author expects.
There is no per-directory or per-user robots.txt. Neither protocol convention
nor RFC 9309 §2.3 defines one; on shared hosts the established pattern is a
single file at the root using path prefixes.
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Quick Contribution Steps
Fork the repository on GitHub
Clone your fork:
git clone https://github.com/your-username/gopher-mcp.gitSetup development environment:
uv run task dev-setupCreate a feature branch:
git checkout -b feature/amazing-featureMake your changes with tests
Quality check:
uv run task qualityCommit your changes:
git commit -m 'Add amazing feature'Push to your fork:
git push origin feature/amazing-featureSubmit a pull request with a clear description
Development Standards
Type hints for all functions and methods
Comprehensive tests (CI enforces a minimum of 95% coverage)
Documentation for all public APIs
Security considerations for all network operations
Cross-platform compatibility (Windows, macOS, Linux)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Model Context Protocol by Anthropic - The foundation that makes this integration possible
MCP Python SDK - Its bundled
FastMCP(mcp.server.fastmcp) is what this server is built on, pinned tomcp>=1.28.1,<2The Gopher Protocol Community - Keeping the spirit of the early internet alive
Related Projects
Model Context Protocol Servers - Official MCP server implementations
Awesome MCP Servers - Curated list of MCP servers
Claude Desktop - AI assistant that supports MCP
Support
Bug Reports: GitHub Issues
Feature Requests: Open a feature request
Questions: Ask a question
Documentation: Project Docs
Community: MCP Discord
Whichever you open, include the version: gopher-mcp --version reports it and
works for the uvx and Docker installs, where there is no checkout to import
the package from.
Made with ❤️ by Cameron Rye
Star this project if you find it useful!
Available Tools
4 toolsgemini_batch_fetchFetch multiple Gemini resourcesARead-only
Fetch multiple Gemini URLs in parallel for improved performance.
Uses asyncio.gather() to fetch all URLs concurrently, which is much faster than fetching them sequentially. Useful for fetching multiple pages or related resources at once.
Args: urls: List of Gemini URLs to fetch (at most 50 per call)
Returns: List of responses in the same order and of the same length as the input URLs, so callers can zip responses to requests by index.
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already provide readOnlyHint and openWorldHint. Description adds valuable behavioral details: uses asyncio.gather for concurrency, returns results in same order, and caps at 50 URLs. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is concise, using docstring structure with Args and Returns sections. Every sentence adds value, no redundancy. Key info is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema existence, description covers input behavior (parallel, limit), return structure (list same order), and use case. No notable gaps; sibling tools provide additional context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 0% description coverage. Description provides crucial parameter semantics: 'List of Gemini URLs to fetch (at most 50 per call)', adding meaning beyond type and array items schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states 'Fetch multiple Gemini URLs in parallel for improved performance', clearly identifying action (fetch), resource (Gemini URLs), and key differentiator (multiple, parallel). This distinguishes from sibling gemini_fetch (single) and gopher siblings (different protocol).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description explains use case (multiple URLs, parallel speed improvement), includes constraint (at most 50), and implies sequential alternative. However, it lacks explicit 'when not to use' or direct reference to alternative sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gemini_fetchFetch Gemini resourceARead-only
Fetch Gemini content by URL.
Supports the Gemini protocol with TLS, TOFU certificate validation, client certificates, and gemtext parsing. Returns structured JSON responses optimized for LLM consumption.
Args: url: Full Gemini URL to fetch (e.g., gemini://gemini.circumlunar.space/) input: Optional answer to a status-10/11 input prompt; it is percent-encoded and sent as the query string.
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | A full gemini:// URL, e.g. gemini://geminiprotocol.net/ . On a status-10/11 input response, call again with the `input` argument set to the user's answer instead of hand-building a query string. | |
| input | No | Optional answer to a Gemini status-10/11 input prompt. It is percent-encoded and sent as the query string, so pass the raw answer (spaces, &, = and unicode are handled for you). Replaces any query already present in `url`. |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description provides rich behavioral context beyond annotations: protocol details, TLS handling, TOFU validation, gemtext parsing, input handling, and LLM-optimized output. Annotations declare readOnlyHint and openWorldHint, which align with a read-only fetch operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured with a clear topic sentence, protocol details, and parameter explanations. It uses a succinct bullet-like format (with 'Args:') and no redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has an output schema, so return value explanation is unnecessary. The description covers all essential aspects: protocol, authentication, input handling, and output format. It is fully sufficient for correct usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful detail to both parameters: url usage is clarified with protocol context, and input is explained with percent-encoding and query replacement. Schema coverage is 100%, but the description enhances understanding beyond the schema comments.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool fetches Gemini content by URL, specifying protocol support (TLS, TOFU, client certificates, gemtext parsing) and structured JSON output. It distinguishes itself from sibling tools like gemini_batch_fetch and gopher_fetch by focusing on single resource fetches.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains typical usage, including handling of input prompts via the 'input' parameter. While it doesn't explicitly list when not to use it versus siblings, the protocol and single-resource nature make the usage context clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gopher_batch_fetchFetch multiple Gopher resourcesARead-only
Fetch multiple Gopher URLs in parallel for improved performance.
Uses asyncio.gather() to fetch all URLs concurrently, which is much faster than fetching them sequentially. Useful for fetching multiple menu items or related resources at once.
Args: urls: List of Gopher URLs to fetch (at most 50 per call)
Returns: List of responses in the same order and of the same length as the input URLs, so callers can zip responses to requests by index.
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true. The description adds the behavioral detail that it uses asyncio.gather() for concurrent fetching, enhancing transparency beyond annotations. No contradiction.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with no filler. It front-loads the main purpose, then provides context and parameter/return details in a structured manner.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has an output schema, the description suffices by explaining the return order and length, and specifying a limit of 50 URLs. It covers all needed context for an agent to use the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description clearly explains the 'urls' parameter as 'List of Gopher URLs to fetch (at most 50 per call)' and describes return order and length, adding significant meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states 'Fetch multiple Gopher URLs in parallel' with a specific verb and resource. It distinguishes from sibling 'gopher_fetch' which fetches a single URL, and from 'gemini_batch_fetch' which is for Gemini protocol.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description says 'Useful for fetching multiple menu items or related resources at once', providing clear context. It implies not for single fetches but does not explicitly state when not to use or name alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
gopher_fetchFetch Gopher resourceARead-only
Fetch Gopher menus or text by URL.
Supports all standard Gopher item types including menus (type 1), text files (type 0), search servers (type 7), and binary files. Returns structured JSON responses optimized for LLM consumption.
Args: url: Full Gopher URL to fetch (e.g., gopher://gopher.floodgap.com/1/)
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | A full gopher:// URL. The first path character is the item type (1=menu, 0=text file, 7=search). Follow `next_url` from menu items to navigate. Example: gopher://gopher.floodgap.com/1/ |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations declare readOnlyHint and openWorldHint. Description adds value by specifying 'Returns structured JSON responses optimized for LLM consumption' and explaining how to use next_url for navigation, which is beyond annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is concise with two short paragraphs, structured logically with Args section. No unnecessary information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With simple input schema (1 param), rich annotations, and output schema present, description covers essential aspects like navigation via next_url. Complete for the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, providing detailed parameter description and examples. Tool description reinforces supported types but does not significantly add meaning beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The tool name and title clearly indicate fetching a Gopher resource. Description states 'Fetch Gopher menus or text by URL' and lists supported item types, providing specific verb and resource.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description mentions supported item types but does not differentiate from sibling tools (gemini_fetch, gopher_batch_fetch) or provide explicit when-to-use/alternatives guidance. Adequate but lacks exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v0.4.2- Changed
gemini_fetch7 fields changed- added
Input schema / properties / inputAdded value: +{ + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional answer to a Gemini status-10/11 input prompt. It is percent-encoded and sent as the query string, so pass the raw answer (spaces, &, = and unicode are handled for you). Replaces any query already present in `url`.", + "title": "Input" +} - added
Input schema / properties / url / descriptionAdded value: +"A full gemini:// URL, e.g. gemini://geminiprotocol.net/ . On a status-10/11 input response, call again with the `input` argument set to the user's answer instead of hand-building a query string." - added
Input schema / properties / url / examplesAdded value: +[ + "gemini://geminiprotocol.net/", + "gemini://kennedy.gemi.dev/" +] - added
Output schema / additionalPropertiesAdded value: +true - removed
Output schema / propertiesRemoved value: -{ - "result": { - "additionalProperties": true, - "title": "Result", - "type": "object" - } -} - removed
Output schema / requiredRemoved value: -[ - "result" -] - changed
Output schema / titlePrevious value: -"gemini_fetchOutput"New value: +"gemini_fetchDictOutput"
- Changed
gopher_fetch6 fields changed- added
Input schema / properties / url / descriptionAdded value: +"A full gopher:// URL. The first path character is the item type (1=menu, 0=text file, 7=search). Follow `next_url` from menu items to navigate. Example: gopher://gopher.floodgap.com/1/" - added
Input schema / properties / url / examplesAdded value: +[ + "gopher://gopher.floodgap.com/1/", + "gopher://gopher.floodgap.com/0/gopher/proxy", + "gopher://gopher.floodgap.com/7/v2/vs" +] - added
Output schema / additionalPropertiesAdded value: +true - removed
Output schema / propertiesRemoved value: -{ - "result": { - "additionalProperties": true, - "title": "Result", - "type": "object" - } -} - removed
Output schema / requiredRemoved value: -[ - "result" -] - changed
Output schema / titlePrevious value: -"gopher_fetchOutput"New value: +"gopher_fetchDictOutput"
4 tool updates
v0.2.2- First observed
gemini_batch_fetch - First observed
gemini_fetch - First observed
gopher_batch_fetch - First observed
gopher_fetch
TDQS
Each tool is clearly distinct by protocol (Gemini vs Gopher) and operation (single fetch vs batch fetch), with no overlap.
All tools follow a consistent pattern: [protocol]_[operation] using snake_case, making them predictable and easy to understand.
Four tools is exactly right for this specialized server, covering both protocols and both single and batch operations without unnecessary bloat.
The tool set fully covers the domain of fetching content from Gemini and Gopher, including single and batch retrieval, with no obvious gaps.
Maintenance
Related MCP Connectors
Prompt-injection scanning and safe webpage fetching for AI agents reading untrusted content.
The web capability layer for AI agents: render, extract, DNS, SSL, WHOIS & more via x402.
Fetch any URL as clean Markdown or metadata, and buy digital goods via x402 — for AI agents.
Scrape, crawl and search the web for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables web browsing capabilities for locally served LLMs through URL text fetching, link extraction, and web search using Brave and DuckDuckGo engines. Designed to enhance LLMs with real-time web access through the MCP protocol.MIT
- AlicenseNot gradedqualityDmaintenanceEnables secure access to Tor/onion services with content filtering and safety guardrails for AI assistants.6MIT
- AlicenseAqualityBmaintenanceMCP server for AI-powered research using Gemini. Provides fast grounded web search, deep autonomous research, URL extraction, and session management.69MIT
- AlicenseNot gradedqualityDmaintenanceIntegrates Google's Gemini API with MCP-compatible clients for chat, real-time web search, knowledge queries, code/text analysis, and content generation.70MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cameronrye/gopher-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server