Skip to content

Repository files navigation

Clingo-MCP Server

A neurosymbolic AI server combining Clingo's Answer Set Programming (ASP) solver with Model Context Protocol (MCP) for hybrid AI applications.

Features:

  • Answer Set Programming solver via WebAssembly
  • In-memory program session: build up programs incrementally
  • Session management: save/load ASP programs to disk
  • Six core tools:
    • solve: Run an ASP program and get answer sets
    • addToProgram: Add facts/rules to current session
    • clearProgram: Clear the current session
    • getProgram: View the current program
    • saveSession: Persist program to disk
    • loadSession: Restore previous sessions
  • Type safety via Zod schema validation for all I/O
  • WebAssembly runtime: Clingo compiled to WASM

Integration with Cline/Roo/Copilot:

{
  "mcpServers": {
    "clingo-mcp": {
      "command": "npx",
      "args": ["clingo-mcp"],
      "disabled": false,
      "alwaysAllow": [
        "solve",
        "addToProgram",
        "clearProgram",
        "getProgram",
        "saveSession",
        "loadSession"
      ],
      "timeout": 30
    }
  }
}

Development:

git clone https://github.com/NewJerseyStyle/clingo-mcp
cd clingo-mcp
npm install
npm run build

Example ASP Program:

% Define persons
person(alice).
person(bob).
person(carol).

% Define friendships
friend(alice, bob).
friend(bob, carol).

% Rule: friendship is symmetric
friend(X, Y) :- friend(Y, X).

% Rule: transitive friendship
indirect_friend(X, Z) :- friend(X, Y), friend(Y, Z), X != Z.

Example Usage:

// Using the solve tool
const result = await solve({
  program: "a. b :- a. {c; d}.",
  models: 0  // 0 = all models
});

Acknowledgements: Built with clingo-wasm and MCP Protocol

About

No description or website provided.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Sponsor this project

Contributors

Languages