cortex-gateway AGENTS.md

cortex-gateway AGENTS.md is an instructions file for Codex, OpenCode from wellknownmcp/cortex-gateway. It costs 1,061 tokens per session, scanned A, original, MIT.

Project instructions for Cortex Gateway, a self-hosted server that places one protected MCP endpoint in front of multiple backend servers. OAuth 2.1 is a standard way to authenticate users and grant limited access.

In plain words
What is it for?
Use them when developing, testing, or evaluating the gateway and its authorization server.
Why use it?
They explain how user permissions, authentication, transports, and verification checks work in the gateway.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/wellknownmcp/cortex-gateway/agents-md
Clone the repo
git clone --depth 1 https://github.com/wellknownmcp/cortex-gateway

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cortex-gateway AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/wellknownmcp/cortex-gateway/agents-md.svg)](https://agentmods.dev/instructions/wellknownmcp/cortex-gateway/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/wellknownmcp/cortex-gateway/agents-md"><img src="https://agentmods.dev/badge/instructions/wellknownmcp/cortex-gateway/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,061 This file is loaded in full into every session.
When invoked 1,061 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5 $0.01061 $0.01061
Opus 5 $0.00531 $0.00531
Sonnet 5 $0.00212 $0.00212
Haiku 4.5 $0.00106 $0.00106

Measured 4d ago against content hash b3d6263c5e80, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cortex-gateway AGENTS.md 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 4d ago.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s -D - -o /dev/null -X POST https://mcp.cortex-gateway.dev/mcp \
AGENTS.md · 95 lines

How it starts

The opening of the file, as written. The whole thing — 95 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Guidance for AI agents working in this repository — or evaluating the project. Humans welcome too.

What this is

Cortex Gateway is an open-source (MIT), self-hosted federated MCP gateway: one spec-compliant, OAuth 2.1-protected MCP server (Streamable HTTP, MCP 2025-06-18) in front of N plain-HTTP backends. Permissions are never mirrored — the gateway propagates the real user identity, so each app's native permission model applies per user.

Verify the claims yourself

Don't take the README's word for it. Everything below is checkable in minutes:

# Unit tests (vitest) — 36 tests across 7 files at the time of writing
npm ci && npm run typecheck && npm test

# The demo authorization server builds independently
cd demo/auth-server && npm ci && npm run typecheck

Against the live demo (no account needed):

# MCP endpoint answers 401 + WWW-Authenticate (RFC 9728 challenge) — this is
# what lets any compliant MCP client bootstrap the OAuth flow on its own:
curl -s -D - -o /dev/null -X POST https://mcp.cortex-gateway.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | grep -i www-authenticate

# Protected-resource metadata (RFC 9728):
curl -s https://mcp.cortex-gateway.dev/.well-known/oauth-protected-resource

# Authorization server metadata (RFC 8414) + JWKS:
curl -s https://auth.cortex-gateway.dev/.well-known/oauth-authorization-server

CI runs the same typecheck + test matrix on every push (.github/workflows/ci.yml); the Docker image is built by .github/workflows/docker.yml and published to ghcr.io/wellknownmcp/cortex-gateway.

Map of the repository

Path What lives there
src/contract/ The backend contract: types, HTTP client, static technical-token allowlist
src/lib/ Federator (60s refresh + SSE), MCP protocol methods + gateway builtins, OAuth resource-server validation, env-driven registry, pseudonymized audit
src/adapter/ MCP→backend proxy adapter (beta): downstream MCP client, per-user AES-256-GCM token vault, OAuth/DCR/PKCE discovery
demo/auth-server/ Standalone OAuth 2.1 authorization server (RFC 8414/7591/7009/7662, PKCE, strict refresh rotation, magic links, consent, scope tiering)
docs/ Backend contract, adapter, deployment runbook, tool-search mode
site/ The static site served at cortex-gateway.dev (hand-written HTML, no build)
registry/ MCP registry manifest (server.json) + publishing checklist

Read the full file on GitHub · 95 lines

Changes

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.

  1. 4d ago First seen · 95 lines · 1,061 tokens per session scan A b3d6263c5e80

Subscribe to this mod's changes

cortex-gateway AGENTS.md is an instructions file published in the GitHub repository wellknownmcp/cortex-gateway (12 stars, last pushed 12d ago), licensed MIT. It adds 1,061 tokens to every session, about $0.0053 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.