Prolog Reasoner — Claude Code MCP server: what it does, how to install
Connects an SWI-Prolog solver to your coding assistant. Handles combinatorial search, constraint satisfaction, and multi-step inference.
claude mcp add prolog-reasoner -- uvx prolog-reasonerWhat Prolog Reasoner 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.
What it helps with
- 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 for the agent
- 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.
How to install Prolog Reasoner
Platform CLI
claude mcp add prolog-reasoner -- uvx prolog-reasoneruvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>
Platform CLI
codex mcp add prolog-reasoner -- uvx prolog-reasoneruvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>
Config file
{
"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>
Config file
{
"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>
Platform CLI
gemini mcp add prolog-reasoner uvx prolog-reasoneruvx runs the command named after the package; if the README names another one, use uvx --from prolog-reasoner <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Prolog Reasoner
How do I install Prolog Reasoner in Claude Code?
Run claude mcp add prolog-reasoner -- uvx prolog-reasoner. The tool will automatically register with your environment.
What does Prolog Reasoner do?
It provides an interface for LLMs to run SWI-Prolog code, evaluate logic queries, and parse output structures. It also lets you persist modular rule sets locally.
Does the MCP server require an OpenAI or Anthropic API key?
No, the server operates locally without LLM credentials. API tokens are only necessary if you run the standalone Python translation library.