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/brianmacao/ai-mcp-server/agents-mdgit clone --depth 1 https://github.com/brianMacao/ai-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/brianmacao/ai-mcp-server/agents-md)<a href="https://agentmods.dev/instructions/brianmacao/ai-mcp-server/agents-md"><img src="https://agentmods.dev/badge/instructions/brianmacao/ai-mcp-server/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 | $0.03243 | $0.03243 |
| Opus 5 | $0.01622 | $0.01622 |
| Sonnet 5 | $0.00649 | $0.00649 |
| Haiku 4.5 | $0.00324 | $0.00324 |
Grade A, and why
ai-mcp-server 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 3d 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 — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Coding Assistant 協作指引
項目範圍
本倉庫只維護 ai-mcp-server:一個本地工具集合,包含三個獨立進程入口(MCP server stdio、CLI、
Web UI),把多個 (api_key, base_url) 收編成統一的能力池,讓 Agent 透過 MCP 查詢與調用各種模型
(chat / vision / reasoning / embedding / image_gen / tts / stt / rerank)。
- Python 包:
src/ai_mcp_server/ - CLI 入口:
ai-mcp(由pyproject.toml定義 entry point;含endpoint/model/meta/worker/ui子命令) - MCP server 入口:
ai-mcp-server(stdio 模式,被 Agent 客戶端拉起;啟動時內含背景 worker task) - Web UI 入口:
ai-mcp ui(FastAPI + Jinja2 + uvicorn;綁定127.0.0.1,無認證) - 本地數據:
~/.ai-mcp-server/db.sqlite3(WAL 模式),api_key 以 Fernet 加密儲存
新增工作默認限制在 src/ai_mcp_server/、tests/、assets/、docs/。不要新增無關 workspace
或包;舊文檔中的舊結構引用只作背景。
後端架構原則:解讀 X
本項目採「邏輯單一後端」:三個進程入口(MCP server / CLI / Web UI)不共享進程,但共享
同一份 application/* 業務邏輯與同一個 SQLite。
- 每個入口進程都
import ai_mcp_server.application.*直接 in-process 調業務函數。 - 不走 subprocess 反代、不走 HTTP 反代到「那個唯一後端」。
- 真相在 SQLite(WAL 模式 +
busy_timeout=5000支援多進程並發讀寫)。 - 探活異步化:UI / CLI / MCP 任一入口都可以 enqueue
probe_jobs;worker 由 MCP server 進程內背景 asyncio task 承擔,CLIendpoint probe也可同步消化 queue 至清空。
設計哲學
- 橋樑優先,不做攔截:MCP server 對上游 API 盡量原樣透傳;除了協議格式轉換與能力路由, 不對 messages、tool_calls、parameters 做業務語義改寫。
- KISS 版分層:Python 單體;分層用來讓代碼有清晰落點,不是引入厚重架構儀式。 先問落點:它代表 MCP tool 入口、用戶動作編排、能力解析、provider 防腐、儲存基礎能力, 還是純工具函數。
- 靜態優先、探活兜底:能力標籤先信靜態映射與第三方 metadata;探活只在用戶手動觸發時跑, 不在 server 啟動或 tool 調用路徑上偷偷打 API。
- 可追溯與可預測:不要隱藏錯誤或風險;上游 API 的錯誤原樣冒泡到 Agent,附帶足夠 context 讓 Agent 能決策重試或換模型。失敗可定位優先於表面成功率。
- 簡單但不混亂:能用簡單函數清楚表達的邏輯就保持簡單;一旦涉及跨 provider、跨能力路由 或多來源融合,必須回到清晰分層和可測邊界。
名詞與交付面
- MCP server:本倉庫主交付物,stdio 模式長駐進程,由 Agent 客戶端(Claude Desktop、 Cursor、Cline 等)按需拉起。
- MCP tool:暴露給 Agent 的 6 個 tool ——
usage_guide/list_models/invoke_model/model_performance/refresh_endpoint/add_models。 - endpoint:用戶登記的一組 (name, base_url, api_key, provider_type),代表一個上游 API。
- model:endpoint 下發現的單一模型,附帶 capabilities 標籤(vision / tool_call / context_length 等)。
- capability:模型能力標籤,融合來源有四:用戶覆寫 > 探活結果 > 第三方 metadata (LiteLLM)
內建靜態映射表。
- probe:能力探活,發最小 payload(內容統一用「1」)驗證模型在某能力上是否真實可用。
- provider adapter:協議防腐層,當前只有
OpenAICompatAdapter,Anthropic 預留接口。 - CLI:
ai-mcp命令,用於登記 endpoint、查詢模型、手動覆寫能力、觸發探活。
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.
- 3d ago First seen · 167 lines · 3,243 tokens per session scan A c8294838a1b7
ai-mcp-server AGENTS.md is an instructions file published in the GitHub repository brianMacao/ai-mcp-server (0 stars, last pushed 2mo ago), licensed MIT. It adds 3,243 tokens to every session, about $0.0162 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-09-01.
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.
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.
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.
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).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.