swagger-docs-mcp: Instructions file for Claude Code

CLAUDE.md

swagger-docs-mcp CLAUDE.md is an instructions file for Claude Code from qipeijun/swagger-docs-mcp. It costs 1,469 tokens per session, scanned A, original, MIT.

A set of project instructions for an AI coding assistant working on a read-only server that looks up Swagger 2.0 API documentation. Swagger is a format that describes available web API endpoints.

In plain words
What is it for?
Use it when developing, testing, building, or debugging this Swagger documentation server.
Why use it?
It gives the assistant the project’s purpose, architecture, commands, limitations, and error-handling rules so it can work consistently.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions Codex.

This is qipeijun/swagger-docs-mcp's own configuration. It tells Claude Code how to work on swagger-docs-mcp 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 swagger-docs-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to qipeijun/swagger-docs-mcp. 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/qipeijun/swagger-docs-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/qipeijun/swagger-docs-mcp

Made for: Claude Code.

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 swagger-docs-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/qipeijun/swagger-docs-mcp/claude-md.svg)](https://agentmods.dev/instructions/qipeijun/swagger-docs-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/qipeijun/swagger-docs-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/qipeijun/swagger-docs-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,469 This file is loaded in full into every session.
When invoked 1,469 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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.01469 $0.01469
Opus 5 $0.00734 $0.00734
Sonnet 5 $0.00294 $0.00294
Haiku 4.5 $0.00147 $0.00147

Measured 6d ago against content hash 28090253b3e0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

swagger-docs-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 6d 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.

CLAUDE.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 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.

项目概述

swagger-docs-mcp 是一个无状态、只读的 MCP 服务器,让 AI 代理能实时查询在线 Swagger 2.0 文档。支持从 doc.html(Knife4j/Springfox)和 Swagger JSON 直链两种入口发现文档,提供 5 个 Tool:inspect_api_docslist_api_categoriesget_api_categoryget_api_by_pathsearch_apis

核心设计约束:

  • 每次 Tool 调用都必须显式传入 docsUrl,服务不保存地址
  • 不缓存文档内容,每次调用实时获取
  • 只读:不调用业务 API,不通过 URL 认证,不读取外部 $ref
  • 仅支持 Swagger 2.0,OpenAPI 3 返回明确的不支持错误

常用命令

npm run check          # 类型检查 + 测试 + 构建(完整 CI 检查)
npm run build          # 编译到 dist/
npm test               # 运行所有单元测试
npm run test:watch     # 监听模式测试
npm run test:integration  # 仅运行 MCP 协议集成测试
npm run typecheck      # 仅类型检查(不构建)
npm run dev            # tsx 直接运行 src/index.ts
node dist/index.js doctor [docsUrl] [--group <name>]  # 诊断命令

check 是提交前必须通过的完整检查。npm run dev 用于本地 MCP stdio 模式调试。

架构分层

代码按稳定边界分层,依赖方向从底层到上层:

src/domain/types.ts     # 领域类型、枚举、接口(无依赖)
src/errors.ts           # 错误码、错误阶段、AppError(无依赖)
src/parser/types.ts     # 解析器抽象接口 ApiSpecParser
src/source/             # HTTP 安全获取 + 文档入口发现(SafeHttpClient → DocumentDiscoveryService)
src/navigation/         # Knife4j hash 线索解析(纯函数,不接触网络)
src/swagger2/           # Swagger 2.0 解析器实现 ApiSpecParser
src/service/            # 客户端无关的查询服务 ApiDocsService(编排层)
src/server/             # MCP Tool 注册,依赖 MCP SDK
src/cli/                # CLI 入口(serve/doctor/setup/remove),依赖 @modelcontextprotocol/sdk
src/index.ts            # 二进制入口
src/version.ts          # 从 package.json 读取版本号

关键设计点:

  • ApiSpecParsersrc/parser/types.ts)是解析器的可扩展接口。新增 OpenAPI 3 支持时只需新增实现类,无需改动 Tool 契约和上层代码。
  • ApiDocsService 是核心编排层:接收 docsUrl + group → 调用 DocumentDiscoveryService 发现文档 → 匹配解析器 → 返回 LoadedApiDocument。所有 5 个 Tool 都通过它完成查询。
  • DocumentDiscoveryService 按适配器模式组织:先用 SafeHttpClient 获取入口 URL,再交给合适的 DocumentDiscoveryAdapterRawJsonDiscoveryAdapter 处理 JSON 直链,SpringfoxDiscoveryAdapter 处理 HTML 页面的 swagger-resources 发现)。
  • SchemaNodeFlatSchemaField 的两层结构:Swagger2SchemaAnalyzer.buildNode() 构建树形 schema 含 $ref 递归解析、allOf 合并、additionalProperties 动态键;flatten() 再展平为可检索的 flatFields。同时标记 unresolvedDynamicFieldsrecursionBoundary、循环引用等解析边界。

Read the full file on GitHub · 100 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. 6d ago First seen · 100 lines · 1,469 tokens per session scan A 28090253b3e0

Subscribe to this mod's changes

swagger-docs-mcp CLAUDE.md is an instructions file published in the GitHub repository qipeijun/swagger-docs-mcp (1 stars, last pushed 1mo ago), licensed MIT. It adds 1,469 tokens to every session, about $0.0073 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

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

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,182 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

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

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

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