Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/datatorag/mcp-gateway/codebase-mapnpx skills add datatorag/mcp-gateway --skill codebase-mapgit clone --depth 1 https://github.com/datatorag/mcp-gatewayWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00061 | $0.11304 |
| Opus 5 | $0.00030 | $0.05652 |
| Sonnet 5 | $0.00012 | $0.02261 |
| Haiku 4.5 | $0.00006 | $0.01130 |
Grade A, and why
codebase-map scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
| `execFileSync` (never `execSync`) for git clone / installs | Prevents shell injection via malicious `githubRepoUrl` | commit `70cc29a` | How it starts
The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Codebase Map
Architecture reference for the datatorag-mcp monorepo. Read this instead of re-exploring source. This repo is public — no live infrastructure values here; operational details (hosts, profiles, DB project ids) live in private memory (reference_* entries) and the deploy / db-query skills.
Monorepo layout
pnpm workspace (pnpm-workspace.yaml: apps/* + packages/*), turbo topological builds (turbo.json: build depends on ^build). All packages are private ESM built with tsup.
| Package | Role | Internal deps |
|---|---|---|
apps/gateway |
The whole product: Express + Next.js server — MCP gateway, OAuth server, marketing site, dashboard, cron jobs | auth, config, db, types |
packages/db |
Drizzle schema (15 tables, one file per table under src/schema/) + createDb() (prepare: false for Neon's pooled endpoint); dual exports . and ./schema |
none |
packages/config |
Single zod env schema; getEnv() memoized, process.exit(1) on invalid. DATABASE_URL is the only var without a default |
none |
packages/auth |
hashApiKey, safeStringEqual (constant-time SHA-256 compare), ApiKeyValidator (LRU-cached). Consumed only by the OAuth routes |
db |
packages/types |
zod status enums + McpGatewayManifest (the datatorag.json plugin manifest shape) |
none |
(packages/docker-manager used to exist as dead code from the abandoned container-per-plugin design — it was deleted; see decisions.)
Gateway request flow
MCP client
│ POST /mcp (Authorization: Bearer <OAuth access token>)
▼
apps/gateway/server.ts validateBearer → oauthAccessTokens (not revoked/expired)
│ sessions: in-memory Map keyed by mcp-session-id
│ (wiped on every deploy — an unknown session id gets a
│ spec-compliant 404 via classifyMcpRequest (mcp-session.ts),
│ and clients silently re-initialize on the same bearer; SCRUM-23)
▼ new session → createMcpServer(userId, db, pool)
apps/gateway/src/gateway/mcp-server.ts
│ ListTools: enabled tools ⋈ active mcpServers, filtered to the user's
│ connected services ("lazy tool loading"); injects `account` param
│ CallTool: split tool name on "__" → serverSlug / toolName
▼
├─ service-mapped plugin → getServiceToken() → ONE-SHOT client,
│ token in X-User-Token header (never pooled)
└─ generic plugin → ConnectionPool (per-server, max 5, 5min idle,
5s acquire timeout, wait-queue)
▼ Streamable HTTP → http://<host>:<containerPort>/mcp
plugin child process spawn("node", entrypoint), ports 40000+
managed by src/gateway/plugin-manager.ts
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 223 lines · 61 tokens per session scan A add2188beef0
codebase-map is a skill published in the GitHub repository datatorag/mcp-gateway (3 stars, last pushed yesterday), licensed MIT. It adds 61 tokens to every session and 11,304 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
babysit-pr
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…