شعار cl-mcp

cl-mcp

مؤسسة
cl-ai-project

A Model Context Protocol (MCP) server for Common Lisp, providing JSON-RPC 2.0

الناشرcl-ai-project
المستودعcl-mcp
اللغةCommon Lisp
التفريعات
18
النجوم
87
الأدوات المتاحة
0
نوع نقل البياناتstdio, streamable-http
الفئات
الترخيصMIT
الروابط
  • اربط الأدوات بمسارات عمل الذكاء الاصطناعي

    يتيح cl-mcp إمكانات MCP لتطبيقات الذكاء الاصطناعي العميلة المتوافقة معه، وكذلك لوكلاء الذكاء الاصطناعي المتوافقين معه.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم مقتطفات التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات اهتمام المجتمع بالمستودع مفتوح المصدر

    إحصاءات المستودع المرتبط: النجوم: 87، والتفريعات: 18.

cl-mcp

CI Lint

A Model Context Protocol (MCP) server for Common Lisp, providing JSON-RPC 2.0 over stdio, TCP, and HTTP (Streamable HTTP). It enables AI agents to interact with Common Lisp environments through structured tools for REPL evaluation, system loading, file operations, code introspection, and structure-aware editing.

Features

  • REPL evaluation with object inspection — evaluate forms, drill down into complex results (CLOS instances, hash-tables, etc.), and capture structured error context with stack frames and local variables
  • Sandboxed file operations — read/write/list files restricted to the project root and ASDF system source directories, preventing accidental access outside the project
  • Structure-aware Lisp editing — replace, insert, and patch top-level forms using Eclector CST parsing with automatic parinfer repair, preserving formatting and comments
  • Code intelligence — symbol lookup, metadata, and cross-references via sb-introspect; Lisp-aware file viewing with collapsed signatures and pattern-based expansion
  • Structured test runner — run Rove and FiveAM tests with pass/fail counts, failure details, and source locations
  • Worker pool isolation — eval-dependent tools run in isolated child SBCL processes with automatic crash recovery, circuit breaker, and per-session affinity
  • Three transports — stdio, TCP (multi-client), and Streamable HTTP (for Claude Code)

For the full list of tools with input/output schemas, see docs/tools.md.

Requirements

  • SBCL 2.x (developed with SBCL 2.5.x)
  • Quicklisp (optional; pure ASDF also works)
  • Dependencies (via ASDF/Quicklisp): runtime — alexandria, cl-ppcre, yason, usocket, bordeaux-threads, eclector, hunchentoot; tests — rove; optional — fiveam (for running FiveAM suites), clhs (loaded on-demand by clhs-lookup tool).

Quick Start

Install

bash
# Install from Roswell
ros install cl-ai-project/cl-mcp

# or fetch from GitHub
cd ~/common-lisp
git clone https://github.com/cl-ai-project/cl-mcp.git

Load and run from an existing REPL:

lisp
(asdf:load-system :cl-mcp)  ; or (ql:quickload :cl-mcp) if using Quicklisp

;; Start HTTP server on port 12345
(cl-mcp:start-http-server :port 12345)

;; Start TCP transport on port 12345
(cl-mcp:start-tcp-server-thread :port 12345)

Or run a minimal stdio loop (one JSON-RPC line per request):

bash
;; When use with Roswell
ros run -s cl-mcp -e "(cl-mcp:run :transport :stdio)"

;; When use plain sbcl command
sbcl --eval '(require :asdf)' \
     --eval '(asdf:load-system :cl-mcp)' \
     --eval '(cl-mcp:run :transport :stdio)'

Project root: File operations require a project root to be set. If MCP_PROJECT_ROOT is not set, the first file access will return an error prompting you to call fs-set-project-root. AI agents handle this automatically by setting it to their working directory.

System Prompts

The prompts/ directory contains system prompts that teach AI agents how to use cl-mcp tools effectively:

  • repl-driven-development.md — Tool selection guide, REPL-driven workflow (explore → experiment → persist → verify), editing patterns, and troubleshooting recipes
  • common-lisp-expert.md — Production-quality Common Lisp coding standards, CLOS/conditions/restarts conventions, and TDD with Rove
  • cl-spec-driven-development.md — Contract-driven workflow for the optional cl-spec tool group: finding and writing Function Specs and Properties, baselines, seed replay, and reading spec-check verdicts. Supplements the two prompts above rather than replacing them

Reference them from your project's CLAUDE.md (or equivalent) so the agent loads them at conversation start:

markdown
# CLAUDE.md
@prompts/repl-driven-development.md
@prompts/common-lisp-expert.md

If you enable the cl-spec tool group (see Optional tool groups), add the third prompt as well. Leave it out otherwise: without the group, the tools it describes are not in the agent's tool list.

markdown
@prompts/cl-spec-driven-development.md

Claude Code

HTTP transport (recommended)

Start the HTTP server from your REPL and keep using it alongside Claude Code:

lisp
(asdf:load-system :cl-mcp)  ; or (ql:quickload :cl-mcp)

;; Start HTTP server on port 3000 (default)
(cl-mcp:start-http-server :port 3000)

;; Server is now running at http://127.0.0.1:3000/mcp
;; You can continue using your REPL normally
(+ 1 2)  ; => 3

;; Stop the server when done
(cl-mcp:stop-http-server)

Configure Claude Code to connect (in ~/.claude/settings.json or project .mcp.json):

json
{
  "mcpServers": {
    "cl-mcp": {
      "type": "url",
      "url": "http://127.0.0.1:3000/mcp"
    }
  }
}

This approach lets both you and Claude Code share the same Lisp runtime. You can inspect state from SLIME/Sly while Claude Code works through MCP.

Stdio transport

For a simpler setup where Claude Code manages the server process directly:

json
{
  "mcpServers": {
    "cl-mcp": {
      "command": "ros",
      "args": ["run", "-s", "cl-mcp", "-e", "(cl-mcp:run)"]
    }
  }
}

Stdio is easy to configure but the Lisp process is owned by Claude Code, making manual intervention from SLIME or another REPL difficult.

Codex

Configure in ~/.codex/config.toml.

Stdio transport

The simplest setup — Codex spawns and manages the server process:

toml
[mcp_servers.cl-mcp]
command = "ros"
args = ["run", "-s", "cl-mcp", "-e", "(cl-mcp:run)"]

As with Claude Code's stdio mode, the Lisp process is owned by Codex and not easily accessible from SLIME or another REPL.

TCP transport with stdio bridge

Start a TCP server from your REPL, then point Codex at it via the bundled Python bridge that translates stdio ↔ TCP:

lisp
;; In your REPL
(asdf:load-system :cl-mcp)
(cl-mcp:start-tcp-server-thread :port 12345)
toml
[mcp_servers.cl-mcp]
command = "python3"
args = ["scripts/stdio_tcp_bridge.py", "--host", "127.0.0.1", "--port", "12345"]

This gives you the same shared-REPL workflow as Claude Code's HTTP mode — you keep your SLIME/Sly session while Codex works through the bridge.

Worker Pool Isolation

Eval-dependent tools (repl-eval, load-system, run-tests, code-*, clos-describe, inspect-object) run in isolated child SBCL processes. Each session gets a dedicated worker with automatic crash recovery and circuit breaker protection. File-system and editing tools run inline in the parent process.

With the worker pool enabled, a worker crash loses all worker-local Lisp state (loaded systems, definitions, packages, and REPL state). Any in-flight call that observes the crash fails. The pool normally attempts recovery; if it supplies a replacement, that worker starts with fresh Lisp state. The circuit breaker can halt automatic recovery after repeated crashes. In diagnostic logs, worker.crashed can initially report exit_status=running after TCP EOF; that is a provisional snapshot. Use the later worker.reaped event for the final process exit status.

For a pooled SBCL worker request, a condition that no existing handler resolves and that reaches the debugger path is observed and aborted as that request's structured failure. This preserves the worker for later requests, but it does not roll back side effects made before the failure. A process exit such as SB-EXT:EXIT remains a real worker crash and follows normal EOF/reaper recovery.

Disable the worker pool with MCP_NO_WORKER_POOL=1 or the :worker-pool keyword:

lisp
(cl-mcp:run :transport :stdio :worker-pool nil)

Environment Variables

VariablePurposeDefault
MCP_PROJECT_ROOTProject root directory for file operationsclient working directory
MCP_LOG_LEVELLog level: debug, info, warn, errorinfo
MCP_LOG_FILELog to file (timestamped with PID)(stderr only)
MCP_NO_WORKER_POOLSet to 1 to disable worker pool isolation(not set = pool enabled)
CL_MCP_WORKER_POOL_WARMUPNumber of standby workers to maintain (non-negative integer)1
CL_MCP_MAX_POOL_SIZEMaximum total workers, bound + standby (positive integer)16
MCP_WORKER_INIT_SYSTEMASDF system to load in the elected owner worker at bind (master gate for the init hook)(unset = off)
MCP_WORKER_INIT_ENTRYPKG:SYMBOL nullary thunk run after the load (preferred activation)(none)
MCP_WORKER_INIT_EVALLisp form run via repl-eval as an escape hatch(none)
MCP_WORKER_INIT_PACKAGEPackage used to read/eval MCP_WORKER_INIT_EVALCL-USER
MCP_WORKER_INIT_MAX_FAILURESSoft init failures before init auto-retry latches off1
MCP_WORKER_INIT_MODEsingleton (one owner binds a fixed port). v1 supports singleton onlysingleton

Tuning warmup for cold-start handshakes

The worker pool warms its standbys asynchronously once cl-mcp:run returns control to the MCP transport, so the stdio handshake is not blocked on subprocess launches. If you still see your MCP client report Failed to connect on a cold FASL cache — for example the first cl-mcp invocation after a system upgrade — set CL_MCP_WORKER_POOL_WARMUP=0 to skip pre-spawning entirely. Workers are then created on demand the first time a session needs one, trading first-eval latency for the smallest possible startup footprint. Once your client establishes the session you can ignore the warmup; the pool will grow as sessions arrive.

Running an app inside a worker (init hook)

Set MCP_WORKER_INIT_SYSTEM (and optionally MCP_WORKER_INIT_ENTRY) to have the pool run a startup routine inside the single worker elected as the "runtime owner" when a session binds it. This lets an app (e.g. a web server) run in the same process that serves repl-eval/load-system, so hot-reload lands in the app's process, while the parent keeps the persistent /mcp endpoint. pool-kill-worker restarts the runtime without dropping /mcp.

  • The init runs on a background thread under a worker-global ASDF load lock, so it never races a load-system RPC.
  • Init failures never trip the crash circuit breaker; a failed init leaves a plain, usable REPL worker. Check pool-status (init_owner_session, init_disabled, init_failures) to see runtime state.
  • Requires the pool enabled (do not set MCP_NO_WORKER_POOL=1); cl-mcp warns at startup if the init vars are set while the pool is disabled.
  • The init form must be bind-robust and idempotent, and should pass :address "127.0.0.1" for a localhost-only dev server. Do not embed secrets in MCP_WORKER_INIT_EVAL.
  • Reloading code with load-system :force t while the app is serving live requests can race in-flight request threads (class/method redefinition); reload between requests or quiesce the app's acceptor first.

Example (recurya): add a nullary recurya/dev:start-dev-runtime! thunk that starts the DB and web server, then set MCP_WORKER_INIT_SYSTEM=recurya/dev and MCP_WORKER_INIT_ENTRY=recurya/dev:start-dev-runtime!.

Known v1 limitations:

  • Single dev runtime / single session. singleton mode is designed for one developer session driving one fixed-port app. Ownership is bound to the owner session and never migrates to a different live session, so hot-reload stays in the app's process. A narrow multi-session race remains (if the owner's worker crashes during the same window that a second session binds), so two concurrent sessions against one init runtime is not supported in v1; a future per-worker/ephemeral-port mode is planned for that.
  • Reset is not instantaneous. pool-kill-worker re-arms the runtime, but the app is re-initialized lazily on the session's next tool call (not eagerly), so the app is briefly down after a reset until the next MCP request. The parent /mcp endpoint stays up throughout.
  • Soft-failure retry is worker-scoped. MCP_WORKER_INIT_MAX_FAILURES counts init failures across a session's worker (re)binds (e.g. successive hard-crash recoveries). A soft init failure (the app reports an error but the worker stays alive) keeps the runtime owned by that session (no migration) but is not auto-retried on the same worker — recover it with pool-kill-worker.

Security Model

cl-mcp is a trusted, localhost-only development tool. repl-eval executes arbitrary Common Lisp code in the host image, so any client with MCP access has full system privileges. Do not expose the endpoint beyond localhost. File operation restrictions (project root enforcement) are convenience guardrails to prevent accidental mistakes, not security boundaries.

License

MIT

التثبيت

TypingMind
المتطلبات المسبقة:

Node.js 18+

{
  "mcpServers": {
    "cl-ai-project-cl-mcp": {
      "command": "",
      "args": []
    }
  }
}

استخدم MCP الخاص بـ cl-mcp مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل cl-mcp، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يمكنك تشغيل MCP محليًا على جهازك أو الاتصال بعنوان URL لخادم MCP بعيد.

الخيار 1: استخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal مفتوحة واترك العملية قيد التشغيل أثناء استخدام أدوات MCP.
3

إضافة cl-mcp كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ cl-mcp.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "cl-ai-project-cl-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "cl-mcp"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ cl-mcp، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ cl-mcp.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام cl-mcp لمساعدتي في هذه المهمة؟
cl-mcp
بالتأكيد. قرأته.
إليك ما وجدته باستخدام cl-mcp.

الخيار 2: إضافة عنوان URL لخادم MCP

استخدم هذا الخيار عندما يكون cl-mcp مستضافًا بالفعل عن بُعد أو عندما يريد فريقك موصلًا مشتركًا واحدًا يمكن لعدة مستخدمين الوصول إليه.

1

فتح موصلات MCP

في TypingMind، انتقل إلى «الإضافات»، وافتح «موصلات MCP»، ثم اختر «إضافة عنوان URL».

  1. افتح TypingMind في متصفحك.
  2. انتقل إلى الإضافات.
  3. افتح موصلات MCP.
  4. انقر على «إضافة عنوان URL».
نموذج إضافة عنوان URL لخادم MCP مخصص في TypingMind
2

لصق عنوان URL للخادم

أدخل عنوان URL لخادمك في حقل «رابط الخادم». أضف اسمًا للاتصال أو وصفًا أو أيقونة أو ترويسات HTTP مخصصة أو إعدادات عميل OAuth إذا كان الخادم يتطلب ذلك.

  1. ألصق عنوان URL لخادمك في حقل «رابط الخادم».
  2. أدخل اسمًا لاتصال cl-mcp.
  3. أضف وصفًا وأيقونة لتسهيل التعرّف على الاتصال إن أردت.
  4. أضف ترويسات HTTP مخصصة أو تفاصيل عميل OAuth إذا كان الخادم يتطلب المصادقة.
3

إنشاء الاتصال

انقر على «إنشاء اتصال»، ثم عُد إلى قائمة الإضافات وتأكد من أن اتصال MCP الجديد نشط.

  1. انقر على «إنشاء اتصال».
  2. عُد إلى قائمة موصلات MCP.
  3. تأكد من ظهور اتصال cl-mcp بحالة «نشط».
  4. حدّث قائمة الإضافات إذا لم يظهر الاتصال فورًا.
4

تبديل النماذج دون إعادة الاتصال

ابدأ محادثة مع نموذجك المفضل، وفعّل أدوات cl-mcp من «الإضافات»، وانتقل إلى نموذج آخر عند الحاجة. يظل اتصال MCP متاحًا في مساحة عمل TypingMind.

  1. ابدأ محادثة جديدة في TypingMind.
  2. اختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  3. فعّل أدوات cl-mcp من قسم الإضافات.
  4. اطلب من النموذج استخدام الأداة عند الحاجة.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر وأعد استخدام اتصال MCP نفسه.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام cl-mcp لمساعدتي في هذه المهمة؟
cl-mcp
بالتأكيد. قرأته.
إليك ما وجدته باستخدام cl-mcp.

الأسئلة الشائعة

ما استخدامات خادم MCP cl-mcp؟

cl-mcp هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP cl-mcp مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام cl-mcp مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم خادم MCP cl-mcp مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل cl-mcp، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP cl-mcp بـ TypingMind؟

يمكن توصيل cl-mcp بـ TypingMind باستخدام موصل MCP المحلي أو بإضافة عنوان URL لخادم MCP بعيد. استخدم الموصل المحلي عندما يحتاج الخادم إلى الوصول إلى ملفات أو تطبيقات أو موارد خاصة على جهازك، واستخدم عنوان URL للخادم عندما يكون خادم MCP مستضافًا عن بُعد.

ما الأدوات التي يوفّرها خادم MCP cl-mcp في TypingMind؟

يتيح cl-mcp إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP cl-mcp؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويتيح لك التحكم بنفسك في مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP. إذا كان cl-mcp يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇