Complexity Source MCP
OfficialAllows reading a single file from a GitHub repository at a specific ref, enabling AI agents to access verified source code or documentation from GitHub repositories.
Click on "Deploy 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., "@Complexity Source MCP search the fantasy catalog for 'Dragon of the Northern Peaks'"
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.
title: Complexity Source MCP emoji: 📚 colorFrom: indigo colorTo: purple sdk: docker app_port: 7860 pinned: false short_description: Read-only sources and fantasy entity cards for AI systems.
Complexity Source MCP
Read-only Model Context Protocol server that gives an AI access to verifiable sources and a managed fantasy knowledge catalog instead of asking it to fill missing facts from memory.
The server is built with the official
@modelcontextprotocol/sdk
and exposes ten tools:
read_web_source— public HTML, JSON, XML, and text sources;read_github_source— one GitHub repository file at an explicit ref;read_local_source— one UTF-8 file inside an allowed root;search_local_sources— bounded filename and content search;read_image_source— PNG, JPEG, GIF, or WebP for vision-capable clients;list_source_policy— active roots, limits, and provenance policy.search_fantasy_catalog— search canonical fantasy entity cards;get_fantasy_entity— read one card and its direct relations;trace_fantasy_relations— traverse a bounded entity relation graph;fantasy_catalog_status— aggregate catalog readiness and counts.
Every retrieved source carries its canonical URI, retrieval timestamp, and SHA-256 fingerprint. Text is paginated instead of silently discarded.
Related MCP server: CodeAudit MCP
Fantasy catalog
The included Aethoria seed is an original, internally consistent fantasy dataset. It contains structured cards for worlds, locations, factions, characters, creatures, artifacts, quests, and events. Relations between cards let an agent answer questions that require several facts without inventing missing lore.
MongoDB is the storage layer. Configure an administrative environment and seed the catalog once:
cp .env.example .env
# Set MONGODB_URI in .env.
npm run seed:fantasyThe Docker image seeds these cards idempotently at startup when MONGODB_URI
is configured. The HTTP/MCP surface exposes only read-only catalog tools.
There is deliberately no public ingestion tool: visitors cannot add or modify
cards.
Security boundary
All MCP tools are annotated read-only.
Local paths are restricted to
SOURCE_ROOTS; symbolic-link escapes fail.Loopback, link-local, private network, and cloud metadata URLs are blocked.
SOURCE_ALLOWED_HOSTScan restrict web access to an explicit hostname list.Credential-like files (
.env, private keys, package credentials) are refused.Downloads are limited to 8 MiB and text calls to 50,000 characters.
No tool can create, edit, move, or delete content.
MongoDB credentials stay server-side and are never returned by MCP tools.
This server provides source material. It does not guarantee that the connected model will interpret the material correctly, so the UI should retain and show the returned provenance beside generated answers.
Install and run
git clone https://github.com/Complexity-ML/complexity-source-mcp.git
cd complexity-source-mcp
npm install
SOURCE_ROOTS=/absolute/path/to/your/sources npm startnpm start uses MCP over stdio, which is the normal transport for a local AI
client. An optional loopback HTTP transport is available for local development:
SOURCE_ROOTS=/Users/boris/Dev npm run start:httpIt listens on http://127.0.0.1:8790/mcp. Set PORT or HOST to override the
listener.
Hugging Face Space
The repository is directly deployable as a Hugging Face Docker Space. The
container listens on port 7860 and exposes:
GET /— readiness and server metadata;POST /mcp— MCP Streamable HTTP requests.
The hosted container deliberately restricts local-file tools to the empty
public-sources directory. Web and GitHub source tools remain available, and
private-network URLs remain blocked.
After deployment, configure AI LAB with:
SOURCE_MCP_URL=https://YOUR-SPACE.hf.space/mcpFree Spaces can sleep while idle. AI LAB therefore treats source grounding as
an optional service and reports its live connection state in the Agent panel.
Configure MONGODB_URI as a Space secret and MONGODB_DATABASE as a variable
before seeding. If the Space is private, also configure SOURCE_MCP_TOKEN as a
secret in the website deployment; AI LAB sends it as a Bearer token.
MCP client configuration
{
"mcpServers": {
"complexity-sources": {
"command": "node",
"args": [
"/absolute/path/to/complexity-source-mcp/src/cli.js"
],
"env": {
"SOURCE_ROOTS": "/absolute/path/to/your/sources"
}
}
}
}Multiple source roots use the operating-system path separator (: on macOS and
Linux). For example:
SOURCE_ROOTS="/path/to/papers:/path/to/code"Optional environment variables:
GITHUB_TOKEN— read private GitHub sources using the token's own scopes;SOURCE_ALLOWED_HOSTS— comma-separated web host allowlist;PORTandHOST— HTTP development transport only.MONGODB_URI— server-side MongoDB connection string;MONGODB_DATABASE— catalog database name (defaults tocomplexity_fantasy).
Never commit a GitHub token. Prefer a fine-grained, read-only token limited to the repositories the AI is allowed to inspect.
Verify
npm test
npm run smokeThe smoke test connects an official MCP client to the server through the official in-memory transport, lists the tools, and calls the policy tool.
Available Tools
10 toolsfantasy_catalog_statusCheck fantasy catalog statusARead-onlyIdempotent
Returns only aggregate readiness and entity counts for the managed fantasy catalog.
Inputs: no named parameters.
get_fantasy_entityRead one fantasy entity cardBRead-onlyIdempotent
Reads one canonical fantasy entity card and its directly related cards by stable key.
Inputs: key (required).
list_source_policyList source policyARead-onlyIdempotent
Lists the configured read-only roots, host allowlist, source limits, and provenance guarantees.
Inputs: no named parameters.
read_github_sourceRead a GitHub source fileBRead-onlyIdempotent
Reads one file from a GitHub repository using the GitHub contents API. GITHUB_TOKEN is optional for public repositories and required for private ones.
Inputs: path (required), repo (required), owner (required), ref, +2 more.
read_image_sourceRead an image sourceARead-onlyIdempotent
Returns a PNG, JPEG, GIF, or WebP image from an allowed local path or public URL, together with verifiable provenance. The connected AI must itself support image content to interpret it.
Inputs: source (required).
read_local_sourceRead an allowed local sourceARead-onlyIdempotent
Reads one UTF-8 text file located inside SOURCE_ROOTS and returns canonical provenance. Symbolic-link escapes are rejected.
Inputs: path (required), offset, maxChars.
read_web_sourceRead a public web sourceARead-onlyIdempotent
Reads a public HTTP(S) page as text and returns its URL, retrieval time, SHA-256 fingerprint, and a bounded excerpt. Private network addresses are blocked.
Inputs: url (required), offset, maxChars.
search_fantasy_catalogSearch the fantasy catalogARead-onlyIdempotent
Searches canonical fantasy entity cards stored in the managed catalog. Results include facts, relations, and provenance and never modify the catalog.
Inputs: query (required), kinds, maxResults.
search_local_sourcesSearch allowed local sourcesARead-onlyIdempotent
Searches filenames and bounded UTF-8 files inside SOURCE_ROOTS. Build outputs, dependency folders, and Git metadata are skipped.
Inputs: query (required), root, maxFiles, maxResults.
trace_fantasy_relationsTrace fantasy relationsARead-onlyIdempotent
Traverses a bounded relation graph around one canonical fantasy entity card for multi-entity reasoning.
Inputs: key (required), maxDepth.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Every tool serves a clearly distinct purpose. Source tools are separated by source type (web, GitHub, local, image, policy), and fantasy tools are distinct in their operations (search, get, trace, status). No overlap.
All tool names follow a consistent verb_noun pattern (read_*, search_*, list_*, get_*, trace_*, *status). The naming is predictable and clear.
Ten tools is an appropriate number for a server covering two well-defined domains (source reading and fantasy catalog). Each tool earns its place without being excessive or insufficient.
The tool surface is complete for its intended read-only scope. Source reading covers all major source types with policy listing, and the fantasy catalog covers search, retrieval, relation tracing, and status. No obvious gaps given the stated purpose.
Maintenance
Related MCP Connectors
Read-only, no-auth MCP server over Human x AI's Content Hub and confirmed 2027 facts.
AI memory governance & hallucination-blocking MCP server with verifiable knowledge cells.
- ORANO MCP ServerDeprecatedio.github.infotik
Read-only MCP server exposing a user ORANO library to their own AI agent.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSecure multi-source MCP server for reading local, GitHub, GitLab, Bitbucket, and network source code with read-only-by-default access, enabling AI assistants to inspect repositories safely.2MIT
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for AI coding agents to inspect repositories, audit code quality, route engineering skills, and plan safe issue/PR workflows.1MIT
- AlicenseAqualityDmaintenanceRead-only MCP server exposing a W3C PROV knowledge graph of verified facts with provenance, enabling AI agents to list, search, and check facts while enforcing that writes remain CLI-only.5MIT
- FlicenseAqualityCmaintenanceA read-only MCP server that enables AI clients to search a knowledge base and retrieve complete source documents via narrow search and fetch tools.2-