Skip to content
Back to search

smcdel-mcp

Dynamic Epistemic Logic for your LLM. An MCP server for SMCDEL.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/jrclogic--smcdel-mcp/badge.svg)](/listings/jrclogic--smcdel-mcp)

HTML

<a href="/listings/jrclogic--smcdel-mcp"><img src="/api/listings/jrclogic--smcdel-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 136 lines
  1. # smcdel-mcp
  2. A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes
  3. the [SMCDEL](https://github.com/jrclogic/SMCDEL) symbolic model checker for
  4. Dynamic Epistemic Logic as tools, in the same way the SMCDEL web interface does.
  5. The server offers one tool per SMCDEL query:
  6. | Tool | SMCDEL command | Arguments | Result |
  7. |----------------|----------------|----------------------------------------|------------------------------------------|
  8. | `smcdel_true` | `TRUE?` | `structure`, `state`, `formula` | whether the formula holds at the state |
  9. | `smcdel_valid` | `VALID?` | `structure`, `formula` | whether the formula holds at all states |
  10. | `smcdel_where` | `WHERE?` | `structure`, `formula`, `maxStates` | the states where the formula holds |
  11. `structure` is the knowledge structure in SMCDEL syntax, i.e. the `VARS`, `LAW`
  12. and `OBS` block of an `.smcdel.txt` file. `formula` uses the same syntax as the
  13. queries in such a file. `state` is the list of true atomic propositions.
  14. `UPDATE!` is not supported; every call is self-contained and the server keeps
  15. no sessions.
  16. The `initialize` response carries a short primer on the SMCDEL syntax in its
  17. `instructions` field, and every tool has a JSON input and output schema.
  18. Syntax errors, failed sanity checks and SMCDEL runtime errors are reported as
  19. tool results with `isError: true` so that a model can correct its input.
  20. ## Building and running
  21. ```sh
  22. stack build
  23. stack exec smcdel-mcp # Streamable HTTP
  24. stack exec -- smcdel-mcp --stdio # stdio
  25. ```
  26. Use `stack install` to copy the executable to `~/.local/bin`, which is the
  27. easiest way to let an MCP client start it.
  28. Over HTTP the server listens on `http://127.0.0.1:3000/mcp` by default. It is
  29. configured through environment variables:
  30. | Variable | Default | Meaning |
  31. |------------------|-------------|------------------------------------------|
  32. | `PORT` | `3000` | TCP port (HTTP only) |
  33. | `HOST` | `127.0.0.1` | interface to bind to (HTTP only) |
  34. | `SMCDEL_TIMEOUT` | `30` | per-query timeout in seconds |
  35. Run the tests with `stack test`.
  36. ## Transports
  37. ### stdio
  38. With `--stdio` the client starts the server as a subprocess and talks to it
  39. over stdin and stdout, so there is no server to start and no port to open.
  40. Each line on stdin is one JSON-RPC 2.0 message; each request is answered with
  41. one line of JSON on stdout, notifications get no reply. The server exits when
  42. stdin is closed. Nothing but JSON-RPC messages is written to stdout.
  43. ### Streamable HTTP
  44. Without arguments the server implements the MCP Streamable HTTP transport,
  45. stateless and without server-sent events: `POST /mcp` takes one JSON-RPC 2.0
  46. message. Requests are answered with a single JSON-RPC response as
  47. `application/json`, notifications with `202 Accepted`. `GET` and `DELETE` on
  48. `/mcp` return `405`. Requests with a non-local `Origin` header are rejected
  49. with `403`.
  50. ## Using it with opencode
  51. Add this to `opencode.json` in your project or to
  52. `~/.config/opencode/opencode.json`; opencode then starts the server itself:
  53. ```json
  54. {
  55. "$schema": "https://opencode.ai/config.json",
  56. "mcp": {
  57. "smcdel": {
  58. "type": "local",
  59. "command": ["smcdel-mcp", "--stdio"],
  60. "environment": { "SMCDEL_TIMEOUT": "30" },
  61. "enabled": true
  62. }
  63. }
  64. }
  65. ```
  66. If `~/.local/bin` is not on the `PATH` that opencode sees, give the full path
  67. to the executable instead.
  68. ## Using it with Claude Code
  69. Over stdio, started by Claude Code:
  70. ```sh
  71. claude mcp add smcdel -- smcdel-mcp --stdio
  72. ```
  73. Or over HTTP, with the server already running:
  74. ```sh
  75. claude mcp add --transport http smcdel http://127.0.0.1:3000/mcp
  76. ```
  77. ## Example with curl
  78. ```sh
  79. curl -s -X POST http://127.0.0.1:3000/mcp \
  80. -H 'Content-Type: application/json' \
  81. -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
  82. "name":"smcdel_where",
  83. "arguments":{
  84. "structure":"VARS 1,2,3\nLAW Top\nOBS alice: 2,3\n bob: 1,3\n carol: 1,2",
  85. "formula":"< ! (1|2|3) > ( (alice knows whether 1) | (bob knows whether 2) | (carol knows whether 3) )"
  86. }}}'
  87. ```
  88. ```json
  89. {"id":1,"jsonrpc":"2.0","result":{
  90. "content":[{"type":"text","text":"At which states is < ! (1|2|3) > ( ... ) true?\nNumber of states: 3\n{1}\n{2}\n{3}\n"}],
  91. "isError":false,
  92. "structuredContent":{"count":3,"states":[[1],[2],[3]],"truncated":false,
  93. "formula":"< ! (1|2|3) > ( ... )",
  94. "parsed":"~[! ((1 | 2) | 3)] ~((Kw alice 1 | Kw bob 2) | Kw carol 3)"}}}
  95. ```
  96. ## Code layout
  97. - `src/SMCDEL/MCP/JsonRpc.hs`: JSON-RPC 2.0 messages and error codes.
  98. - `src/SMCDEL/MCP/Protocol.hs`: the transport-independent MCP dispatcher
  99. (`initialize`, `ping`, `tools/list`, `tools/call`).
  100. - `src/SMCDEL/MCP/Tools.hs`: the three tools, their schemas and the syntax primer.
  101. - `src/SMCDEL/MCP/Check.hs`: glue to the SMCDEL library (lexing, parsing,
  102. sanity checks, BDD based model checking, timeouts).
  103. - `src/SMCDEL/MCP/Server.hs`: the scotty application (HTTP transport).
  104. - `src/SMCDEL/MCP/Stdio.hs`: the stdio transport.
  105. - `app/Main.hs`: the executable; `--stdio` selects the transport.
  106. - `test/`: hspec tests for the dispatcher and both transports.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.