Directives MCP Server

Directives MCP Server

Serves engineering directives (AGENT.md and other markdown documents) to all Claude Code instances on a machine via a single Docker container, ensuring consistent code standards without copying files between projects.

Category
访问服务器

README

Directives MCP Server

A tiny MCP (Model Context Protocol) server that serves your engineering directives (AGENT.md and any other markdown documents) to every Claude Code instance on your machine, from a single Docker container on an uncommon local port.

Register it once with user scope; after that, any Claude Code session in any project can call get_directives and work under your rules — no copying files between repositories.

How it fits together

┌─────────────────────────┐
│ Docker: directives-mcp  │  serves ./docs/*.md via MCP
│ 127.0.0.1:49721/mcp     │  (streamable HTTP transport)
└───────────▲─────────────┘
            │ registered once: claude mcp add --scope user
┌───────────┴─────────────┐
│ Any Claude Code session │  tools: get_directives, get_section,
│ in any project          │         get_document, list_documents, health
└─────────────────────────┘

Project layout

directives-mcp-server/
├── server.py            # the MCP server (FastMCP, streamable-HTTP)
├── requirements.txt     # exact runtime pin used by the Docker build (mcp==1.28.1)
├── pyproject.toml       # project metadata + ruff config
├── Dockerfile           # slim, non-root image
├── docker-compose.yml   # one-command build + run, localhost-only
├── .dockerignore        # keeps the build context minimal
├── .gitignore
├── .gitattributes       # pins line endings (LF for Docker/shell, CRLF for .ps1)
├── docs/
│   └── AGENT.md         # THE served directives — single source of truth
├── test_server.py       # offline smoke tests of the tool logic
├── verify_client.py     # end-to-end MCP reachability check
├── register.ps1         # register with Claude Code (Windows)
└── register.sh          # register with Claude Code (macOS/Linux/Git Bash)

Setup (one time)

# 1. Build and start the container
docker compose up -d --build

# 2. Register with Claude Code — user scope = available in ALL projects
#    (or run ./register.sh  /  ./register.ps1)
claude mcp add --transport http --scope user directives http://127.0.0.1:49721/mcp

# 3. Verify Claude Code can reach it
claude mcp list          # directives should show ✓ Connected

Inside any Claude Code session you can also run /mcp to confirm the server and its tools are visible. Newly added servers are picked up when a session starts, so restart Claude Code (or start a new session) after registering.

Tools exposed

Tool Purpose
get_directives() Returns the full master AGENT.md
get_section(query, document?) Returns section(s) whose heading matches, e.g. get_section("commit")
get_document(name) Returns any document in docs/ by name
list_documents() Inventory of available documents
health() Liveness check

Verifying it works

# Offline unit tests of the tool logic (runs in the built image, no network):
docker run --rm -v "$PWD:/work" -w /work --entrypoint python \
  directives-mcp:latest test_server.py

End-to-end — connect over MCP and list/call the tools. Pick one of these; --network host (Linux) and host.docker.internal (Docker Desktop) are alternatives and must not be combined:

# Simplest (any OS): run the checker directly on the host.
pip install -r requirements.txt      # once, e.g. into a venv
python verify_client.py

# From a container — Linux hosts only (host networking reaches the published port):
docker run --rm --network host -v "$PWD:/work" -w /work --entrypoint python \
  directives-mcp:latest verify_client.py

# From a container — Windows/macOS (Docker Desktop): use the default bridge and
# reach the host via host.docker.internal. Do NOT add --network host here.
docker run --rm -e MCP_URL=http://host.docker.internal:49721/mcp \
  -v "$PWD:/work" -w /work --entrypoint python \
  directives-mcp:latest verify_client.py

Directing Claude Code to use it

Put this one line in each project's CLAUDE.md (this is the entire per-project footprint):

Before any work in this repository, call the `directives` MCP server's
`get_directives` tool and follow the returned document as the authoritative
source for code standards, sprint structure, modularization, commit
discipline, and clarification protocol. Re-read relevant sections with
`get_section` when starting a sprint task.

Or just say it in the prompt: "Load my directives from the directives MCP server, then execute Sprint 0."

Updating your directives

Edit files in ./docs/ — the directory is volume-mounted read-only into the container, so changes are live immediately. No rebuild, no restart. Add more documents (e.g. CHECKLIST.md, LARAVEL_MAPPING.md) by dropping them into docs/; they become available through get_document at once.

Operations

docker compose logs -f directives    # watch requests
docker compose restart directives    # restart
docker compose down                  # stop
claude mcp remove directives         # unregister from Claude Code

Notes

  • Port 49721 is deliberately uncommon and bound to 127.0.0.1 only, so the server is unreachable from your network. If you ever want it reachable from other machines, change the bind and add an auth header — do not expose it unauthenticated.
  • The container runs as an unprivileged user (uid 10001) and the docs volume is mounted read-only.
  • The --scope user registration lives in ~/.claude.json, so it applies to every project without touching any repo. Use --scope project instead if you want a specific repo to carry the registration in a committable .mcp.json.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选