mcp-auth-adapter: Instructions file for Codex

AGENTS.md

mcp-auth-adapter AGENTS.md is an instructions file for Codex, OpenCode from velias/mcp-auth-adapter. It costs 5,980 tokens per session, scanned A, original, Apache-2.0.

Repository instructions for an OAuth and OpenID Connect adapter used by MCP clients. OAuth and OpenID Connect are standards for letting applications sign users in and obtain access tokens.

In plain words
What is it for?
Working on discovery endpoints, client registration, authorization and token proxying, redirect-URI checks, and client-to-provider mappings.
Why use it?
They explain how the adapter presents an upstream identity provider to MCP clients without making the adapter responsible for issuing tokens.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is velias/mcp-auth-adapter's own configuration. It tells Codex and OpenCode how to work on mcp-auth-adapter itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcp-auth-adapter configures →

Reuse

Borrowing it

Nothing to install: this file belongs to velias/mcp-auth-adapter. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/velias/mcp-auth-adapter/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/velias/mcp-auth-adapter

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 mcp-auth-adapter AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/velias/mcp-auth-adapter/agents-md.svg)](https://agentmods.dev/instructions/velias/mcp-auth-adapter/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/velias/mcp-auth-adapter/agents-md"><img src="https://agentmods.dev/badge/instructions/velias/mcp-auth-adapter/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 5,980 This file is loaded in full into every session.
When invoked 5,980 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.05980 $0.05980
Opus 5 $0.02990 $0.02990
Sonnet 5 $0.01196 $0.01196
Haiku 4.5 $0.00598 $0.00598

Measured 8d ago against content hash 1ac1a7172667, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

mcp-auth-adapter AGENTS.md scanned grade A with 0 findings 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 8d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 384 lines

How it starts

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

AGENTS.md

Project overview

mcp-auth-adapter is a thin, stateless OAuth/OIDC auth adapter for MCP clients. It sits in front of upstream IdP (Keycloak-style) so MCP servers can advertise this adapter as the authorization server instead of the raw IdP URL. It does not issue tokens — all real auth/token work stays on the upstream IdP.

Key responsibilities

  • Discovery — Serves /.well-known/openid-configuration and /.well-known/oauth-authorization-server as a filtered, MCP-oriented view of upstream OIDC metadata (with optional injection of this app's DCR, authorization, and token proxy URLs).
  • Dynamic Client Registration (DCR)POST /register returns an upstream client_id (RFC 7591 style, public client). Supports per-MCP-client IdP client mapping via MCP_PROXY_DCR_CLIENT_NAME_MAP (pattern-based client_name matching with optional per-client allowed_redirect_uris enforced at /authorize and /token time, not at DCR time — the adapter is stateless). Falls back to MCP_PROXY_DCR_CLIENT_ID for unmatched names. Validates redirect_uris format (parseable URI, no fragments per RFC 6749 §3.1.2; any scheme including custom/private-use per RFC 8252 §7.1) and type-checks grant_types/response_types (must be arrays of strings). Invalid input returns RFC 7591 invalid_client_metadata errors. Access logs include idpClient, matchedMapping, clientName (truncated to 200 chars), and redirect_uris count for audit. Auto-enables when MCP_PROXY_DCR_CLIENT_ID or MCP_PROXY_DCR_CLIENT_NAME_MAP is set.
  • Authorization adapterGET /authorize validates redirect_uri against configured patterns, wraps original redirect_uri + state into a signed HMAC state blob, rewrites redirect_uri to the adapter's callback, and redirects to upstream. Supports scope filtering, optional CIMD client_id substitution, and RFC 8707 resource parameter validation (format check always active; optional require + allowlist enforcement via config). Auto-enables when scope filtering, CIMD, or MCP_PROXY_AUTH_STATE_SECRET is configured.
  • Authorization callback (RFC 9207 iss interception)GET /authorize/callback receives the upstream redirect, verifies the signed state blob (HMAC + expiry), validates upstream iss parameter using two-tier logic, then redirects to the original MCP client redirect_uri with the adapter's iss value. Prevents OAuth mix-up attacks per RFC 9207.
  • Token proxyPOST /token proxies token requests to the upstream IdP. For authorization_code grants, validates redirect_uri against allowed patterns and rewrites it to the adapter's callback URL. For refresh_token grants, passes through without redirect_uri modification. For client_credentials and urn:ietf:params:oauth:grant-type:jwt-bearer grants, passes all parameters through without redirect_uri logic (covers both the Client Credentials extension and the Enterprise-Managed Authorization extension). RFC 8707 resource parameter validation is applied to all grant types except refresh_token. Forwards the Authorization header to upstream for non-CIMD requests (supports client_secret_basic per RFC 6749 §2.3.1; skipped for CIMD because client_id is rewritten). Always forwards DPoP / DPoP-Nonce request headers and relays DPoP-Nonce responses. Always active when the authorize proxy is active.
  • PAR proxy (RFC 9126) — POST /par applies the same authorize-time transforms (scopes, CIMD, redirect_uri/state wrapping, resource) and proxies to the upstream PAR endpoint, returning the upstream request_uri (IdP holds PAR state; adapter stays stateless). Forwards Authorization / DPoP / DPoP-Nonce like /token. GET /authorize with request_uri forwards only client_id + request_uri (CIMD rewrite only). Auto-enables when the authorize proxy is active and upstream advertises pushed_authorization_request_endpoint — discovery is rewritten to {MCP_BASE_URL}/par; never invented if upstream omits PAR.
  • CIMD adapter (EXPERIMENTAL) — Accepts CIMD-style client_id URLs from MCP clients, validates metadata documents, maps them to upstream IdP client_ids, and proxies /authorize, /par, and /token with client_id substitution. Auto-enables when MCP_PROXY_CIMD_MAP or MCP_PROXY_CIMD_DEFAULT_CLIENT_ID is set.

Read the full file on GitHub · 384 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. 8d ago First seen · 384 lines · 5,980 tokens per session scan A 1ac1a7172667

Subscribe to this mod's changes

mcp-auth-adapter AGENTS.md is an instructions file published in the GitHub repository velias/mcp-auth-adapter (5 stars, last pushed 4d ago), licensed Apache-2.0. It adds 5,980 tokens to every session, about $0.0299 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens