Skip to main content
Glama

rust-faf-mcp

无需再向每个 AI 会话重复解释你的项目。 一个 .faf 文件即可捕获你的项目 DNA。每个 AI 读取一次即可了解你正在构建的内容。

Crates.io Tests IANA License

用于 FAF 的 Rust 原生 MCP(模型上下文协议)服务器——以 YAML (application/vnd.faf+yaml) 格式提供结构化的 AI 项目上下文。单一二进制文件,stdio 传输,剥离后仅 4.3 MB。基于 rmcp 和 faf-rust-sdk 构建。

快速入门

cargo install rust-faf-mcp

然后将任何 MCP 客户端指向它:

# Claude Code
claude mcp add faf rust-faf-mcp
// WARP / Cursor / Zed / Claude Desktop — any stdio MCP client
{
  "mcpServers": {
    "faf": {
      "command": "rust-faf-mcp"
    }
  }
}

无需标志,无需配置文件,无需网络监听。纯 stdio JSON-RPC。

或者通过 Homebrew(macOS,预构建):

brew install Wolfe-Jam/faf/rust-faf-mcp

Related MCP server: gemini-faf-mcp

一条命令,永久搞定

faf_auto 会检测你的项目,创建 .faf 文件,将其增强至最高评分,并同步 CLAUDE.md —— 一步到位:

faf_auto complete
━━━━━━━━━━━━━━━━━
Score: 0% → 85% (+85) 🥈 Silver
Steps:
  1. Created project.faf
  2. Second enhancement pass
  3. Created CLAUDE.md

Path: /home/user/my-project

它生成的内容:

# project.faf — your project, machine-readable
faf_version: "3.3"
project:
  name: my-api
  goal: REST API for user management
  main_language: Rust
  version: "0.1.0"
  license: MIT
instant_context:
  what_building: REST API for user management
  tech_stack: Rust 2021
  key_files:
    - Cargo.toml
    - src/main.rs
    - README.md
  commands:
    build: cargo build
    test: cargo test
stack:
  backend: Rust
  build_tool: cargo

每个 AI 代理只需读取一次,就能准确了解你正在构建的内容。无需 20 分钟的入职培训,也不会产生错误的假设。

工具

创建与检测

工具

功能

faf_auto

一条命令实现 AI 上下文配置——初始化、增强、同步、评分,完成

faf_init

从 Cargo.toml、package.json、pyproject.toml 或 go.mod 创建或增强 project.faf

faf_git

从任何 GitHub 仓库 URL 生成 project.faf —— 无需克隆

faf_discover

向上遍历目录树以查找最近的 project.faf

评分与验证

工具

功能

faf_score

对 AI 就绪度进行 0-100% 评分,并提供字段级细分

faf_sync

同步 project.faf → CLAUDE.md(保留现有内容)

优化

工具

功能

faf_read

解析并显示 project.faf 内容

faf_compress

为 Token 受限的上下文压缩 .faf (minimal / standard / full)

faf_tokens

估算每个压缩级别的 Token 数量

faf_init 是迭代式的——再次运行它,它会填补缺失的内容。每次评分都会提高。

架构

src/
├── main.rs      # ~20 lines — tokio entry, rmcp stdio transport
├── server.rs    # FafServer: #[tool_router], ServerHandler, resources
└── tools.rs     # Business logic — all 9 tools, pure functions returning Value
  • 运行时: tokio 单线程 (current_thread)

  • HTTP: reqwest 异步(仅由 faf_git 用于 GitHub API)

  • SDK: faf-rust-sdk 1.3,用于解析、验证、压缩、发现

  • 服务器: rmcp 1.1,带有 #[tool_router] 宏 —— 处理 JSON-RPC、模式生成、传输

工具返回 serde_json::Value。服务器将其适配为 rmcp 的 IntoCallToolResult 所需的 Result<String, String>。

测试

跨 6 个文件的 112 项测试:

cargo test    # runs all 112

文件

测试数

覆盖率

mcp_protocol.rs

9

初始化握手、工具列表、资源、模式验证、ID 保留

tools_functional.rs

25

全部 9 个工具 —— 正常路径、错误路径、语言检测

tier1_security.rs

12

路径遍历、空字节、Shell 注入、超大输入、格式错误的 JSON

tier2_engine.rs

35

损坏的 YAML、同步替换、管道、双清单、遗留文件名、直接路径

tier3_edge_cases.rs

10

Unicode、CJK、评分边界、未知字段、GitHub URL 解析

tier4_aero.rs

21

清单结构、版本同步、server.json、清单-服务器交叉验证

测试将编译后的二进制文件作为子进程启动,并通过 stdin/stdout JSON-RPC 进行通信 —— 针对真实服务器的真正集成测试。

FAF 生态系统

一种格式,适配所有 AI 平台。

包

平台

注册表

rust-faf-mcp

Rust

crates.io

claude-faf-mcp

Anthropic

npm + MCP #2759

gemini-faf-mcp

Google

PyPI

grok-faf-mcp

xAI

npm

faf-cli

通用

npm

从源码构建

git clone https://github.com/Wolfe-Jam/rust-faf-mcp
cd rust-faf-mcp
cargo build --release
# Binary at target/release/rust-faf-mcp (4.3 MB)

版本: 2021 | LTO: 启用 | Strip: 符号

如果 rust-faf-mcp 对你有帮助,请考虑给仓库加星 —— 这有助于其他人发现它。

链接

许可证

MIT


由 @wolfe_jam 构建 | wolfejam.dev

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Persistent project context for Google Gemini. 12 MCP tools for .faf Project DNA — auto-detect your stack, validate, score, and sync across CLAUDE.md, GEMINI.md, and AGENTS.md. Python/FastMCP. IANA-registered format (application/vnd.faf+yaml). 183 tests. One file, every AI platform.
    13
    263 PyPI
    2
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Persistent project context MCP server that syncs a single .faf file to all AI tool formats (Cursor, Windsurf, Cline, etc.), enabling eternal bi-sync and optimized context for AI assistants.
    15
    617 npm
    7
    MIT