doc-mcp-server: Instructions file for Claude Code

CLAUDE.md

doc-mcp-server CLAUDE.md is an instructions file for Claude Code from hwc2357300448/doc-mcp-server. It costs 1,374 tokens per session, scanned A, original, MIT.

Repository instructions for a Word-document MCP server, a program that lets Claude Code create and edit .docx files through a standard tool interface. The server uses Python and python-docx and groups operations into modules.

In plain words
What is it for?
Use them when modifying the server, adding document tools, running it, formatting or checking its code, and working with paragraphs, tables, lists, images, or document metadata.
Why use it?
They give coding agents the project's architecture, document-loading rules, development commands, and contribution expectations. Reloading documents from disk on every operation helps keep separate edits consistent.

Instructions file for Claude Code

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

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

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/hwc2357300448/doc-mcp-server/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/hwc2357300448/doc-mcp-server

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 doc-mcp-server CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/hwc2357300448/doc-mcp-server/claude-md/github.svg)](https://agentmods.dev/instructions/hwc2357300448/doc-mcp-server/claude-md)
Your own site
<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.

agentmods 80×15 button for doc-mcp-server CLAUDE.md

Your own site · 80×15
<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>
Per session 1,374 This file is loaded in full into every session.
When invoked 1,374 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.01374 $0.01374
Opus 5 $0.00687 $0.00687
Sonnet 5 $0.00275 $0.00275
Haiku 4.5 $0.00137 $0.00137

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

Security

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.

CLAUDE.md · 155 lines

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/ - 文档管理和错误处理

工具模块分类

工具按功能分为以下模块:

  1. document_basic.py - 文档基础操作(创建、读取、复制、获取信息)
  2. content_edit.py - 内容编辑(段落、标题、查找替换)
  3. table_ops.py - 表格操作(创建、编辑、格式化、读取)
  4. style_format.py - 样式格式(分页符、页边距)
  5. image_ops.py - 图片操作(插入图片)
  6. list_ops.py - 列表操作(有序/无序列表)
  7. advanced.py - 高级功能(脚注、页眉页脚、大纲)
  8. 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/

添加新工具的步骤

  1. 在对应的工具模块中实现函数

    • 例如在 src/tools/content_edit.py 中添加新的内容编辑功能
    • 函数必须是 async 函数
    • 使用 DocumentManager 进行文档操作
    • 返回格式: {"success": True/False, "message": "...", ...}
  2. src/server.py 中注册工具

    • list_tools() 函数中添加 Tool 定义
    • 定义工具名称、描述和 inputSchema
  3. 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_indexend_index,均为包含边界

Read the full file on GitHub · 155 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. 9d ago First seen · 155 lines · 1,374 tokens per session scan A c2242535b7ce

Subscribe to this mod's changes

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.

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

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.

deepseek-ai/deepseek-harness · 3,735 tokens