context-mcp: Instructions file for Claude Code

CLAUDE.md

context-mcp CLAUDE.md is an instructions file for Claude Code from geq1fan/context-mcp. It costs 996 tokens per session, scanned A, original, MIT.

Project instructions for a read-only MCP service that lets an AI agent inspect a code project’s files and context. MCP is a standard way for an AI agent to call tools provided by another service.

In plain words
What is it for?
It supports listing directories, showing a project tree, reading files such as AGENTS.md or CLAUDE.md, searching across files, finding files by name, and applying path-safety checks.
Why use it?
It gives the agent a defined way to navigate folders, find text, read files, and discover project instructions without changing the project.

Instructions file for Claude Code

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

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

Reuse

Borrowing it

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/geq1fan/context-mcp/claude-md.svg)](https://agentmods.dev/instructions/geq1fan/context-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/geq1fan/context-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/geq1fan/context-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 996 This file is loaded in full into every session.
When invoked 996 The same file — it is already loaded in full.
Security scan A 1 finding. 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.00996 $0.00996
Opus 5 $0.00498 $0.00498
Sonnet 5 $0.00199 $0.00199
Haiku 4.5 $0.00100 $0.00100

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

Security

Grade A, and why

context-mcp CLAUDE.md scanned grade A with 1 finding 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

4. **超时控制**: subprocess.run(timeout=60)
CLAUDE.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context MCP: 项目上下文集成服务

Generated: 2025-10-03 | Feature: 001-agent-mcp-md

项目概述

创建一个MCP服务,允许AI Agent通过标准化接口访问和分析任意项目的代码上下文。服务提供只读文件系统操作能力,包括目录导航、内容搜索、文件读取和AI上下文发现。

技术栈

语言: Python 3.11+ 框架: fastmcp (MCP框架), ripgrep (搜索加速) 打包: uv + uvx模式 测试: pytest (契约/集成/单元测试)

项目结构

context_mcp/
├── server.py           # FastMCP服务器入口
├── config.py           # 环境变量配置
├── tools/              # MCP工具实现
│   ├── navigation.py   # list_directory, show_tree
│   ├── search.py       # 4个搜索工具
│   └── read.py         # 4个读取工具
├── validators/         # 路径安全验证
└── utils/              # 文件检测、日志

tests/
├── contract/           # MCP契约测试
├── integration/        # 集成测试
└── unit/               # 单元测试

核心设计决策

  1. FastMCP装饰器模式: @mcp.tool()定义工具函数
  2. 路径安全: Path.resolve()防目录遍历攻击
  3. 二进制检测: NULL字节检测法
  4. 超时控制: subprocess.run(timeout=60)
  5. ripgrep优先: 回退grep保证兼容性

环境变量

  • PROJECT_ROOT: 项目根目录(必须)
  • SEARCH_TIMEOUT: 搜索超时秒数(默认60)

MCP工具清单

导航(3个)

  • list_directory: 列出目录,支持排序和limit
  • show_tree: 树状展示,支持max_depth
  • read_project_context: 读取AI上下文文件(AGENTS.md, CLAUDE.md)

搜索(4个)

  • search_in_file: 单文件搜索
  • search_in_files: 多文件递归搜索,支持正则、排除
  • find_files_by_name: 按名称查找(通配符)
  • find_recently_modified_files: 按修改时间查找

读取(4个)

  • read_entire_file: 读取完整文件
  • read_file_lines: 读取指定行范围
  • read_file_tail: 读取末尾N行
  • read_files: 批量读取

安全约束

  • ✅ 只读操作(禁止写入/删除)
  • ✅ 路径限制在PROJECT_ROOT内
  • ✅ 拒绝二进制文件读取
  • ✅ 文件权限检查

最近变更

  1. Phase 1完成: 数据模型、契约定义、quickstart
  2. 定义10个MCP工具契约(JSON Schema)
  3. 确定三层测试策略(契约/集成/单元)
  4. 完成测试覆盖补充(005-tool): 29个新增测试用例覆盖所有MCP工具参数,103个contract测试全部通过,参数覆盖率100%

测试覆盖现状

  • Contract测试: 103个测试(29个新增于005-tool),覆盖11个MCP工具的所有参数边界和组合
  • 测试通过率: 100% (103 passed, 1 skipped)
  • 参数覆盖率: 100% (所有工具参数都有专门测试验证)
  • 边界测试: limit=0/1, max_depth边界, 正则+排除组合, 行范围超出等29个关键场景

参考文档

  • Spec: specs/001-agent-mcp-md/spec.md
  • Plan: specs/001-agent-mcp-md/plan.md
  • Research: specs/001-agent-mcp-md/research.md
  • Data Model: specs/001-agent-mcp-md/data-model.md
  • Contracts: specs/001-agent-mcp-md/contracts/
  • Quickstart: specs/001-agent-mcp-md/quickstart.md
  • 005-tool测试覆盖清单: specs/005-tool/contracts/test-coverage-checklist.md

Read the full file on GitHub · 97 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 · 97 lines · 996 tokens per session scan A 762dfcb4de35

Subscribe to this mod's changes

context-mcp CLAUDE.md is an instructions file published in the GitHub repository geq1fan/context-mcp (5 stars, last pushed 10mo ago), licensed MIT. It adds 996 tokens to every session, about $0.0050 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). 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