Deterministic logical reasoning engine β facts in Euclid IR, solutions with proof trees
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
MCP server for logical reasoning β turns facts into formal proofs.
Euclid-MCP is a hybrid cognitive architecture: a lightweight LLM describes the world in facts, and a deterministic engine performs the actual deduction. The LLM never needs to reason β it only needs to describe.
With Euclid-MCP, an 8B model can solve reasoning tasks that stump even 400B+ cloud models β because the engine handles deduction deterministically. Every answer comes with a proof tree, so you can trace why a conclusion holds, not just what it is. Use it to enforce RBAC policies, audit cloud compliance, validate loan eligibility rules, or reason over any domain where answers must be explainable and verifiable.
Euclid-MCP is written in Python and uses Euclid-IR, a human-readable intermediate language designed for both AI agents and humans. It uses SWI-Prolog as its primary inference engine β and, where SWI-Prolog is not available (e.g. minimal containers), a pure-Python native engine that interprets Euclid-IR directly (see docs/NATIVE_ENGINE.md).
It can be consumed in multiple ways: via MCP by AI agents (OpenCode, Claude, Cursor), via HTTP by tools and automation platforms (n8n, Zapier, Make), and via Python API for direct integration. Euclid-IR rules can also be used to augment RAG pipelines with deterministic policy enforcement.
Additional tools (explain, diagnose, what_if, check_kb) extend this core flow with natural-language explanations, analysis, scenario testing, and validation.
LLMs describe. Euclid MCP proves.
For small knowledge bases, facts and rules can be provided with each request.
A knowledge base can be loaded at server startup and reused across calls, so agents only pass the session-specific facts for the current query. This minimizes token usage, improves performance, and allows small LLMs to reason over large rule sets without reconstructing the entire knowledge base for every request.
Even if currently Euclid-MCP uses a Prolog Engine, no Prolog syntax is required.
Euclid-IR (Intermediate Representation) is a declarative intermediate representation for logical inference.
Variables use $name, implication is IF, conjunction is AND.
Text format:
YAML format:
Full language reference: docs/EUCLID_IR.md
| Element | Syntax | Example |
|---|---|---|
| Facts | predicate(args) | parent(tom, bob) |
| Variables | $name (lowercase) | $who, $x, $count |
| Implication | IF | mortal($x) IF human($x) |
| Conjunction | AND | p($x) AND q($x) |
| Negation | NOT | NOT active($user) |
| Boolean literals | true / false in rule bodies | merchant($m) IF false |
| Query | ? predicate | ? ancestor(tom, $who) |
| String literals | "..." or '...' | "alice@example.com" |
| Multi-line rules | Body on next line | rule($x) IF\n body($x) |
Rules support arithmetic comparisons that are evaluated during deduction:
Supported operators: >, >=, <, <=, ==, is, !=
Rules can span multiple lines for readability:
Queries can combine multiple predicates:
This returns solutions where both conditions are satisfied simultaneously.
The external inference gives several advantages:
In the current implementation Euclid-MCP uses Prolog.
Prolog is a 50-year-old battle-tested logic engine. Using it as a "deduction coprocessor" lets small LLMs perform complex multi-step reasoning without needing larger, more expensive models. The intermediate language strips away Prolog's syntax quirks while keeping its logical core.
A specific benchmark demonstrate the difference: with 1 000+ facts, LLMs alone score 2/5 while Euclid-MCP scores 5/5 β and runs 7Γ faster while outputting 14Γ fewer tokens.
Euclid-MCP exposes 8 tools, each with a specific purpose:
| Tool | Purpose |
|---|---|
reason | Main deduction β get solutions + proof trees |
explain | Readable, natural-language reasoning steps |
diagnose | Understand why a query succeeds or fails |
what_if | Test modifications before applying them |
check_kb | Validate KB consistency before reasoning |
register_kb | Register a named KB under a kb_id |
unregister_kb | Remove a named KB from the registry |
list_kbs | List registered named KBs (metadata) |
reasonMain tool for verifiable deterministic reasoning.
| Parameter | Type | Default | Description |
|---|---|---|---|
knowledge | string? | β | Facts & rules in text or YAML format |
kb_id | string? | β | Reference a KB registered via register_kb |
delta_knowledge | string? | β | Session-specific facts appended to the kb_id base |
query | string? | β | Override query (optional) |
max_solutions | int | 5 | Max solutions to return |
max_depth | int | 30 | Max proof tree depth |
Returns ReasonResult with solutions[] β each containing variable bindings and a proof tree.
explainDeterministic proof-tree β natural-language reasoning steps. No LLM involved: it
walks the proof tree of each solution and renders every step in plain language,
citing the rule ID (# RULE: <id>) when a rule has one. Use it to turn a proof
into an auditable, human-readable explanation.
| Parameter | Type | Default | Description |
|---|---|---|---|
knowledge | string? | β | Facts & rules in text or YAML format |
kb_id | string? | β | Reference a KB registered via register_kb |
delta_knowledge | string? | β | Session-specific facts appended to the kb_id base |
query | string? | β | Override query (optional) |
max_solutions | int | 5 | Max solutions to return |
max_depth | int | 30 | Max proof tree depth |
Returns ExplanationResult with explanations[] β each containing variable
bindings, an ordered list of natural-language steps, and language-independent
structured_steps (typed kind/goal/rule_id/body, ready for localized
rendering in a UI).
diagnoseQuery analysis β understand why a query succeeds or fails.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/euclid-mcp-2)<a href="https://allmcps.com/mcp/euclid-mcp-2"><img src="https://allmcps.com/api/badge/euclid-mcp-2?style=directory" alt="Euclid MCP on AllMCPs" /></a>