Prolog MCP Server

Prolog MCP Server

Enables LLMs to define Prolog facts and rules and execute queries via SWI-Prolog for logical reasoning.

Category
访问服务器

README

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

MCP Inspector Interface Prolog MCP Server running in MCP Inspector showing available tools and interface

Prerequisites

  • Python 3.8 or higher
  • Git (for installation from source)
  • Docker

Installation on linux

  1. Make sure git, python-venv and docker are installed, i.e. Install git
sudo apt install git python3.12-venv docker-buildx
  1. Clone git repo
git clone https://github.com/wendelinism/prolog-mcp-server.git

Move into newly downloaded folder

cd prolog-mcp-server/
  1. Create local python environment
python3 -m venv .

Activate local python environment

source bin/activate
  1. Install python package prolog-mcp-server, and all it's python dependencies
pip install -e .
  1. 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 $USER

To make this change effective, restart the terminal session with

exec su - $USER

then 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 Prolog-MCP-server connector Claude Desktop with connector to Prolog-MCP-server

Claude Desktop with avalable tools for 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:

To start standalone Prolog MCP server with http server:

python3 examples/demo_prolog_MCP-server-start_http.py

Test MCP-server with MCP inspector

To test a running MCP server with MCP inspector, first install npm:

sudo apt install npm -y

When MCP server is running with http transport, run in separate terminal:

fastmcp dev examples/demo_prolog_MCP-server-start_http.py

Follow 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选