Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/ramidlab/mcp-service-template/agents-mdgit clone --depth 1 https://github.com/RamidLab/mcp-service-templateWrote 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/ramidlab/mcp-service-template/agents-md)<a href="https://agentmods.dev/instructions/ramidlab/mcp-service-template/agents-md"><img src="https://agentmods.dev/badge/instructions/ramidlab/mcp-service-template/agents-md.svg" alt="Measured on agentmods" 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.02642 | $0.02642 |
| Opus 5 | $0.01321 | $0.01321 |
| Sonnet 5 | $0.00528 | $0.00528 |
| Haiku 4.5 | $0.00264 | $0.00264 |
Grade A, and why
mcp-service-template AGENTS.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 5d 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 — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md — Service MCP 模板
项目概览
通用 MCP 服务模板(FastMCP + SQLAlchemy async + Pydantic v2 + Typer CLI),含示例实体 Product / ProductPrice,演示完整 CRUD + 外键解析 + 动态 Filter/Search 链路。
- Python: 3.12+ 必须
- 包管理器: uv(pip 可用但 uv 为主)
- 入口:
service_mcp/server.py— CLI 命令service-mcp - 工具数量: 约 33 个(2 个示例实体 + CSV 导出示例)
快速命令
# 环境
uv venv && uv sync --dev
# 运行服务(任选一种传输)
uv run service-mcp stdio
uv run service-mcp streamable-http --host 0.0.0.0 --port 8001
uv run service-mcp sse --host 0.0.0.0 --port 8001
uv run service-mcp ui --dev-port 8080 --mcp-port 8001
# 测试(内存 SQLite,无需外部 DB;mysql/postgresql 参数化用例需对应服务运行)
pytest # 全部测试
pytest tests/test_config.py # 单文件
pytest -k "test_name" # 单测试
# Lint + 格式 + 类型
ruff check .
ruff check --fix .
ruff format .
mypy service_mcp
# 修改 filter/search 声明后重新生成 .pyi stub(跑两次,第二次应无 diff)
uv run python scripts/refresh_project_stub.py
# 生成演示数据
uv run python mock/mock_product_data.py
# 数据库迁移(幂等,可重复执行)
uv run python scripts/migrate_example.py
uv run python scripts/migrate_example.py --url sqlite+aiosqlite:///path/to/service_data.db
# 项目改名(模板 → 新项目)
uv run python scripts/rename_project.py my_company --project my-company-mcp --display "My Company MCP"
架构
service_mcp/
├── server.py # FastMCP app + Typer CLI(stdio/sse/streamable-http/ui)
├── config.py # MCPSettings 分层配置(env → TOML → code),前缀 MCP_,分隔符 __
├── apps/ # FastMCP Apps UI(config_app:数据库/缓存配置管理面板)
├── auth/ # JWT 认证 + 权限
│ ├── config.py # AuthConfig(mode: tool/admin,从环境变量加载)
│ ├── context.py # 请求上下文(current_owner / visible_owners)
│ ├── decorator.py # @mcp_perm(resource, action) 权限装饰器
│ ├── discovery.py # get_entity_metadata / get_all_permissions(实体元数据缓存)
│ └── middleware.py # JWTAuthMiddleware(admin 模式时启用)
├── db/core.py # DBManager(异步 SQLAlchemy CRUD/分页)+ InfluxDBManager + 管理器缓存
├── error/exceptions.py # UniqueConflictError 等自定义异常
├── handlers/ # 业务逻辑层
│ ├── base_handlers.py # CodeResolveMixin — FK code→id 解析、占位自动创建
│ ├── add_handlers.py # 单条 + 批量插入(含价格冲突版本升级)
│ ├── delete_handlers.py # 注册表驱动的删除定位 + 孤儿标记
│ ├── update_handlers.py # 部分更新(None 字段跳过)
│ └── query_handlers.py # 分页、外键显示展开、异常待办聚合
├── models/
│ ├── orm/ # Base(id/created_at/updated_at/created_by + EnumInt)+ Product/ProductPrice
│ ├── pydantic/ # 动态 Filter/Search 生成器(builder.py)+ 实体请求/响应模型
│ └── schemas.py # 数据库/缓存配置 + 分页(PaginationParams/PageData)
├── tools/ # MCP 工具定义
│ ├── __init__.py # @global_tool 装饰器(配置类工具,Apps UI 可跨 App 调用)
│ ├── crud_factory.py # 注册表驱动生成 add/update/delete 工具(单条+批量)
│ ├── crud_tools.py # __all__ = register_crud_tools(globals()) —— 保持原样
│ ├── query_tools.py # 列表/搜索/枚举工具
│ ├── basic_tools.py # health、配置 CRUD、review_abnormal_items
│ ├── export_tools.py # CSV 导出示例工具(export_products_csv)
│ └── dict_tools.py # dict_meta 实体元数据工具
├── task/ # 通用后台任务包(TaskManager 生命周期 + TaskScheduler cron 调度)
└── utils/ # enums(BaseEnum/Errcode/领域枚举)、log、path_utils、common、
# rate_limiter(按 key 限速)、spill(大结果溢出)、cron、export(CSV)
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.
- 5d ago First seen · 176 lines · 2,642 tokens per session scan A 5ba9a559ca26
mcp-service-template AGENTS.md is an instructions file published in the GitHub repository RamidLab/mcp-service-template (0 stars, last pushed 10d ago), licensed MIT. It adds 2,642 tokens to every session, about $0.0132 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
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).
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.
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 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.