# Prolog Reasoner

Connects an SWI-Prolog solver to your coding assistant. Handles combinatorial search, constraint satisfaction, and multi-step inference.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 12
- Author: rikarazome
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/rikarazome/prolog-reasoner
- Updated: 2026-05-01
- HTML: https://affpapa.org/en/nevibecode/mcp/prolog-reasoner

## What it does

Language models regularly struggle with deterministic deduction and state searches. This server provides an external engine for those calculations. The model writes the facts, while the underlying Prolog runtime verifies constraints and computes exact answers.

The tool exposes `execute_prolog` alongside four functions for rule base management: `save_rule_base`, `list_rule_bases`, `get_rule_base`, and `delete_rule_base`. You can store fixed system rules under names between 1 and 64 characters to avoid pasting them repeatedly. It supports CLP(FD) constraint solving, negation-as-failure, and an optional execution proof trace.

Without SWI-Prolog 9.0 or newer on your system `PATH`, queries will fail to execute. The package also demands Python 3.10 or higher. Running the MCP server needs no API keys, as queries run locally on your machine.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add prolog-reasoner -- uvx prolog-reasoner
```
uvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>

### Codex

**Platform CLI**
```bash
codex mcp add prolog-reasoner -- uvx prolog-reasoner
```
uvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "prolog-reasoner": {
            "command": "uvx",
            "args": [
                "prolog-reasoner"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "prolog-reasoner": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "prolog-reasoner"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add prolog-reasoner uvx prolog-reasoner
```
uvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>

## When to use it
- solve constraint satisfaction problems with CLP(FD)
- run multi-step deterministic deduction without logic hallucinations
- store reusable domain axioms across multiple agent calls
- inspect execution traces to debug reasoning paths

## Example prompts
- Check if the schedule satisfies all constraints using SWI-Prolog.
- Store these piece movement rules under the name chess_moves.
- Run execute_prolog with query mortal(X) against the socrates rule base.

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [labelhead-artist-momentum](https://affpapa.org/en/nevibecode/mcp/labelhead-artist-momentum.md) — MCP server · ★ 107423
- [Agent Skills Search Server](https://affpapa.org/en/nevibecode/mcp/agent-skills-search-server.md) — MCP server · ★ 26559
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [PraisonAI](https://affpapa.org/en/nevibecode/mcp/praisonai.md) — MCP server · ★ 9289

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
