Skip to main content
Glama

Prolog-MCP Server

A neurosymbolic AI server combining Prolog’s symbolic reasoning with Model Context Protocol (MCP) for hybrid AI applications.

Features:

  • Persistent Prolog session: maintain state between tool calls

  • Session management: save/load knowledge bases to disk

  • Four core tools:

    • loadProgram: Load Prolog predicates/rules

    • runPrologQuery: Execute complex logical queries

    • saveSession: Persist session state

    • loadSession: Restore previous sessions

  • Type safety via Zod schema validation for all I/O

  • WebAssembly runtime: Trealla Prolog in WASI environment

Integration with Cline/Roo/Copilot:

{
  "mcpServers": {
    "prolog-mcp": {
      "command": "node",
      "args": [
        "prolog-mcp/dist/index.js"
      ],
      "disabled": false,
      "alwaysAllow": [
        "loadProgram",
        "runPrologQuery",
        "saveSession",
        "loadSession"
      ],
      "timeout": 15
    }
  }
}

Development:

git clone https://github.com/adamrybinski/prolog-mcp
cd prolog-mcp
npm install
npm run build

Performance:

Operation

Avg. Latency

Memory Usage

Query Execution

12ms

18MB

Session Save

45ms

22MB

Program Load

8ms

15MB


Acknowledgements:
Built with Trealla Prolog and MCP Protocol

Available Tools

4 tools
loadProgramA

Loads Prolog program definitions that can be queried later

Inputs: program (required).

loadSessionB

Loads a previously saved Prolog session

Inputs: filename (required).

runPrologQueryA

Executes a Trealla Prolog query against loaded definitions

Inputs: query (required).

saveSessionA

Saves the current Prolog session to a file for later loading

Inputs: filename (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation4/5

    The tools are mostly distinct: loadProgram and loadSession both involve loading, but the former loads program definitions while the latter restores a full session. runPrologQuery and saveSession are clearly separate, and descriptions help disambiguate the two load operations.

    Naming Consistency5/5

    All tool names follow a consistent camelCase verb_noun pattern: loadProgram, runPrologQuery, saveSession, loadSession. The repeated 'load' verb is coherent for different loading operations.

    Tool Count5/5

    Four tools is a well-scoped, compact set for a Prolog server, covering the essential actions without redundancy or bloat.

    Completeness4/5

    The core workflow is fully supported: load programs, run queries, and persist/restore sessions. Minor gaps like session reset or program listing are absent, but they are not critical for the primary use case.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that enables Large Language Models to interactively create, edit, and solve constraint models using backends like MiniZinc, Z3, PySAT, and Clingo. It bridges natural language with symbolic reasoning for solving complex logical, SAT, SMT, and optimization problems.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server that gives LLMs access to formal verification via Z3 and SWI-Prolog, plus tree-sitter-based source code analysis. Translates natural language problems into formal logic using a template-based pipeline, verifies results with mathematical certainty, and analyzes call graphs for reachability, dead code, and impact analysis.
      205 npm
      219
      Apache 2.0
    • A
      license
      B
      quality
      B
      maintenance
      MCP server for logical reasoning that turns facts into formal proofs using a deterministic inference engine with Prolog.
      8
      66 PyPI
      9
      Apache 2.0