Borrowing it
Nothing to install: this file belongs to hwc2357300448/doc-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/hwc2357300448/doc-mcp-server/master/CLAUDE.mdgit clone --depth 1 https://github.com/hwc2357300448/doc-mcp-serverWrote 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/hwc2357300448/doc-mcp-server/claude-md)<a href="https://agentmods.dev/instructions/hwc2357300448/doc-mcp-server/claude-md"><img src="https://agentmods.dev/badge/instructions/hwc2357300448/doc-mcp-server/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/hwc2357300448/doc-mcp-server/claude-md"><img src="https://agentmods.dev/badge/instructions/hwc2357300448/doc-mcp-server/claude-md.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.01374 | $0.01374 |
| Opus 5 | $0.00687 | $0.00687 |
| Sonnet 5 | $0.00275 | $0.00275 |
| Haiku 4.5 | $0.00137 | $0.00137 |
Grade A, and why
doc-mcp-server 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 9d 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 — 155 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.
项目概述
这是一个 Word 文档编辑 MCP 服务器,用于与 Claude Code CLI 集成,提供完整的 Word 文档操作能力。基于 MCP (Model Context Protocol) 协议,通过 python-docx 库实现 Word 文档的创建、编辑、格式化等功能。
核心架构
MCP 服务器架构
- 服务入口:
src/server.py- MCP 服务器主入口,注册所有工具并处理工具调用 - 工具模块:
src/tools/- 按功能分类的工具实现 - 辅助工具:
src/utils/- 文档管理和错误处理
工具模块分类
工具按功能分为以下模块:
- document_basic.py - 文档基础操作(创建、读取、复制、获取信息)
- content_edit.py - 内容编辑(段落、标题、查找替换)
- table_ops.py - 表格操作(创建、编辑、格式化、读取)
- style_format.py - 样式格式(分页符、页边距)
- image_ops.py - 图片操作(插入图片)
- list_ops.py - 列表操作(有序/无序列表)
- advanced.py - 高级功能(脚注、页眉页脚、大纲)
- interface_doc.py - 接口文档生成(标准格式的接口文档表格)
文档管理机制
重要: DocumentManager 类采用无缓存设计,每次操作都重新加载文档:
get_or_open()- 每次都从磁盘重新加载文档save()- 保存文档到磁盘- 这种设计确保多个操作之间的数据一致性,避免缓存导致的数据丢失
常用命令
安装依赖
pip install -r requirements.txt
运行 MCP 服务器
# 方式1: 直接运行
python -m src.server
# 方式2: 使用批处理脚本(Windows)
start_mcp.bat
# 方式3: 使用 Python 脚本
python run_server.py
开发工具
# 代码格式化
black src/ --line-length 100
# 代码检查
ruff check src/
添加新工具的步骤
-
在对应的工具模块中实现函数
- 例如在
src/tools/content_edit.py中添加新的内容编辑功能 - 函数必须是
async函数 - 使用
DocumentManager进行文档操作 - 返回格式:
{"success": True/False, "message": "...", ...}
- 例如在
-
在
src/server.py中注册工具- 在
list_tools()函数中添加Tool定义 - 定义工具名称、描述和
inputSchema
- 在
-
在
call_tool()函数中添加调用处理- 添加
elif name == "your_tool_name":分支 - 调用对应的工具函数
- 添加
关键设计模式
错误处理
- 所有工具函数使用统一的错误处理机制
- 返回 JSON 格式:
{"success": bool, "error": str, "message": str} - 使用
error_handler.py中的DocxError自定义异常
文档操作流程
# 标准操作流程
doc_manager = DocumentManager()
doc = doc_manager.get_or_open(filename) # 加载文档
# ... 执行操作 ...
doc_manager.save(filename, doc) # 保存文档
索引约定
- 段落索引: 从 0 开始
- 表格索引: 从 0 开始
- 行/列索引: 从 0 开始
- 范围操作使用
start_index和end_index,均为包含边界
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.
- 9d ago First seen · 155 lines · 1,374 tokens per session scan A c2242535b7ce
doc-mcp-server CLAUDE.md is an instructions file published in the GitHub repository hwc2357300448/doc-mcp-server (3 stars, last pushed 6mo ago), licensed MIT. It adds 1,374 tokens to every session, about $0.0069 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).
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).
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.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.