Skip to content

Commit e7aa07f

Browse files
Remove warnings
1 parent e07a0f2 commit e7aa07f

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

gordon-mcp.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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

src/jsonrpc/db.clj

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
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)

src/jsonrpc/server.clj

+4-2
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
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
@@ -320,7 +321,7 @@
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}
@@ -333,7 +334,7 @@
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
@@ -345,6 +346,7 @@
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

src/script.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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")))

src/volumes.clj

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
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
(->
@@ -52,7 +52,7 @@
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

0 commit comments

Comments
 (0)