ai-mcp-server AGENTS.md

ai-mcp-server AGENTS.md is an instructions file for Codex, OpenCode from brianMacao/ai-mcp-server. It costs 3,243 tokens per session, scanned A, original, MIT.

Repository-specific instructions for ai-mcp-server, a local tool collection that lets agents query and call different AI models through one system.

In plain words
What is it for?
Use them when changing ai-mcp-server so edits follow its project boundaries, backend design, storage rules, and delivery conventions.
Why use it?
They tell coding assistants which parts of the repository are in scope and how its command-line tool, web interface, MCP server, application logic, and local database are expected to work together.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/brianmacao/ai-mcp-server/agents-md
Clone the repo
git clone --depth 1 https://github.com/brianMacao/ai-mcp-server

Made for: Codex, OpenCode.

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 ai-mcp-server AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/brianmacao/ai-mcp-server/agents-md.svg)](https://agentmods.dev/instructions/brianmacao/ai-mcp-server/agents-md)
Your own site
<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>
Per session 3,243 This file is loaded in full into every session.
When invoked 3,243 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.03243 $0.03243
Opus 5 $0.01622 $0.01622
Sonnet 5 $0.00649 $0.00649
Haiku 4.5 $0.00324 $0.00324

Measured 3d ago against content hash c8294838a1b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

AGENTS.md · 167 lines

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 承擔,CLI endpoint 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 預留接口。
  • CLIai-mcp 命令,用於登記 endpoint、查詢模型、手動覆寫能力、觸發探活。

Read the full file on GitHub · 167 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. 3d ago First seen · 167 lines · 3,243 tokens per session scan A c8294838a1b7

Subscribe to this mod's changes

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.

Related

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).

microsoft/vscode · 6,785 tokens

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.

github/spec-kit · 7,104 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,182 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,345 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

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.

vercel/next.js · 7,296 tokens