SF

sysprog21/frama-c-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

36 stars 4 forks 质量 73 趋势 32MIT

为AI代理提供Frama-C:EVA、WP和沙箱ACSL迭代的MCP服务器

概览

一个MCP服务器,为AI代理提供Frama-C:EVA抽象解释、WP演绎证明、ACSL注释注入以及用于尝试注释的隔离沙盒。 服务器设计为由代理而非人操作。MCP客户端生成并通过stdio与之通信,因此没有人工输入命令。它围绕迭代循环构建:提出注释,证明,读取目标未关闭原因,然后修改。会话状态源自该循环,而非shell使用,因为一个项目在调用间保持加载状态,沙盒按名称命名,证明收据仅在一次运行中比较。 将其连接到 Claude Code、Claude Desktop 或任何 MCP 客户端,然后用英文提示。参见“连接代理”和“提示模式”。CI 存在一个检查子命令,是唯一设计为手动运行的部分。

概述(AI 翻译)

一个提供AI代理的MCP服务器 Frama-C:舱外活动抽象解释,WP演绎 证明、ACSL注释注入以及用于尝试注释的孤立沙盒 出去。

服务器设计为由代理而非个人驱动。MCP 客户端生成它并通过 stdio 与它对话,所以没有针对人类的命令 输入类型。它围绕一个迭代循环构建:提出注释,证明它, 先阅读目标未关闭的原因,然后进行修订。会话状态由以下 这是循环,而不是从shell使用中获得,因为一个项目会一直加载 电话、沙盒地址均以姓名标注,且凭证收据只在内部进行比对 跑步。

把它连接到Claude Code、Claude Desktop或任何MCP客户端,然后提示输入 英文。参见“连接代理人”和 提示模式。CI 存在一个 check 子命令,且是 这是唯一设计用于手动操作的部分。

建筑

服务器包含两个必需组件:

  • Rust MCP 服务器:通过 MCP 标准部署工具,将请求转换为 Frama-C 的服务器协议,并懒惰地启动主 Frama-C 进程 第一次项目运营。
  • ast-utils Frama-C 插件:提供自定义的 AST 访问请求,

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

frama-c-mcp

An MCP server that gives an AI agent Frama-C: EVA abstract interpretation, WP deductive proof, ACSL annotation injection, and isolated sandboxes for trying annotations out.

The server is designed to be driven by an agent rather than by a person. An MCP client spawns it and speaks to it over stdio, so there is no command for a human to type. It is built around an iterative loop: propose an annotation, prove it, read why the goal did not close, then revise. The session state follows from that loop rather than from shell use, since one project stays loaded across calls, sandboxes are addressed by name, and proof receipts compare only within a run.

Wire it into Claude Code, Claude Desktop, or any MCP client, then prompt in English. See Connect an agent and Prompt patterns. A check subcommand exists for CI and is the only part intended to be run by hand.

Architecture

┌──────────┐  MCP over stdio   ┌────────────────┐  Unix socket  ┌─────────────────┐
│ AI agent │◄─────────────────►│ frama-c-mcp    │◄─────────────►│ Frama-C main    │
└──────────┘                   │ Rust server    │               │ + ast-utils     │
                               └───────┬────────┘               └─────────────────┘
                                       │ Unix socket per sandbox
                                       ▼
                               ┌──────────────────┐
                               │ Frama-C sandbox  │
                               │ + ast-utils      │
                               │  per experiment  │
                               └──────────────────┘

The server has two required components:

  • Rust MCP server: exposes the tools over MCP stdio, translates requests into Frama-C’s server protocol, and lazily starts the main Frama-C process on the first project operation.
  • ast-utils Frama-C plugin: provides the custom requests for AST access, dependency extraction, ACSL injection, sandboxing, and WP configuration. Build and install it in the same opam switch as Frama-C.

create_sandbox extracts a function together with its type, callee, and global dependencies into a temporary C file, then starts a separate Frama-C process. An agent can iterate on annotations there without mutating the main project; verified sandbox annotations are merged back explicitly.

Session model

The server holds one project: reload_project or the first check loads it, and later calls operate on that AST. Sandboxes are separate processes, addressed as experiment_id:function.

The preprocessor surface is nostdinc, include_paths, isystem_paths, defines, force_includes, and machdep, applied in that order. Each value is written without its compiler flag. nostdinc drops the preprocessor’s default system directories and isystem_paths are searched after include_paths; pair

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "frama-c": { "command": "/path/to/frama-c-mcp", "args": ["--frama-c", "/path/to/frama-c"] } } }