MCP Logic is a self-contained, multi-engine server for first-order logic reasoning that proves theorems, finds models, detects counterexamples, and manages knowledge bases through a session-based API.
Core Reasoning:
Theorem Proving: Prove logical statements using resolution-based proving with automatic or explicit engine selection (Prolog, SAT, Z3, Clingo)
Model Finding: Find finite models (up to domain size 25) that satisfy given premises
Counterexample Detection: Find models that refute conclusions to show they don't logically follow
Syntax Validation: Check formula syntax with detailed error messages
Category Theory: Verify categorical diagram commutativity and retrieve axioms for categories, functors, monoids, groups, rings, lattices, and more
Session Management:
Create/Delete Sessions: Build knowledge bases incrementally with configurable TTL (default 30 minutes)
Assert/Retract/List Premises: Add, remove, or view formulas in a session's knowledge base
Query Sessions: Prove goals from accumulated premises
Clear Sessions: Remove all premises while keeping the session active
Advanced Features:
Multi-Engine Architecture: Prolog (Horn clauses), SAT (propositional/finite domain), Z3 (SMT with arithmetic/quantifiers/equality), Clingo (ASP for non-monotonic reasoning)
Arithmetic & Equality: Built-in support for arithmetic predicates (lt, gt, plus, minus, times, divides) and equality reasoning with congruence
Proof Traces: Step-by-step derivation output for debugging and education
Axiom Libraries: Pre-built sets for Peano arithmetic, ZFC set theory, propositional tautologies, equivalence relations, and algebraic structures
Verbosity Control: Minimal, standard, or detailed output for token efficiency
Advanced Techniques: Tseitin transformation, CNF conversion, DIMACS export, symmetry breaking, iterative deepening
CLI Tools: Check engine status, prove theorems, find models, and interactive REPL
Logic Syntax:
First-Order Logic: Universal (
all x) and existential (exists x) quantifiers, connectives (->,<->,&,|,-)Prover9 Compatible: Standard Prover9 syntax with functions and predicates
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Logicprove that if all men are mortal and Socrates is a man, then Socrates is mortal"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Logic
A self-contained MCP server for first-order logic reasoning, implemented in TypeScript with no external binary dependencies.
Original: https://github.com/angrysky56/mcp-logic/
Feature Status
β = Implemented | π² = Planned | π¬ = Research/Vision
Core Reasoning
Theorem Proving β Resolution-based proving via Tau-Prolog
Model Finding β Finite model enumeration (domain β€25 with SAT)
Counterexample Detection β Find models refuting conclusions
Syntax Validation β Pre-validate formulas with detailed errors
CNF Clausification β Transform FOL to Conjunctive Normal Form
Tseitin Transformation β Linear-size CNF conversion for SAT (avoids exponential blowup)
DIMACS Export β Export CNF for external SAT solvers
Symmetry Breaking β Lex-leader for model search (reduces search space exponentially)
SAT-Backed Model Finding β Scale to domain 25+ with automatic SAT threshold
Isomorphism Filtering β Skip equivalent models (deferred until "findAllModels" use case)
Proof Traces β Step-by-step derivation output (via
include_trace)
Engine Federation
Multi-Engine Architecture β Automatic engine selection
Prolog Engine (Tau-Prolog) β Horn clauses, Datalog, equality
SAT Engine (MiniSat) β General FOL, non-Horn formulas
SMT Engine (Z3) β High-performance SMT solver with arithmetic & quantifiers
ASP Engine (Clingo) β Answer Set Programming (Constraints & Models)
Engine Parameter β Explicit engine selection via
engineparamIterative Deepening β Progressive inference limit strategy for complex proofs
Resource Management β Automatic cleanup of WASM resources (Z3 contexts)
Prover9 WASM β Optional high-power ATP (deferred until SAT+iterative proves insufficient)
Demodulation β Equational term rewriting (deferred until equality workloads show perf issues)
Logic Features
Arithmetic Support β Built-in:
lt,gt,plus,minus,times,dividesEquality Reasoning β Reflexivity, symmetry, transitivity, congruence
Rewriting System β Knuth-Bendix style term rewriting for efficient equality handling (Prolog)
Extended Axiom Library β Ring, field, lattice, equivalence relation axioms
Function Interpretation β Full function support in model finding
Typed/Sorted FOL β Domain-constraining type annotations (research)
Modal Logic β Necessity, possibility operators (research)
Probabilistic Logic β Weighted facts, Bayesian inference (research)
MCP Protocol
Session-Based Reasoning β Incremental knowledge base construction with resource cleanup
Axiom Resources β Browsable libraries (category, Peano, ZFC, ring, lattice, etc.)
Reasoning Prompts β Templates for proof patterns
Verbosity Control β
minimal/standard/detailedresponsesStructured Errors β Machine-readable error codes and suggestions
Streaming Progress β Real-time progress notifications (via MCP notifications)
High-Power Mode β Extended limits with warning (via
highPoweroption)
Advanced Engines
SMT (Z3 WASM) β Theory reasoning (arithmetic, arrays), Equality, Quantifiers.
ASP (Clingo) β Non-monotonic reasoning, defaults, preferences.
Neural-Guided β LLM-suggested proof paths with validation
Higher-Order Logic β Quantify over predicates (research)
Testing & Benchmarks
Unit Tests β 265+ tests passing, 80%+ coverage
Pelletier Problems β P1-P10 benchmark suite (extensible to P1-P75)
Symmetry Benchmarks β Bell number validation tests
SAT Model Tests β Group theory and algebraic structure verification
Resilience Tests β Resource leak detection and complexity limit verification
TPTP Library Subset β Standard ATP benchmarks
Quick Start
Installation
Running the Server
Verification
Run the comprehensive health check to verify build, tests, and engine availability:
Claude Desktop / MCP Client Configuration
Add to your MCP configuration:
CLI Tools
The package includes a CLI for offline usage and verification:
Available Tools
Core Reasoning Tools
Tool | Description |
prove | Prove statements using resolution with engine selection |
check-well-formed | Validate formula syntax with detailed errors |
find-model | Find finite models satisfying premises |
find-counterexample | Find counterexamples showing statements don't follow |
verify-commutativity | Generate FOL for categorical diagram commutativity |
get-category-axioms | Get axioms for category/functor/monoid/group |
translate-text | Translate natural language to FOL (requires LLM) |
Session Management Tools
Tool | Description |
create-session | Create a new reasoning session with TTL |
assert-premise | Add a formula to a session's knowledge base |
query-session | Query the accumulated KB with a goal |
retract-premise | Remove a specific premise from the KB |
list-premises | List all premises in a session |
clear-session | Clear all premises (keeps session alive) |
delete-session | Delete a session entirely |
Engine Selection
The prove tool supports automatic or explicit engine selection:
The include_trace option (boolean) enables step-by-step derivation output in the response, useful for debugging or understanding the proof path.
Engine | Best For | Capabilities |
| Horn clauses, Datalog | Equality, arithmetic, efficient unification |
| Propositional, Finite Domain | Boolean logic, CNF solving |
| General FOL, SMT | Arithmetic, Quantifiers, Equality |
| Answer Set Programming | Constraints (Experimental) |
| Default β selects based on formula | Analyzes clause structure & features |
Engine Capabilities
Engine | Strength | Arithmetic | Quantifiers | Equality | Model Size |
Z3 | High (SMT) | β | β | β | Large |
Clingo | High (ASP) | β | Limited | β | Large |
Prolog | Medium (Resolution) | β | Limited (Horn) | β | Small/Medium |
SAT | Low (Propositional) | β | β | β | Small |
Formula Syntax
This server uses first-order logic (FOL) syntax compatible with Prover9:
Quantifiers
all x (...)β Universal quantification (βx)exists x (...)β Existential quantification (βx)
Connectives
->β Implication (β)<->β Biconditional (β)&β Conjunction (β§)|β Disjunction (β¨)-β Negation (Β¬)
Examples
MCP Resources
Resource URI | Description |
| Category theory axioms |
| Monoid structure |
| Group axioms |
| Ring structure |
| Lattice structure |
| Equivalence relations |
| Peano arithmetic |
| ZFC set theory basics |
| Propositional tautologies |
| Aristotelian syllogism patterns |
| Available reasoning engines (JSON) |
Verbosity Control
All tools support a verbosity parameter:
Level | Description | Use Case |
| Just success/result | Token-efficient LLM chains |
| + message, bindings, engineUsed | Default balance |
| + Prolog program, statistics | Debugging |
Limitations (Current)
Model Size β Finder limited to domains β€25 elements (using SAT)
Inference Depth β Complex proofs may exceed default limit (increase via
inference_limitor useiterativestrategy)Higher-Order β Only first-order logic supported
Future improvements may address these limitations as real-world usage dictates.
Development
License
MIT
Future Directions
Potential enhancements will be driven by real-world usage:
Isomorphism Filtering β Skip equivalent models in exhaustive model enumeration
Proof Traces β Step-by-step derivation output for educational/debugging use cases
Demodulation β Equational term rewriting optimization for equality-heavy workloads
Streaming Progress β Real-time progress notifications for long-running operations
Extended Benchmarks β TPTP library subset and group theory problem suites
Advanced Engines β SMT (Z3), ASP (Clingo)
Evolution Engine β Genetic algorithm for evolving efficient proof strategies
Neural-Guided β LLM-suggested proof paths with validation
Troubleshooting
WASM Engines (Z3 / Clingo)
If you encounter errors related to z3-solver or clingo-wasm:
Ensure your environment supports WebAssembly.
In browser environments, ensure the
.wasmfiles are served correctly. Thecheckcommand can verify basic functionality in Node.js.If you see
OOMor memory errors, try running with the default engine (Prolog) or increasing the timeout/inference limits.
build:browser Failures
Ensure you have run npm install to get the latest type definitions. The browser build relies on specific overrides for WASM modules that are handled in src/engines/*/index.ts.