File tree Expand file tree Collapse file tree 5 files changed +22
-9
lines changed Expand file tree Collapse file tree 5 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 1+ services :
2+ mcp_docker :
3+ image : mcp/docker:latest
4+ command : serve --mcp --register github:docker/labs-ai-tools-for-devs?path=prompts/bootstrap.md
5+ volumes :
6+ - /var/run/docker.sock:/var/run/docker.sock
7+ - docker-prompts:/prompts
8+ x-mcp-autoremove : false
9+
10+ volumes :
11+ docker-prompts :
12+ external : true
Original file line number Diff line number Diff line change 4545 (add {:register [" github:docker/labs-ai-tools-for-devs?path=prompts/examples/explain_dockerfile.md"
4646 " github:docker/labs-ai-tools-for-devs?path=prompts/examples/hello_world.md" ]}))
4747
48- #_{:clj-kondo/ignore [:redefined-var ]}
49- (defn merge [{:keys [registry-content] :as opts}]
48+ (defn merge-dynamic-prompts [{:keys [registry-content] :as opts}]
5049 (logger/info " adding dynamic prompts" registry-content)
5150 (try
5251 (let [{:keys [registry]} (yaml/parse-string registry-content)
Original file line number Diff line number Diff line change 295295 log-path (logger/setup timbre-logger)
296296 db* db/db*
297297 log-ch (async/chan (async/sliding-buffer 20 ))
298+ ; ; server will start watching stdio/stdout immediately
298299 server (stdio-server
299300 (merge
300301 {; :keyword-function identity
320321 (logger/error t))))
321322 ; ; register dynamic prompts
322323 (when (fs/exists? (fs/file " /prompts/registry.yaml" ))
323- (db/merge (assoc opts :registry-content (slurp " /prompts/registry.yaml" ))))
324+ (db/merge-dynamic-prompts (assoc opts :registry-content (slurp " /prompts/registry.yaml" ))))
324325 ; ; watch dynamic prompts in background
325326 (async/thread
326327 (let [{x :container }
333334 (let [[_dir _event f] (string/split line #"\s +" )]
334335 (when (= f " registry.yaml" )
335336 (try
336- (db/merge (assoc opts :registry-content (slurp " /prompts/registry.yaml" )))
337+ (db/merge-dynamic-prompts (assoc opts :registry-content (slurp " /prompts/registry.yaml" )))
337338 (producer/publish-tool-list-changed producer {})
338339 (producer/publish-prompt-list-changed producer {})
339340 (catch Throwable t
345346 (docker/delete x)))))
346347 (monitor-server-logs log-ch)
347348 (logger/info " Starting server..." )
349+ ; ; only on lsp.server/start will the stdio channels start being used
348350 [producer (lsp.server/start server components)])))
349351
350352(comment
Original file line number Diff line number Diff line change 11(ns script )
22
3- (defmacro read [path]
3+ (defmacro read-script-at-compile-time [path]
44 (slurp path))
55
66(comment
7- (macroexpand '(read " src/volumes/collect.clj" )))
7+ (macroexpand '(read-script-at-compile-time " src/volumes/collect.clj" )))
Original file line number Diff line number Diff line change 3434 :thread-id thread-id
3535 :command [(json/generate-string
3636 {:directory " /thread" } keyword)
37- (script/read " src/volumes/collect.clj" )]})
37+ (script/read-script-at-compile-time " src/volumes/collect.clj" )]})
3838 :pty-output
3939 (json/parse-string keyword))
4040 (catch Throwable t
4141 (logger/error t " error collecting mcp resources" )
4242 {})))
4343
4444(comment
45- (script/read " src/volumes/collect.clj" ))
45+ (script/read-script-at-compile-time " src/volumes/collect.clj" ))
4646
4747(comment
4848 (->
5252 :workdir " /project"
5353 :command [(json/generate-string
5454 {:directory " /project" })
55- (script/read " src/volumes/collect.clj" )]})
55+ (script/read-script-at-compile-time " src/volumes/collect.clj" )]})
5656 :pty-output
5757 #_(json/parse-string keyword)))
5858
You can’t perform that action at this time.
0 commit comments