# A2A v1.0 & MCP Security Auditor (JWS, SSRF & Poisoning) (`khoaphan/a2a-mcp-security-auditor`) Actor

Deterministic A2A v1.0.1 & MCP security auditor powered by mcp-tool-guard. Audits /.well-known/agent-card.json (RFC 8785 JCS, Ed25519 JWS, SSRF, A2ABreak) and MCP tools/list for 5-layer tool poisoning, plus live A2A JSON-RPC Standby mode.

- **URL**: https://apify.com/khoaphan/a2a-mcp-security-auditor.md
- **Developed by:** [Khoa Phan](https://apify.com/khoaphan) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## A2A v1.0 & MCP Security Auditor (`a2a-mcp-security-auditor`)

Deterministic **Agent2Agent (A2A v1.0.1)** and **Model Context Protocol (MCP)** security auditor powered by [`mcp-tool-guard`](https://github.com/khoap1220-hue/mcp-tool-guard) (`v0.4.0`, zero core runtime dependencies).

Supports **both** standard Apify batch security audits and **Apify Standby Web Server mode** exposing a live, Ed25519-signed A2A v1.0.1 + legacy v0.3 JSON-RPC 2.0 security verification agent.

### Capabilities

1. **RFC 8785 JCS & RFC 7515 JWS `AgentCard` Verification (`A2A-01`, `A2A-07`):**
   - Canonicalizes `/.well-known/agent-card.json` per RFC 8785 JSON Canonicalization Scheme (UTF-16 key ordering) and computes deterministic SHA-256 digests.
   - Cryptographically verifies `EdDSA` (Ed25519), `ES256`, and `RS256` detached JWS signatures against `<origin>/.well-known/jwks.json`, blocking `alg: "none"` downgrades and untrusted `jku`/`x5u` remote key injection.
2. **SSRF, TLS & A2ABreak Structural Security Audit (`A2A-02..06`):**
   - Blocks loopback, RFC 1918 private networks, link-local cloud metadata (`169.254.169.254`), CGNAT, IPv4-mapped IPv6, and obfuscated IP literals across endpoint and `pushNotification` webhook URLs.
   - Audits `securitySchemes`, `securityRequirements`, wildcard scope leaks, and cross-hop capability attenuation.
3. **5-Layer MCP `tools/list` Tool-Poisoning & SHA-256 Pinning (`mcpToolsJson`):**
   - Scans MCP tool descriptions and input schemas across 5 layers: hidden HTML/Markdown comments, BiDi & zero-width Unicode tag smuggling, UTS #39 confusable homoglyphs, prompt-injection/exfiltration directives, and structural entropy.
4. **Live A2A v1.0.1 & v0.3 Standby Server (`APIFY_META_ORIGIN=STANDBY`):**
   - `GET /.well-known/agent-card.json` — Ed25519-signed A2A v1.0.1 `AgentCard`
   - `GET /.well-known/jwks.json` — Public OKP Ed25519 JWK set
   - `POST /a2a` & `POST /` — JSON-RPC 2.0 handler supporting both A2A v1.0 `SendMessage` (`GetTask`, `ListTasks`, `CancelTask`) and legacy A2A v0.3 `message/send` (`tasks/get`, `tasks/cancel`), plus HTTP+JSON `POST /message:send`.

### Example Batch Input

```json
{
  "agentCardUrl": "https://khoaphan.dev/.well-known/agent-card.json",
  "strictV1": true,
  "allowUnsigned": false
}
```

### Example A2A v1.0 `SendMessage` JSON-RPC Request

```json
{
  "jsonrpc": "2.0",
  "id": "audit-1",
  "method": "SendMessage",
  "params": {
    "message": {
      "messageId": "msg-001",
      "role": "ROLE_USER",
      "parts": [
        {
          "text": "Audit https://khoaphan.dev/.well-known/agent-card.json"
        }
      ]
    }
  }
}
```

### 72-Hour Remediation Sprints & Written A2A Engineering

Operated by **Khoa Phan Engineering** under a transparent **A2A (AI-Orchestrated Senior Engineering)** workflow — 100% written asynchronous communication (Email `khoa@khoaphan.dev`, GitHub Specs/PRs — zero live meetings) with Code-First PoCs and automated regression tests upfront:

- **A2A & MCP Security Hardening:** https://khoaphan.dev/mcp/
- **Engineering Services & Sprints:** https://khoaphan.dev/services/

# Actor input Schema

## `agentCardUrl` (type: `string`):

Public HTTPS URL of an A2A /.well-known/agent-card.json manifest or agent base origin (auto-discovers /.well-known/agent-card.json and /.well-known/jwks.json with SSRF guardrails).

## `agentCardJson` (type: `string`):

Optional raw A2A AgentCard JSON payload to audit directly without an HTTP fetch. Overrides agentCardUrl when non-empty.

## `jwksUrl` (type: `string`):

Optional HTTPS URL to an RFC 7517 JWKS endpoint for cryptographic verification of AgentCard.signatures\[] (defaults to <origin>/.well-known/jwks.json when agentCardUrl is used).

## `jwksJson` (type: `string`):

Optional raw RFC 7517 JWKS JSON object ({ "keys": \[...] }) for signature verification.

## `mcpToolsJson` (type: `string`):

Optional MCP tools/list JSON array or { "tools": \[...] } object to scan for 5-layer tool poisoning, Unicode tag smuggling, UTS #39 homoglyphs, and canonical SHA-256 pinning.

## `strictV1` (type: `boolean`):

Enforce A2A v1.0.1 supportedInterfaces\[], ProtoJSON securitySchemes, and securityRequirements invariants.

## `allowUnsigned` (type: `boolean`):

When false (recommended), flags AgentCard manifests lacking verifiable RFC 7515 JWS signatures.

## `webhookUrls` (type: `array`):

Optional list of A2A pushNotification webhook URLs to test against SSRF, loopback, private CIDR, and cloud metadata bypass vectors.

## `timeoutSecs` (type: `integer`):

Per-request HTTP fetch timeout in seconds.

## Actor input object example

```json
{
  "agentCardUrl": "https://khoaphan.dev/.well-known/agent-card.json",
  "strictV1": true,
  "allowUnsigned": false,
  "webhookUrls": [],
  "timeoutSecs": 15
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items containing A2A AgentCard JWS/JCS/SSRF findings, MCP 5-layer tool-poisoning results, canonical SHA-256 digests, and readiness scores

## `markdownReport` (type: `string`):

Ready-to-share AUDIT_REPORT.md stored in the default Key-Value Store

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "agentCardUrl": "https://khoaphan.dev/.well-known/agent-card.json"
};

// Run the Actor and wait for it to finish
const run = await client.actor("khoaphan/a2a-mcp-security-auditor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "agentCardUrl": "https://khoaphan.dev/.well-known/agent-card.json" }

# Run the Actor and wait for it to finish
run = client.actor("khoaphan/a2a-mcp-security-auditor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "agentCardUrl": "https://khoaphan.dev/.well-known/agent-card.json"
}' |
apify call khoaphan/a2a-mcp-security-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khoaphan/a2a-mcp-security-auditor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/MUrM5GNKZMQINXlRd/builds/4lC1Q7n4fx2M5em7N/openapi.json
