-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun-server.lisp
More file actions
executable file
·37 lines (31 loc) · 1.51 KB
/
Copy pathrun-server.lisp
File metadata and controls
executable file
·37 lines (31 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env -S sbcl --script
;;; run-server.lisp
;;; ABOUTME: Launcher script for CL-MCP-Server
;;; Redirect all output to stderr during setup
;;; MCP requires stdout to only contain JSON-RPC messages
(let ((*standard-output* *error-output*)
(*trace-output* *error-output*))
;;; Try to load Quicklisp from common locations
(flet ((try-load (path)
(when (probe-file path)
(load path :verbose nil :print nil)
t)))
(or (try-load (merge-pathnames ".quicklisp/setup.lisp" (user-homedir-pathname)))
(try-load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))
(try-load (merge-pathnames ".roswell/lisp/quicklisp/setup.lisp" (user-homedir-pathname)))
(try-load #p"/usr/local/share/quicklisp/setup.lisp")))
;;; Load ASDF if not already available
(require "asdf")
;;; Add current directory to ASDF search path
(push (make-pathname :directory (pathname-directory *load-truename*))
(symbol-value (find-symbol "*CENTRAL-REGISTRY*" "ASDF")))
;;; Load the MCP server system using Quicklisp if available
(handler-case
(if (find-package "QL")
(funcall (find-symbol "QUICKLOAD" "QL") "cl-mcp-server" :silent t)
(funcall (find-symbol "LOAD-SYSTEM" "ASDF") "cl-mcp-server" :verbose nil))
(error (c)
(format *error-output* "Error loading system: ~a~%" c)
(funcall (find-symbol "EXIT" "SB-EXT") :code 1))))
;;; Start the server (output goes to real stdout now)
(funcall (find-symbol "START" "CL-MCP-SERVER"))