Prolog MCP Server
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., "@Prolog MCP ServerAdd facts: parent(john, mike). Query: who are mike's parents?"
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.
Prolog MCP Server
A Model Context Protocol (MCP) server that enables direct integration between Large Language Models and SWI-Prolog. This server allows LLMs to define Prolog facts and rules (clauses) and to execute Prolog queries and leverage logical reasoning capabilities.
Features
Allow LLMs to add facts and rules (clauses) to SWI Prolog server
Execute Prolog queries through MCP protocol
Support for both HTTP and stdio transport
Docker containerization support for the SWI Prolog server
Implemented as python package for easy integration to agentic LLM applications
Compatible with MCP Inspector for interactive testing and debugging
Prolog MCP Server running in MCP Inspector showing available tools and interface
Related MCP server: Logic-LM MCP Server
Prerequisites
Python 3.8 or higher
Git (for installation from source)
Docker
Installation on linux
Make sure git, python-venv and docker are installed, i.e. Install git
sudo apt install git python3.12-venv docker-buildxClone git repo
git clone https://github.com/wendelinism/prolog-mcp-server.gitMove into newly downloaded folder
cd prolog-mcp-server/Create local python environment
python3 -m venv .Activate local python environment
source bin/activateInstall python package prolog-mcp-server, and all it's python dependencies
pip install -e .Build prolog docker image (without this the MCP-server will have no prolog server to connect to)
docker buildx build -t prolog-docker-image -f docker/prolog.dockerfile .In case your user does not have permission yet to interact with docker, add local user to docker group:
sudo usermod -aG docker $USERTo make this change effective, restart the terminal session with
exec su - $USERthen go back to the project folder. Now you should be able to build the docker image.
Installation on Windows and Mac
Should work on windows and Mac OS as well, but not tested yet.
Usage
Integration with Claude Desktop
Claude Desktop with connector to Prolog-MCP-server
Claude Desktop can choose to use any of the tools shown for connected Prolog-MCP-server
If Claude Desktop is installed, the Prolog MCP server can be added to the Claude config, so that Claude can start a local instance of the server and run prolog code directly. Preconditions:
Local clone of prolog-mcp-server repository (see above)
Local python environment installed (see above)
Docker prolog-docker-image built (see above)
Configuration
Add the following configuration to your claude_desktop_config.json file:
Linux/Mac: ~/.config/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"prolog-mcp-server": {
"command": "/path/to/python-env/bin/python",
"args": [
"/path/to/prolog-mcp-server/src/prolog_mcp_server.py",
"--transport=stdio"
],
"env": {
"PATH": "/path/to/python-env/bin:/usr/local/bin:/usr/bin:/bin"
}
}
}
}Note: Update both
/path/to/python-env/and/path/to/prolog-mcp-server/to match your actual installation paths.
Starting the Standalone Server with HTTP
For HTTP transport setup, see the the minimal example implemenation to start the standalone Prolg MCP server at HTTP transport implementation.
Examples for HTTP and stdio usage
Check the examples/ directory for:
Demo Standalone Prolog MCP server using HTTP transport, detectable for MCP clients
Demo MCP client implementation with Prolog MCP server invoked, using stdio transport, starting prolog, adding clauses, running query
To start standalone Prolog MCP server with http server:
python3 examples/demo_prolog_MCP-server-start_http.pyTest MCP-server with MCP inspector
To test a running MCP server with MCP inspector, first install npm:
sudo apt install npm -yWhen MCP server is running with http transport, run in separate terminal:
fastmcp dev examples/demo_prolog_MCP-server-start_http.pyFollow link to MCP inspector with prefilled token. In the web interface make sure to adjust transport type ("Streamable HTTP") and URL ("http://localhost:8000/mcp") Hit connect, for test you should be able to go to "tools" now, and there "list tools"
Docker Support
A Dockerfile is provided in the docker/ directory for containerized deployment.
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome. Feel free to submit issues and pull requests.
Credits
This MCP server relies on SWI-Prolog, an open-source Prolog implementation. All credits for the actual Prolog implementation go to the SWI-Prolog development team.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceThis server lets tools-enabled LLMs work directly with SWI‑Prolog. It supports loading Prolog files, adding/removing facts and rules, listing symbols, and running queries with two modes: deterministic pagination and true engine backtracking.Last updated379BSD 3-Clause
- Alicense-qualityFmaintenanceProvides symbolic reasoning capabilities by converting natural language logical problems into Answer Set Programming (ASP) format and solving them using the Clingo solver. Enables users to perform formal logical reasoning, verify logical arguments, and get step-by-step explanations for complex logical problems.Last updated5MIT
- AlicenseAqualityDmaintenanceSWI-Prolog execution for LLMs with CLP(FD) and recursion — boosts logic/constraint accuracy from 73% to 90% on a 30-problem benchmark.Last updated510MIT
- AlicenseAqualityCmaintenanceEnables constraint solving, logical reasoning, and satisfiability checking using the Z3 theorem prover via natural language.Last updated131MIT
Related MCP Connectors
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Local-first RAG engine with MCP server for AI agent integration.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wendelinism/prolog-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server