MCP-Logic
MCP-Logic
一个用于使用 Prover9 和 Mace4 进行自动一阶逻辑推理的 MCP 服务器。
功能特性
定理证明 - 使用 Prover9 证明逻辑陈述
模型查找 - 使用 Mace4 查找有限模型
反例查找 - 展示陈述为何不成立
语法验证 - 通过有用的错误消息预先验证公式
范畴推理 - 内置对范畴论证明的支持
命题偶然性 - 用于快速命题检查的纯分析性 HCC 证明器
溯因推理 - 使用变分自由能 (VFE) 对假设进行排序
自包含 - 所有依赖项自动安装
Related MCP server: warrant-mcp
快速入门
安装
Linux/macOS:
git clone https://github.com/angrysky56/mcp-logic
cd mcp-logic
./linux-setup-script.shWindows:
git clone https://github.com/angrysky56/mcp-logic
cd mcp-logic
windows-setup-mcp-logic.bat安装脚本会自动:
下载并构建 LADR (Prover9 + Mace4)
创建 Python 虚拟环境
安装所有依赖项
生成 Claude Desktop 配置
Claude Desktop 集成
添加到您的 Claude Desktop MCP 配置中(在 claude-app-config.json 中自动生成):
{
"mcpServers": {
"mcp-logic": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-logic/src/mcp_logic",
"run",
"mcp_logic",
"--prover-path",
"/absolute/path/to/mcp-logic/ladr/bin"
]
}
}
}重要提示: 请将 /absolute/path/to/mcp-logic 替换为您实际的仓库路径。
可用工具
工具 | 用途 |
prove | 使用 Prover9 证明陈述 |
check-well-formed | 验证公式语法并提供详细错误信息 |
find_model | 查找满足前提的有限模型 |
find_counterexample | 查找证明陈述不成立的反例 |
verify_commutativity | 为范畴图交换性生成 FOL |
get_category_axioms | 获取范畴/函子/群/幺半群的公理 |
check_contingency | 通过 HCC 证明器检查真值函数偶然性 |
abductive_explain | 为观察结果查找最小化 VFE 的解释 |
使用示例
证明定理
Use the mcp-logic prove tool with:
premises: ["all x (man(x) -> mortal(x))", "man(socrates)"]
conclusion: "mortal(socrates)"结果: ✓ 定理已证明
分析命题偶然性
Use the mcp-logic check_contingency tool with:
formula: "(p -> q) | (q -> p)"结果: 识别出该公式为非偶然的重言式,并返回证明轨迹。
查找反例
Use the mcp-logic find-counterexample tool with:
premises: ["P(a)"]
conclusion: "P(b)"结果: 找到一个模型,其中 P(a) 为真但 P(b) 为假,证明结论不成立。
验证范畴图
Use the mcp-logic verify-commutativity tool with:
path_a: ["f", "g"]
path_b: ["h"]
object_start: "A"
object_end: "C"结果: 用于证明 f∘g = h 的 FOL 前提和结论。
本地运行
不使用 Claude Desktop,直接运行服务器:
Linux/macOS:
./run_mcp_logic.shWindows:
run_mcp_logic.bat项目结构
mcp-logic/
├── src/mcp_logic/
│ ├── server.py # Main MCP server (8 tools)
│ ├── mace4_wrapper.py # Mace4 model finder
│ ├── syntax_validator.py # Formula syntax validation
│ ├── categorical_helpers.py # Category theory utilities
│ ├── hcc_prover.py # Hypersequent Contingency Calculus prover
│ ├── vfe_engine.py # Variational Free Energy abductive engine
│ └── formula_ast.py # Propositional logic AST and parser
├── ladr/ # Auto-installed Prover9/Mace4 binaries
│ └── bin/
│ ├── prover9
│ └── mace4
├── tests/ # Test suite
├── linux-setup-script.sh # Linux/macOS setup
├── windows-setup-mcp-logic.bat # Windows setup
├── run_mcp_logic.sh # Linux/macOS run script
└── run_mcp_logic.bat # Windows run scriptv0.3.0 更新内容
认知架构增强:
✅ 超序列偶然性演算 (HCC): 增加了一个严谨的演绎检查器,无需暴力建模即可即时评估命题公式的偶然性。
✅ 变分自由能 (VFE) 引擎: 实现了溯因推理,使用非教条的 Cournot-Gaifman 先验对假设进行排序,以优雅地满足奥卡姆剃刀原则。
✅ 智能证明器路由:
prove工具会自动将纯命题查询路由到 HCC 引擎,将一阶查询路由到 Prover9。✅ 可配置模型查找器:
find_model和find_counterexample现在支持自定义超时和结构化谓词/函数提取。
v0.2.0 更新内容
增强功能:
✅ Mace4 模型查找和反例检测
✅ 带有位置特定错误的详细语法验证
✅ 范畴推理支持(范畴论公理、交换性验证)
✅ 所有工具的结构化 JSON 输出
✅ 自包含安装(无需手动路径配置)
开发
运行测试:
source .venv/bin/activate
pytest tests/ -v直接测试组件:
python tests/test_enhancements.py文档
ENHANCEMENTS.md- v0.2.0 功能快速参考Documents/- 详细分析和示例walkthrough.md- 实现细节(在工件中)
故障排除
“Prover9 not found” 错误:
运行安装脚本:
./linux-setup-script.sh或windows-setup-mcp-logic.bat检查
ladr/bin/prover9和ladr/bin/mace4是否存在
服务器未更新:
代码更改后重启服务器
检查日志中的语法错误
语法验证警告:
谓词/函数请使用小写(例如
man(x)而不是Man(x))在运算符周围添加空格以提高清晰度
确保所有括号匹配
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server for the Pyke logic programming engine that enables LLMs to perform logical reasoning using knowledge bases with facts, rules, and queries. It supports session management, forward chaining inference, and bulk loading of programs in Logic-LLM format.MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides formal reasoning and argument validation tools for AI agents based on established computational argumentation theories. It enables structured argument analysis, defeasible reasoning, and dialogue management using frameworks like Dung, Toulmin, and Walton's schemes.
- AlicenseAqualityDmaintenanceMCP server that gives small LLMs verified symbolic-math & logic tools.62Apache 2.0
- AlicenseAqualityCmaintenanceAn MCP server for first-order logic theorem proving supporting multiple provers like Vampire, E, and Prover9, with built-in simple prover, session management, and TPTP export.131MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for AI dialogue using various LLM models via AceDataCloud
An MCP server that integrates with Discord to provide AI-powered features.
Appeared in Searches
- A server for finding information about Chinese metaphysics and mysticism
- Comparison of Python-based tools for converting TeX to Lean
- Tools for Converting LaTeX Mathematics to Lean Formalizations
- Recommended helper server for automating TeX to Lean conversions in GRAD-5 repository
- Tools and Systems for Math, AI, and Proof Verification with Bug Detection and Auto Fixing
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/angrysky56/mcp-logic'
If you have feedback or need assistance with the MCP directory API, please join our Discord server