Skip to content

MCP Overview ​

TestNet implements the MCP (Model Context Protocol), enabling AI assistants such as Claude Code, Cursor, Windsurf, and Codex to directly leverage TestNet platform capabilities.

What is MCP? ​

MCP is an open standard protocol released by Anthropic for integrating AI assistants with external tools and systems. Through MCP, AI assistants can:

  • Call Tools: Perform asset queries and mutations, trigger workflow orchestration, dispatch scanning tasks, conduct HTTP penetration testing, and search cyberspace
  • Access Resources: Read project lists, workflow lists, and tool specifications

TestNet MCP Capabilities ​

The platform provides 11 core facade MCP tools and 3 MCP Resources for external AI agents. All facade tools remain permanently exposed in tools/list; each covers a complete business domain through an action parameter. Legacy fine-grained atomic tools have been consolidated into their facades and are no longer exposed individually — always call a facade with an action.

MCP Integration Dashboard

The 11 Core Facade Tools at a Glance ​

#Tool NameDomainDescription
1testnet_assetAsset hubFull CRUD, global search, batch tagging, deduplication & merging, and automatic tag matching across 8 asset types (company/domain/sub_domain/ip/port/web/api/vul)
2testnet_query_asset_graphAsset topologyProject-level risk statistics + root-oriented BFS topology subgraph (edges carry relation semantics; statsOnly/rootType/rootId/depth supported)
3testnet_projectProject contextProject container management (idempotent creation); supports the strictScope switch — when enabled, HTTP relay/batch/diff targets must match a registered project asset or the request is rejected with SCOPE_DENIED
4testnet_search_toolsTool discoveryIntent-based search for scanning tools and workflows (mandatory before scanning)
5testnet_workflowWorkflow orchestrationDAG workflow trigger, tracking, cancellation, and template discovery
6testnet_taskTask dispatchSingle-tool scan dispatch, failure retry, batch await, log streams, chunked output reading, and cancellation
7testnet_get_system_statusCluster healthProbe cluster status and dispatch queue readiness
8testnet_httpHTTP penetrationPrecision relayed requests with audit, response diffing, batch probing, and chunked body reading
9testnet_web_reconWeb reconHeadless DOM parsing, hidden parameter mining, and frontend JS static analysis
10testnet_vulnVulnerability managementSeverity-filtered search (with the changedSince incremental reconciliation cursor), triage state transitions, and false-positive deletion; remediation/comment capped at 60000 characters
11testnet_cyberspaceCyberspace mappingExposure search via FOFA/Hunter/Quake/Shodan engines plus quota monitoring

3 MCP Resources ​

Resource URIContent
testnet://projectsProject list
testnet://workflowsWorkflow list
testnet://toolsTool definitions list

Usage Scenarios ​

Scenario 1: AI assistant performs full asset inventory and graph analysis

User: Analyze all externally exposed assets under project proj_001 and check for unfixed high-severity vulnerabilities

Claude: Let me query the TestNet asset graph and vulnerabilities...
[calls testnet_query_asset_graph(projectId="proj_001", statsOnly=true)]
[calls testnet_query_asset_graph(projectId="proj_001", rootType="DOMAIN", rootId="dom_001", depth=2)]
[calls testnet_vuln(action="search", projectId="proj_001", fixStatus="OPEN", severity="HIGH")]

The project currently owns 2 root domains, 15 subdomains, 8 open port services, and 2 unfixed high-severity vulnerabilities...

Scenario 2: AI assistant runs an automated scanning workflow

User: Run the fully automated domain reconnaissance workflow against example.com

Claude: Sure, let me confirm the available workflows first and then trigger it for you...
[calls testnet_search_tools(query="domain reconnaissance")]
[calls testnet_workflow(action="run", workflowId="domain-recon-pipeline", target="example.com", assetType="DOMAIN", projectId="proj_001")]

Workflow started, run ID: run_abc123...

Scenario 3: AI assistant assists HTTP penetration testing with audit evidence

User: Test whether https://api.example.com/user/profile is vulnerable to IDOR

Claude: I will use the TestNet HTTP facade for response diffing...
[calls testnet_http(action="diff", request_a={url: "https://api.example.com/user/profile?id=1001", headers: {Authorization: "Bearer token_a"}}, request_b={url: "https://api.example.com/user/profile?id=1002", headers: {Authorization: "Bearer token_a"}})]

The diff shows id=1002 also returns 200 with the user's phone number and address — IDOR confirmed...

Scenario 4: Exploratory Drill-Down on the Asset Graph

User: Starting from the web site api.test.com, map out everything related to it

Agent: Locate the root asset ID via asset search first, then run a directed topology...
[calls testnet_asset(action="search", keyword="api.test.com")]                    # locates root IDs (web_001 / dom_001)
[calls testnet_query_asset_graph(projectId="proj_001", rootType="WEB", rootId="web_001", depth=2)]
# Returns the BFS subgraph rooted at the site; edges carry HOSTS_WEB / RESOLVES_TO / HAS_PORT semantics (300-node cap per call)

User: Expand the root-domain layer too

Agent: Switch the root to the domain and increase the depth...
[calls testnet_query_asset_graph(projectId="proj_001", rootType="DOMAIN", rootId="dom_001", depth=3)]

MCP Transports & Endpoints ​

TestNet MCP supports Streamable HTTP (MCP 2025-03-26 spec, recommended), Legacy SSE Streaming, and REST API Extensions on the single unified endpoint /mcp/v1:

EndpointMethodDescription
/mcp/v1POSTStreamable HTTP transport endpoint (submit JSON-RPC messages, responses as application/json; initialize negotiates the protocol version and assigns the Mcp-Session-Id response header; notifications/client responses return 202; batch arrays supported)
/mcp/v1GETStreamable HTTP server-initiated notification stream (opened when the Mcp-Session-Id header is present, delivering progress and log notifications); without a session header it serves the legacy SSE handshake (emits endpoint event)
/mcp/v1DELETEStreamable HTTP session termination (closes the notification stream and releases the session)
/mcp/v1/sseGETLegacy MCP SSE transport handshake endpoint (emits endpoint event)
/mcp/v1/messagePOSTLegacy JSON-RPC 2.0 message handler (initialize, tools/list, tools/call, etc.)
/mcp/v1/infoGETRetrieve MCP server runtime configuration, version, and health status
/mcp/v1/toolsGETList tool definitions via REST
/mcp/v1/tools/callPOSTExecute a tool via REST
/mcp/v1/resourcesGETList available resources
/mcp/v1/resources/readGETRead resource content
/mcp/v1/promptsGETList prompt templates
/mcp/v1/prompts/getPOSTRender a prompt template

Streamable HTTP session lifecycle:

  1. The client sends an initialize request via POST /mcp/v1; the server negotiates the protocol version (echoes 2024-11-05 / 2025-03-26 / 2025-06-18) and assigns a session via the Mcp-Session-Id response header;
  2. Subsequent requests must carry the Mcp-Session-Id header; sessions expire after idle timeout (testnet.mcp.session-ttl-ms, 24 hours by default) or a server restart — the server responds with 404 and the client automatically re-initializes;
  3. The client may GET /mcp/v1 (with the session header) at any time to receive server-initiated notifications (notifications/progress live progress, notifications/message log stream, notifications/tools/list_changed tool hot-reload), and DELETE /mcp/v1 to terminate the session explicitly.

最近更新

Released under the MIT License