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.
npx agentmods add instructions/lulaide/fofa-mcp/claude-mdgit clone --depth 1 https://github.com/lulaide/fofa-mcpWrote 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.
[](https://agentmods.dev/instructions/lulaide/fofa-mcp/claude-md)<a href="https://agentmods.dev/instructions/lulaide/fofa-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/lulaide/fofa-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00854 | $0.00854 |
| Opus 5 | $0.00427 | $0.00427 |
| Sonnet 5 | $0.00171 | $0.00171 |
| Haiku 4.5 | $0.00085 | $0.00085 |
Grade A, and why
fofa-mcp CLAUDE.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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
构建与运行
# 构建
npm run build
# stdio 模式(默认,本地客户端用)
node dist/index.js
# HTTP 模式(远程部署,Claude.ai 网页端用)
JWE_SECRET=... JWS_SECRET=... SERVER_URL=http://localhost:3000 node dist/index.js serve
# Worker(独立项目,在 worker/ 目录下)
cd worker && npm run dev # 本地开发
cd worker && npm run deploy # 部署到 Cloudflare
架构
项目有三种运行模式:
- stdio(
fofa-mcp)— 本地 MCP,通过 stdin/stdout 通信,配置来自环境变量 - serve(
fofa-mcp serve)— Express HTTP 服务器,OAuth 2.1 + PKCE 认证,配置来自 JWT token - worker(
worker/)— Cloudflare Worker 无服务器部署,同样的 OAuth 流程,使用 Web Standard API
完全无状态 HTTP
serve 和 worker 都是无状态的——每个 POST /mcp 请求独立创建 McpServer + Transport,处理完即销毁。无 session,无跨请求内存状态。用户的 FOFA 配置(baseURL + apiKey)存在 JWS access token 中。
条件工具注册
isOfficialAPI(baseURL) 控制 fofa_user_info、fofa_stats、fofa_host 是否注册——这些只在官方 fofa.info 上可用。自定义/中转 API 地址只注册 fofa_search + fofa_export。
OAuth token 流程(serve 和 worker)
- authorization code:JWE 加密(A256GCM),包含用户 FOFA 配置 + PKCE challenge,5 分钟过期
- access token:JWS 签名(HS256),包含 FOFA 配置,365 天过期
- 密钥未设置时自动随机生成(重启后旧 token 失效)
代码结构
src/index.ts— CLI 分发:process.argv[2] === "serve"进入 HTTP 模式src/client.ts— FOFA API 客户端(search、userInfo、stats、hostDetail)+ 环境变量配置加载src/tools/— 每个文件导出register*Tool(server, config)函数src/server/create-mcp-server.ts— 共享工厂函数,stdio 和 serve 模式都用src/server/serve.ts— Express 应用,挂载 SDK 的mcpAuthRouter+ 无状态/mcp处理src/server/crypto.ts—jose库的 JWE/JWS 封装src/server/oauth-provider.ts— 实现 SDK 的OAuthServerProvider接口worker/— 独立项目,不依赖 Express,纯 fetch handler 实现 OAuth + MCP
发布流程
推送 v* 标签 → CI 自动发布 npm + 创建 GitHub Release:
# 更新 package.json 和 src/server/create-mcp-server.ts 中的版本号
git tag -a v0.x.x -m "描述"
git push origin main v0.x.x
Worker 独立部署:cd worker && npx wrangler deploy
约定
- 提交信息:conventional commits 中文(如
feat: 新增...、fix: 修复...) - npm 包只发布
dist/编译产物 - Worker 启用
nodejs_compat兼容标志
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.
- 5d ago First seen · 72 lines · 854 tokens per session scan A 4c57e3787043
fofa-mcp CLAUDE.md is an instructions file published in the GitHub repository lulaide/fofa-mcp (11 stars, last pushed 5mo ago), licensed MIT. It adds 854 tokens to every session, about $0.0043 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.
Other instructions, from other repositories
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.
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.
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).
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.
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.
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).