xkcdai
The server provides the find_xkcd tool, which semantically searches the xkcd comic database to find relevant comics based on a conversation topic. You can:
Search for relevant xkcd comics by providing a natural-language phrase or sentence describing the topic; the tool returns ranked matches with scores and metadata.
Get comic details for each result: number, title, score, URL, image URL, alt (mouseover) text, and explanation URL.
Control relevance threshold via
min_score(default 0.62) to tune strictness — lower for looser matches, higher for stricter ones.Limit result count with
max_results(default 3) to control how many candidates are returned.Interpret match quality using score bands: ≥0.75 is strong, 0.66–0.75 plausible, <0.66 weak/tangential.
Receive empty results when no comic clears the relevance floor, avoiding tenuous matches.
Integrate with MCP clients: Works with any Model Context Protocol (MCP) host — via stdio locally or HTTP at the deployed endpoint. Deploy as a custom connector for Claude.ai, Claude Desktop, or Claude Code.
Enable proactive suggestions: By adding a persistent instruction, Claude can automatically call
find_xkcdduring conversations and decide whether to share a comic based on score bands.Access read-only and publicly: No authentication required; ideal for casual, non-sensitive use.
Health monitoring:
GET /healthzreturns liveness and index load status.Maintain an up-to-date index: The server builds and maintains a local index of xkcd comics, including transcripts and explanations, with incremental updates.
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., "@xkcdaispent two hours writing a script to rename files automatically"
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.
xkcdai
An MCP server that surfaces the right xkcd comic during a conversation, if one is relevant.
Live connector:
https://xkcdai.onrender.com/mcp— add it in claude.ai → Settings → Connectors. See Use the deployed MCP server.
It builds a semantic index over every xkcd comic (title + mouseover text +
transcript) using on-device embeddings, then exposes a single find_xkcd tool.
A Claude conversation can call it whenever the topic feels xkcd-shaped; a
relevance threshold means weak matches return nothing, so it stays quiet instead
of forcing a tenuous reference.
The fetched transcripts, explanations, and the embeddings are currently committed in this repo, under data/.
How it works
xkcd JSON API ─┐
├─► comics.json + explain.json ─► embeddings.npy ─► find_xkcd ─► Claude
explainxkcd ──┘ (cache) (bge-small) (cosine) (mentions it
(transcripts + if it fits)
explanations)Data: title + mouseover alt from the official API, plus the community transcript and explanation from explainxkcd.com. The explainxkcd context is essential: the official API dropped transcripts around comic ~1675, so without it the most-shared modern comics (e.g. #2347 Dependency) are unmatchable — their joke text lives only inside the image.
Embeddings:
fastembed(ONNX) withBAAI/bge-small-en-v1.5— local, free, offline after first download, no PyTorch. Swap the model insrc/xkcdai/embed.py(e.g.BAAI/bge-base-en-v1.5for marginally better ranking at ~3× the size).Search: a normalized numpy matrix + dot product. No vector DB needed for a few thousand comics.
Restraint: because xkcd has a comic for almost everything, a similarity cutoff alone can't judge relevance.
min_score(default0.62) is just a coarse floor; the real "should I bring this up?" decision is made by the calling model, guided by the score bands documented on thefind_xkcdtool.
Related MCP server: context-hub-mcp
Use the deployed MCP server (as custom connector)
The server is deployed at https://xkcdai.onrender.com on Render. Add it as a Claude custom connector to use it in the Claude web and mobile apps (note: the Free plan only allows one custom connector). Anyone can add the same URL in their own account.
In claude.ai (web — do this once; it then syncs to the mobile app):
Settings → Connectors → Add custom connector.
Paste the connector URL, including the
/mcppath:https://xkcdai.onrender.com/mcpLeave OAuth blank (this server needs no auth) and click Add.
The connector's
find_xkcdtool is now available in chats, on desktop and phone. For Claude to suggest comics on its own, also add the instruction from Make Claude suggest comics proactively to your Profile preferences.
Notes
The server is public and unauthenticated — fine here (read-only comic search, no secrets). Don't reuse this pattern for anything sensitive without OAuth.
Hosted from this repo via the Dockerfile and render.yaml; pushes to
mainauto-redeploy.GET /healthzreports liveness, whether the index is loaded, and current RSS — handy on a 512 MB instance:curl https://xkcdai.onrender.com/healthz
Local setup
python -m venv .venv
# Windows (PowerShell): .venv\Scripts\Activate.ps1
# macOS/Linux: source .venv/bin/activate
pip install -e .
# Fetch comics + their explainxkcd context, then embed (downloads the model once).
# First run ~10 min; re-running later only fetches what's new.
xkcdai buildAdd --no-enrich to skip the explainxkcd fetch (faster/offline, weaker matches).
Test it from the command line:
xkcdai search "my code finally compiled after an hour"
xkcdai search "arguing about the correct date format"
xkcdai search "spent more time automating it than doing it by hand"Use locally as an MCP server
The server runs over stdio. Point your MCP host at it.
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"xkcdai": {
"command": "C:\\your\\path\\to\\xkcdai\\.venv\\Scripts\\xkcdai-server.exe",
"env": { "XKCDAI_DATA_DIR": "C:\\your\\path\\to\\xkcdai\\data" }
}
}
}Claude Code (-s user makes it available in every project, not just this folder):
claude mcp add xkcdai -s user -e XKCDAI_DATA_DIR=C:\your\path\to\xkcdai\data -- C:\your\path\to\xkcdai\.venv\Scripts\xkcdai-server.exeAlways set XKCDAI_DATA_DIR, since the host launches the server from an arbitrary
working directory.
MCP only gives Claude the ability to call
find_xkcd— it won't volunteer comics on its own. See Make Claude suggest comics proactively.
Make Claude suggest comics proactively
Connecting the server only gives Claude the ability to call find_xkcd; it
won't reach for it unprompted. To make Claude volunteer comics, paste the
instruction below wherever that Claude reads persistent instructions:
Claude Code — your global
~/.claude/CLAUDE.md(applies everywhere) or a per-repoCLAUDE.md; restart the session to load changes.Claude.ai / Claude Desktop — Settings → Profile → "What personal preferences should Claude consider in responses?" (every plan, including free; syncs to the mobile app). Each person who uses the connector adds it in their own account.
When a conversation naturally lands on a topic xkcd is known for — programming,
science, math, statistics, engineering, the absurdity of standards, relationships,
everyday life — call the find_xkcd tool (xkcdai) with a short phrase describing the
topic. Then judge whether to bring it up:
- score >= 0.75 — strong match; mention it if it fits the moment
- 0.66-0.75 — only if it genuinely lands
- below that — stay silent
When you share one, give just that single comic: its number and title, its URL, and
quote the alt (mouseover) text — that's half the joke. At most one comic per topic,
and never force a tangential reference. When in doubt, say nothing.It's still Claude's judgment, so it won't fire on every borderline topic — asking "is there an xkcd for this?" always triggers a lookup.
Not just Claude — works with any MCP client
The examples above use Claude, but find_xkcd is a standard
Model Context Protocol tool, so any MCP-capable
host can use it. Point the client at either transport:
stdio: run
xkcdai-serverlocally (see Use locally as an MCP server), orHTTP: the deployed URL
https://xkcdai.onrender.com/mcp.
The server is LLM-agnostic internally, too: matching runs on a local embedding model.
Only the host-specific bits differ — how you register the server, and where you put
the "suggest a comic when it fits" instruction (each client has its own
system-prompt / rules mechanism, e.g. Cursor Rules or a VS Code .instructions file).
Configuration
XKCDAI_DATA_DIR— wherecomics.json,explain.json,embeddings.npy, andindex.jsonlive.find_xkcd(context, max_results=3, min_score=0.62)— lowermin_scorefor more (looser) suggestions, raise it to be stricter.
Maintenance
Re-run xkcdai build periodically to pick up new comics — it incrementally fetches
new comics and their explainxkcd context, then re-embeds:
xkcdai buildUse --force to rebuild everything from scratch, or --no-enrich to skip the
explainxkcd fetch. xkcdai enrich fetches only the explainxkcd context.
Credits & licensing
This project bundles content from two sources, each under its own license, so the code and the data are licensed separately:
Code (
src/,Dockerfile, etc.) — MIT.Comics & mouseover text — © Randall Munroe / xkcd, licensed CC BY-NC 2.5: non-commercial, with attribution.
Transcripts & explanations (cached in data/) — from explainxkcd.com, licensed CC BY-SA 3.0: redistributed here under the same license, with attribution.
Because data/ mixes xkcd's NonCommercial content with explainxkcd's ShareAlike
content, treat the data as non-commercial and keep any redistribution under
these terms. The MIT license covers the source code only — not data/. At
runtime, find_xkcd results link back to both xkcd and explainxkcd for per-item
attribution.
This is an unofficial fan project, not affiliated with or endorsed by xkcd or explainxkcd.
Available Tools
1 toolfind_xkcdAInspect
Find xkcd comics semantically relevant to the current conversation.
Call this whenever an xkcd comic might enrich the conversation — when the discussion lands on a topic xkcd is famous for skewering (programming, science, statistics, relationships, the absurdity of standards, etc.).
Pass a concise description of the current topic or theme as context (a phrase
or sentence works better than a whole transcript), e.g. "spending hours
automating a task that was faster to do by hand" or "code finally compiling".
IMPORTANT — deciding whether to mention one. xkcd has a comic for almost every
topic, so this tool will nearly always return something. A result being
returned does NOT mean you should bring it up. Use the score as a signal and
apply your own judgment about conversational fit:
score >= 0.75 strong match — usually worth mentioning if it fits the moment
0.66 - 0.75 plausible — mention only if it genuinely lands
< 0.66 weak/tangential — almost always better to stay silent
Only one comic, at most, per topic — and only when it actually adds something.
When in doubt, say nothing; a forced reference is worse than none.
When you do share one, cite it by number and title with its url, and quote
the alt (mouseover) text — it's half the joke.
Returns a dict with a results list (num, title, score, url, image, alt,
explain_url) and a count. An empty list means nothing cleared the floor.
| Name | Required | Description | Default |
|---|---|---|---|
| context | Yes | ||
| min_score | No | ||
| max_results | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses that the tool nearly always returns something, explains the return format (dict with results list and count), and describes the score field and citation conventions. This fully exposes behavioral traits.
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 lengthy but well-structured, with purpose first, then usage, caution, and output details. Each sentence adds value; however, some redundancy could be trimmed. It remains clear and organized.
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 no output schema, the description fully explains return values and fields. It covers when to call, how to use parameters, interpretation of results, and how to cite. It is complete for the tool's moderate 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 0%, but the description adds significant meaning for the 'context' parameter with examples and guidance. For 'min_score', it provides score thresholds that relate to the default, but 'max_results' is not explicitly explained. Overall, the description compensates well for the lack of schema descriptions, though not exhaustively.
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 finds xkcd comics semantically relevant to the conversation. The verb 'find' and resource 'xkcd comics' are specific, and the context of 'current conversation' is unambiguous. No sibling tools exist, so differentiation is not required.
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 provides explicit when-to-use guidance: 'Call this whenever an xkcd comic might enrich the conversation — when the discussion lands on a topic xkcd is famous for skewering.' It also includes when-not-to-use: 'A result being returned does NOT mean you should bring it up,' and gives scoring thresholds for decision-making.
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.
1 tool update
v0.1.0- First observed
find_xkcd
TDQS
Only one tool exists, so there is no risk of confusion between tools. The tool's purpose is clearly defined and singular.
With a single tool, naming consistency is automatically satisfied. The name 'find_xkcd' follows a clear verb_noun pattern.
The server has a focused purpose—retrieving relevant xkcd comics—and a single tool is appropriate for that scope. While 1 tool is minimal, it is not trivial; it earns its place.
The tool fully covers its intended domain: finding semantically relevant xkcd comics for conversation enrichment. There are no obvious gaps given its stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server that provides congressional transcripts
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for RiverScript, an AI transcription platform - fetches transcripts shared via a link.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server to fetch xkcd comics (latest, random, by number, search) and display them with rich in-chat previews via the official JSON API and explainxkcd semantic search.62MIT
- AlicenseNot gradedqualityDmaintenanceA local-first MCP server that turns a .context/ folder of markdown files into a searchable knowledge layer for AI coding agents.122MIT
- FlicenseNot gradedqualityDmaintenanceA semantic search MCP server for YouTube transcripts using OpenAI embeddings and ChromaDB, enabling natural language queries to find conceptually similar content beyond keyword matching.-
- FlicenseNot gradedqualityCmaintenanceAn MCP server that recreates Microsoft Comic Chat (1996) to generate comic strips from conversation summaries, using original character art and deterministic layout, with no LLM calls.-
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/papjuli/xkcdai'
If you have feedback or need assistance with the MCP directory API, please join our Discord server