# MCP OAuth 2.1 & Security Audit

> Audits remote MCP servers for OAuth 2.1 compliance (RFC 9728, RFC 8414, PKCE S256), Streamable HTTP transport safety, CORS/SSRF posture, schema token bloat, and tool-poisoning risks.

MCP OAuth 2.1 & Security Audit is a free AI agent skill on Agensi by Caliber Foundry, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Caliber Foundry](https://www.agensi.io/creators/caliberfoundry)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/mcp-oauth-2-1-security-audit
- Tags: security, ai-agents, mcp, oauth21, security-audit

## About this skill

### MCP OAuth 2.1 & Security Audit Workflow

Audit any remote Model Context Protocol (MCP) server before connecting it to Claude Code, Cursor, ChatGPT, or production workflows.

#### Audit Sequence
1. **Transport & Auth Challenge Check**
   - Unauthenticated `POST` JSON-RPC `initialize` probe.
   - Verify HTTP `401 Unauthorized` with `WWW-Authenticate: Bearer resource_metadata="...", scope="..."` on protected servers and flag unauthenticated write-capable endpoints.
   - Confirm modern Streamable HTTP (`POST` + `Mcp-Session-Id` or stateless JSON/SSE) over deprecated unauthenticated `/sse`-only transports.
2. **OAuth 2.1 & Metadata Discovery Verification**
   - Validate RFC 9728 Protected Resource Metadata (`/.well-known/oauth-protected-resource`), canonical `resource`, HTTPS `authorization_servers`, least-privilege `scopes_supported`, and `bearer_methods_supported: ["header"]`.
   - Validate RFC 8414 (`/.well-known/oauth-authorization-server`) or OIDC discovery: mandatory `code_challenge_methods_supported` including `"S256"` (PKCE), `response_types_supported` including `"code"`, optional RFC 7591 `registration_endpoint`, and strict RFC 8707 `resource`/audience validation.
3. **CORS, Host & SSRF Posture**
   - Probe with untrusted `Origin` header; flag wildcard `Access-Control-Allow-Origin: *` or reflected origins paired with `Access-Control-Allow-Credentials: true`.
   - Verify outbound URL tools block private/loopback/metadata ranges (`127.0.0.0/8`, `10.0.0.0/8`, `169.254.169.254/32`, `::1`, `fc00::/7`).
4. **Tool Surface, Token Bloat & Tool-Poisoning Scan**
   - Inspect `tools/list` output (`name`, `description`, `inputSchema`) and estimate schema token footprint (`Math.ceil(JSON.stringify(tools).length / 4)`, warning above 8,000 tokens or 25 overlapping REST wrappers).
   - Scan descriptions and schema fields for hidden prompt injection (`<IMPORTANT>`, `<system>`, `"ignore previous instructions"`), invisible Unicode/BiDi chars (`U+200B..U+200F`, `U+202A..U+202E`, `U+2066..U+2069`), credential paths (`.ssh/`, `.aws/`, `.env`), or covert outbound `curl`/`fetch` instructions.
5. **Deterministic Report Format**
   - Outputs a `0-100` score, letter grade (`A`-`F`), RFC/control pass/fail checks, and severity-ordered remediations (`CRITICAL` -> `HIGH` -> `MEDIUM` -> `LOW`), backed by the included OAuth 2.1 verification checklist.

## Known limitations

Requires a reachable remote URL for probes. Focuses on protocol-level and manifest-level security rather than static binary analysis or fuzzing.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the MCP OAuth 2.1 & Security Audit skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What specific security risks does the MCP OAuth Security Audit address?

This skill identifies critical vulnerabilities in Model Context Protocol (MCP) implementations, such as tool-poisoning, SSRF risks, and non-compliant OAuth flows that could lead to unauthorized data exfiltration or model hijacking.

### Which AI agents or MCP frameworks are compatible with this audit skill?

The skill is designed to audit any remote MCP server regardless of the agent framework, as long as the server is reachable via a remote URL and utilizes JSON-RPC, SSE, or Streamable HTTP.

### Do I need to provide the source code of my MCP server for the audit to work?

No, this skill performs an external protocol-level audit and manifest analysis; it does not require access to your private source code to identify PKCE, transport, or schema vulnerabilities.

### What is included in the purchase of this skill?

You receive the full audit engine capable of performing deterministic security sequences, OAuth 2.1 compliance checks, and tool-poisoning scans, along with documentation on how to interpret the risk reports.

### Can this skill help me reduce the token cost of my MCP tools?

Yes, the skill includes a token optimization analysis that flags excessive schema footprints and tool overlapping, helping you minimize context window usage and operational costs.

### Are there any specific environment requirements or limitations I should be aware of?

The skill requires a reachable remote URL for the MCP server and focuses on protocol and manifest security; it does not perform deep fuzzing or internal logic testing of the tools themselves.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
