Prolog Reasoner logo

Prolog Reasoner

by rikarazome

Runs SWI-Prolog queries over MCP with constraints, recursion, negation, and reusable rule bases.

Install Prolog Reasoner

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "rikarazome-prolog-reasoner": {
      "command": "uvx",
      "args": [
        "prolog-reasoner"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Automated check passed— started and listed 5 tools correctly (1mo ago).

Overview

The rikarazome/prolog-reasoner MCP server exposes SWI-Prolog as a logic execution tool for LLM clients. It accepts facts, rules, and a query, then returns matching solutions with execution metadata and structured errors. Saved rule bases let agents reuse stable domain rules across calls, while CLP(FD), recursion, negation-as-failure, and standard SWI-Prolog features support constraint and multi-step reasoning. Use it when an agent needs inspectable, repeatable Prolog-based reasoning rather than relying only on natural-language inference.

Use cases

  • Solve constraint-satisfaction problems with CLP(FD)
  • Run recursive multi-step inference over explicit facts
  • Reuse domain rules through named rule bases
  • Inspect Prolog queries and structured execution errors

Key features

  • SWI-Prolog execution over MCP
  • CLP(FD) constraint support
  • Negation-as-failure and recursion
  • Reusable named rule bases
  • Optional structured proof tracing
  • Structured results and error metadata

Tools5

What Prolog Reasoner lets your agent do. Expand a tool for its parameters.

Verified live~552 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

7/12 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 9d ago via OSV.dev · prolog-reasoner (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars12Stargazers on the source repository.
Last commit6mo agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed5Callable tools this server registers over MCP.
Directory activity4 viewsConfig copies, upvotes, and views on AllMCPs.

How Prolog Reasoner works

What rikarazome/prolog-reasoner MCP server does

The rikarazome/prolog-reasoner MCP server lets an MCP client submit SWI-Prolog facts and rules together with a query. The main execution tool returns the resulting solutions, whether execution succeeded, and metadata such as elapsed time, result count, truncation status, and the rule bases used. Prolog source remains visible as the intermediate representation, so an agent or developer can inspect and revise the logic before running it again.

The server also provides named rule bases for reusable knowledge. A rule base can hold stable domain rules, while each execution call supplies only the situation-specific facts. Rule bases can be listed, read, saved, overwritten, or deleted. Leading comments containing description and tag metadata are used when listing them.

How it works

An execute_prolog call accepts prolog_code and query, with optional rule-base names, a maximum result count, and proof tracing. Selected rule bases are loaded before the supplied code. The query runs through SWI-Prolog, including support for constraint logic programming over finite domains, negation-as-failure, recursion, and other standard SWI-Prolog behavior.

Results are returned as JSON-like data with output and query fields. Successful calls include execution metadata. Failed calls include an error category and a natural-language explanation; documented categories include syntax, undefined predicate, unbound variable, type, domain, evaluation, permission, timeout, and trace-related errors. Proof tracing is optional and adds a structured proof tree, but it does not support CLP(FD), higher-order predicates, or assert/retract.

Setup and configuration

Install the Python package with pip install prolog-reasoner, and make sure SWI-Prolog 9.0 or newer is installed and available on the system PATH. The MCP server itself does not require an OpenAI or Anthropic API key. Those providers apply to the separate library-mode natural-language-to-Prolog pipeline.

Claude Desktop can launch the server through uvx with the prolog-reasoner package, or through the installed prolog-reasoner executable. Docker is also documented as an option that bundles SWI-Prolog. The server requires Python 3.10 or newer when installed as the Python package.

Rule files are stored under ~/.prolog-reasoner/rules/ by default. The directory can be changed with PROLOG_REASONER_RULES_DIR; bundled rule content can be supplied through BUNDLED_RULES_DIR. Rule-base names may contain lowercase letters, numbers, underscores, and hyphens, and must be between one and 64 characters.

Tools and capabilities

The rikarazome/prolog-reasoner MCP server exposes these tools:

  • execute_prolog: Run supplied Prolog code and a query, optionally loading named rule bases and limiting returned solutions.
  • list_rule_bases: List saved rule bases alphabetically with descriptions and tags.
  • get_rule_base: Retrieve the raw source for a named rule base.
  • save_rule_base: Validate and store a named rule base for later calls.
  • delete_rule_base: Remove a saved rule base.

Saved content is parse-validated before writing, and oversized rule bases are rejected. The separate Python library also includes direct Prolog execution and an LLM-dependent translation pipeline, but those library features are not required for MCP use.

Limitations and notes

The rikarazome/prolog-reasoner MCP server executes Prolog supplied by the connected client; it does not translate natural language or call an external LLM as part of the MCP server. The client must formulate the facts, rules, and query. Returned solutions are capped at 100 by default and may be truncated when more results exist. Proof tracing has feature restrictions and performance overhead. The server also depends on a local SWI-Prolog installation unless run through the documented Docker setup.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Prolog Reasoner

Install the package with pip, ensure SWI-Prolog 9.0 or newer is on PATH, and configure an MCP client to run `uvx prolog-reasoner` or the installed `prolog-reasoner` executable.

Yes.

No API key is required for the MCP server. OpenAI or Anthropic credentials are needed only for the separate library-mode natural-language-to-Prolog pipeline.

Save the rules with `save_rule_base`, then pass the saved name in the `rule_bases` option of `execute_prolog`. Use the other rule-base tools to list, retrieve, or delete saved content.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewProlog Reasoner AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/rikarazome-prolog-reasoner?style=directory)](https://allmcps.com/mcp/rikarazome-prolog-reasoner)
HTML Embed
<a href="https://allmcps.com/mcp/rikarazome-prolog-reasoner"><img src="https://allmcps.com/api/badge/rikarazome-prolog-reasoner?style=directory" alt="Prolog Reasoner on AllMCPs" /></a>