关于 AI Context Inspector
AI Context Inspector 是用于发现项目及用户文件中 AI 配置、MCP 服务、技能、Agent 和记忆的命令行工具与 MCP 服务。开发者可检查、生成报告并在七种支持的工具间迁移配置,导出时还能隐藏密钥。
主要功能
- 01扫描 19 种工具的 AI 配置
- 02检查 MCP 服务并列出其能力
- 03生成可搜索的 HTML 仪表板或 JSON
- 04导出和导入生态配置包
- 05在导出配置中隐藏密钥
适用场景
- 01审查项目中的 AI 配置
- 02检查 MCP 服务提供的工具和资源
- 03在支持的 AI 工具间迁移配置
- 04分享已隐藏密钥的配置包
MCP 相关
作为 MCP 服务,它提供扫描项目、检查 MCP 服务、生成报告以及导入和导出生态配置包的工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
@cocaxcode/ai-context-inspector
一条命令,即刻查看项目中的所有 AI 配置。
CLI + MCP 服务 · 检测到 19 种工具 · 支持在 7 个目标之间导出/导入
快速开始 · MCP 服务 · 检测内容 · 功能 · 工具参考 · 架构
这是目前最全面的 AI 生态扫描器。AI Context Inspector 可在 19 种工具中发现项目里的所有 AI 配置文件、MCP 服务、自定义技能、Agent 和持久化记忆,并在几秒内呈现完整情况。你可以导出整个 AI 配置,并将其导入 7 种受支持的工具(Claude、Cursor、Windsurf、Copilot、Gemini、Codex、OpenCode),同时自动清除机密信息。无需配置。除了 MCP SDK 和 Zod 外,没有运行时依赖。所有操作都在本地运行——你的配置和凭据绝不会离开你的计算机。
快速开始
npx -y @cocaxcode/ai-context-inspector@latest
就这么简单。HTML 仪表板会打开,展示你的 AI 工具对项目所了解的一切。
# Scan a specific directory
npx -y @cocaxcode/ai-context-inspector@latest --dir /path/to/project
# Include user-level configs (~/.claude, ~/.gemini, etc.)
npx -y @cocaxcode/ai-context-inspector@latest --user
# Live-connect to each MCP server and list its tools
npx -y @cocaxcode/ai-context-inspector@latest --introspect
# Output raw JSON instead of HTML
npx -y @cocaxcode/ai-context-inspector@latest --json
所有 CLI 标志
| 标志 | 说明 | 默认值 |
|---|---|---|
--dir <path> | 要扫描的目录 | .(当前目录) |
--user | 包含用户级配置(~/) | false |
--introspect | 连接 MCP 服务并列出工具 | false |
--timeout <ms> | 每个服务的检测超时时间 | 10000 |
--json | 输出 JSON 而非 HTML | false |
--mcp | 以 MCP 服务模式运行(stdio 传输) | false |
MCP 服务设置
将其作为 MCP 服务运行,以便 AI 工具检查自身生态。
Claude Code
claude mcp add --scope user ai-context-inspector -- npx -y @cocaxcode/ai-context-inspector@latest --mcp
Claude Desktop
添加到 claude_desktop_config.json:
{
"mcpServers": {
"ai-context-inspector": {
"command": "npx",
"args": ["-y", "@cocaxcode/ai-context-inspector@latest", "--mcp"]
}
}
}
Cursor / Windsurf / VS Code / Codex CLI
Cursor / Windsurf — 添加到 .cursor/mcp.json 或相应配置文件:
{
"mcpServers": {
"ai-context-inspector": {
"command": "npx",
"args": ["-y", "@cocaxcode/ai-context-inspector@latest", "--mcp"]
}
}
}
VS Code — 添加到 .vscode/mcp.json:
{
"servers": {
"ai-context-inspector": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cocaxcode/ai-context-inspector@latest", "--mcp"]
}
}
}
Codex CLI:
codex mcp add ai-context-inspector -- npx -y @cocaxcode/ai-context-inspector@latest --mcp
或者直接添加到任何 .mcp.json 中:
{
"mcpServers": {
"ai-context-inspector": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cocaxcode/ai-context-inspector@latest", "--mcp"]
}
}
}
检测内容
| 工具 | 上下文文件 | 检测结果 |
|---|---|---|
| Claude Code | CLAUDE.md、.claude/、.mcp.json | 指令、MCP 配置、技能、Agent、记忆 |
| Cursor | .cursorrules、.cursor/rules/、.cursorignore | 规则、忽略模式 |
| Windsurf | .windsurfrules、.windsurf/rules/ | Codeium/Windsurf 规则 |
| GitHub Copilot | .github/copilot-instructions.md、.github/agents/ | 指令、自定义 Agent |
| Gemini CLI | GEMINI.md、.gemini/、.geminiignore | 配置、规则 |
| OpenAI Codex | AGENTS.md、AGENT.md、.codex/ | Agent 指令 |
| OpenCode | OPENCODE.md、.opencode/、opencode.json | CLI 配置 |
| Aider | .aider.conf.yml、.aiderignore | 配置、模型设置 |
| Cline | .clinerules、.clineignore | 规则(文件或目录) |
| Roo Code | .roo/rules/、.roorules、.rooignore | 规则 |
| Continue.dev | .continuerules、.continue/config.yaml | 规则、配置 |
| Amazon Q | .amazonq/rules/ | 开发者规则 |
| Augment | .augment/rules/、.augment-guidelines | 代码规则 |
| Replit | .replit.md | Agent 指令 |
| Firebase Studio | .idx/airules.md | AI 规则 |
| VS Code | .vscode/mcp.json | MCP 配置 |
| Tabnine | .tabnine.yaml | AI 配置 |
| Sourcegraph | .sourcegraph/ | Cody 配置 |
| 通用 | CONVENTIONS.md | 多工具约定 |
**提示:**传入
--user,还可扫描用户级配置:~/.claude/、~/.gemini/、~/.codex/、~/.continue/、~/.aider.conf.yml、~/.augment/、~/.github/agents/、~/.codeium/、~/.opencode/、~/.tabnine/。
除上下文文件外,扫描器还会检测:
- MCP 服务,来自
.mcp.json、~/.claude.json、.vscode/mcp.json、Claude Desktop 配置——可选择进行实时探查 .claude/skills/中的自定义技能(包括通过npx skills add添加的符号链接).claude/agents/中的自定义 Agent,并检测记忆- 持久记忆——Claude Memory、Agent 记忆、engram、OpenSpec、ATL
功能
扫描
npx -y @cocaxcode/ai-context-inspector@latest
npx -y @cocaxcode/ai-context-inspector@latest --user --introspect
生成独立的 HTML 仪表板,支持深色/浅色模式、搜索、可折叠区域、文件预览和颜色编码的工具徽章。传入 --json 可获取原始输出。
导出
# Export your AI ecosystem to .aci/bundle.json
npx -y @cocaxcode/ai-context-inspector@latest export
# Export only MCP and context configs, redact secrets
npx -y @cocaxcode/ai-context-inspector@latest export --only mcp,context --secrets none
导出标志
| 标志 | 描述 | 默认值 |
|---|---|---|
--dir <path> | 要导出的目录 | . |
--output <path> | 输出目录 | .aci/ |
--include-user | 包含用户级配置 | false |
--only <categories> | 筛选:mcp,skills,agents,memories,context | 全部 |
--secrets <mode> | none(脱敏)或 all(包含) | 交互式 |
导入
# Import into a Cursor project
npx -y @cocaxcode/ai-context-inspector@latest import --target cursor
# Auto-detect tool, skip confirmation, overwrite existing
npx -y @cocaxcode/ai-context-inspector@latest import --yes --force
导入标志
| 标志 | 描述 | 默认值 |
|---|---|---|
[file] | Bundle JSON 文件路径 | 自动检测 .aci/bundle.json |
--dir <path> | 目标目录 | . |
--target <tool> | 目标工具(参见表格) | 自动检测 |
--scope <scope> | project 或 user | 按资源而定 |
--force | 覆盖现有资源 | false |
--yes | 跳过确认提示 | false |
--only <categories> | 筛选:mcp,skills,agents,memories,context | 全部 |
--secrets <mode> | none 或 all | 交互式 |
| 目标 | MCP 配置 | 上下文文件 | 规则目录 | 技能 | Agent |
|---|---|---|---|---|---|
claude | .mcp.json | CLAUDE.md | -- | .claude/skills/ | .claude/agents/ |
cursor | .cursor/mcp.json | .cursorrules | .cursor/rules/ | -- | -- |
windsurf | .mcp.json | .windsurfrules | .windsurf/rules/ | -- | -- |
copilot | .vscode/mcp.json | .github/copilot-instructions.md | .github/instructions/ | -- | .github/agents/ |
gemini | .gemini/settings.json | GEMINI.md | .gemini/rules/ | -- | -- |
codex | .mcp.json | AGENTS.md | .codex/rules/ | -- | -- |
opencode | opencode.json | OPENCODE.md | .opencode/rules/ | -- | -- |
注意: 密钥处理有三种模式:none(全部脱敏,便于安全分享)、all(按原样包含)或 interactive(逐个变量提示,CLI 默认值)。会自动检测 MCP 配置中的环境变量。
MCP 工具参考
作为 MCP 服务运行时(--mcp),会公开五个工具:
scan
发现项目目录中的完整 AI 生态系统。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
directory | string | 否 | 要扫描的路径(默认:cwd) |
include_user | boolean | 否 | 包含用户级配置 |
introspect | boolean | 否 | 实时连接 MCP 服务 |
timeout | number | 否 | 内省超时时间(毫秒) |
introspect_mcp
连接到指定的 MCP 服务,并列出其工具、资源和提示词。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
command | string | 是* | 启动服务的命令 |
args | string[] | 否 | 命令的参数 |
env | object | 否 | 环境变量 |
url | string | 是* | HTTP/SSE 服务的 URL |
transport | string | 否 | stdio(默认)或 http |
timeout | number | 否 | 连接超时时间(毫秒) |
*必须提供 command(stdio)或 url(http)之一。
generate_report
根据扫描结果生成独立的 HTML 仪表板。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
directory | string | 否 | 要扫描的路径 |
include_user | boolean | 否 | 包含用户级配置 |
introspect | boolean | 否 | 内省 MCP 服务 |
timeout | number | 否 | 内省超时时间(毫秒) |
export_ecosystem
将完整的 AI 生态系统导出到可移植的 .aci/bundle.json。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
dir | string | 否 | 要扫描的目录(默认:cwd) |
include_user | boolean | 否 | 包含用户级配置 |
only | string[] | 否 | 类别:mcp、skills、agents、memories、context |
secrets | string | 否 | "none"(默认)、"all" 或 ["VAR1", "VAR2"] |
import_ecosystem
将捆绑包导入项目,并根据目标工具调整配置。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
file | string | 否 | 捆绑包路径(自动检测 .aci/bundle.json) |
dir | string | 否 | 目标目录(默认:cwd) |
target | string | 否 | 目标工具(自动检测):claude、cursor、windsurf、copilot、gemini、codex、opencode |
scope | string | 否 | project 或 user |
force | boolean | 否 | 覆盖现有资源 |
confirm | boolean | 否 | 执行导入(默认:false = 试运行) |
only | string[] | 否 | 要导入的类别 |
secrets | string | 否 | "none"、"all"、["VAR1"] 或 {"VAR1": "value"} |
警告:
import_ecosystem默认以试运行模式运行(confirm: false)。将confirm设为true才会实际写入文件。
Architecture
src/
├── index.ts # Entry: CLI vs MCP mode routing
├── cli.ts # CLI arg parsing + orchestration
├── server.ts # createServer() MCP factory
├── scanner/ # 6 parallel scanners (Promise.all)
│ ├── catalog.ts # AI_FILE_CATALOG — 50+ entries, 19 tools
│ ├── context-files.ts # Scan .md, rules, configs
│ ├── mcp-configs.ts # Parse .mcp.json, ~/.claude.json, etc.
│ ├── mcp-introspect.ts # Connect to servers, list tools/resources
│ ├── skills.ts # Skills + symlinks + frontmatter
│ ├── agents.ts # Agents + memory detection
│ └── memories.ts # engram, openspec, .atl, claude memory
├── ecosystem/ # Export/import engine
│ ├── export.ts # Scan → bundle → .aci/bundle.json
│ ├── import.ts # Load → plan → execute
│ ├── target-map.ts # Path configs for 7 AI tools
│ ├── detect-target.ts # Auto-detect tool in project
│ └── secrets.ts # Env var detection + redaction
├── report/ # HTML dashboard generator
│ ├── generator.ts # generateHtml(ScanResult) → string
│ ├── sections.ts # Section renderers
│ ├── styles.ts # CSS (dark/light)
│ └── scripts.ts # JS (collapse, search, preview)
└── tools/ # 5 MCP tool handlers
├── scan.ts
├── introspect.ts
├── report.ts
├── export.ts
└── import.ts
Stack: TypeScript 5 (strict, ESM) / MCP SDK / Zod / tsup / Vitest
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。