Skip to content

Commit 8623bdb

Browse files
Runtime supporting registry.yaml config nodes (#64)
* registry entries can have configs * registration time configs are merged into the metadata parameter-values for an entry in the prompts.core/registry * parameter values are made available to mcp server containers when they are needed * parameter values are also merged into the parameter set when tool containers are running
1 parent 7536417 commit 8623bdb

File tree

20 files changed

+271
-191
lines changed

20 files changed

+271
-191
lines changed

dev/catalog.clj

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
(:require
33
[babashka.fs :as fs]
44
[clj-yaml.core :as yaml]
5+
[clojure.edn :as edn]
6+
[flatland.ordered.map :refer [ordered-map]]
57
git
6-
repl
78
[markdown :as markdown-parser]
89
[medley.core :as medley]
9-
prompts))
10+
prompts
11+
repl))
12+
13+
(defn mcp-metadata-cache [f]
14+
(edn/read-string
15+
{:readers {'ordered/map (fn [pairs] (into (ordered-map pairs)))}}
16+
(slurp f)))
17+
18+
(comment
19+
(mcp-metadata-cache "test/resources/mcp-metadata-cache.edn"))
1020

1121
(defn prompt-metadata [s]
1222
(try
@@ -32,14 +42,14 @@
3242
(defn generate-updated-catalog []
3343
(spit "catalog.updated.yaml"
3444
(yaml/generate-string
35-
(let [catalog (yaml/parse-string (slurp "prompts/catalog.yaml"))]
36-
(medley/deep-merge
37-
catalog
38-
{:registry
39-
(->> (apply interleave ((juxt keys (comp extra-metadata vals)) (seq (:registry catalog))))
40-
(partition 2)
41-
(map #(into [] %))
42-
(into {}))})))))
45+
(let [catalog (yaml/parse-string (slurp "prompts/catalog.yaml"))]
46+
(medley/deep-merge
47+
catalog
48+
{:registry
49+
(->> (apply interleave ((juxt keys (comp extra-metadata vals)) (seq (:registry catalog))))
50+
(partition 2)
51+
(map #(into [] %))
52+
(into {}))})))))
4353

4454
(comment
4555
;; setup stdout logger

gordon-mcp.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
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
2+
MCP_DOCKER:
3+
image: alpine/socat
4+
command:
5+
- STDIO
6+
- TCP:host.docker.internal:8811

prompts/catalog.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,4 +2183,7 @@ registry:
21832183
UNDER CONSTRUCTION (declarative state caching in volumes) A Model Context Protocol (MCP) server for web research, enabling real-time information retrieval and webpage content extraction for Claude.
21842184
ref: github:docker/labs-ai-tools-for-devs?path=prompts/mcp/webresearch.md
21852185
icon: https://img.icons8.com/officel/80/under-construction.png
2186-
2186+
youtube_transcript:
2187+
description: retrieves transcripts for given YouTube video URLs
2188+
ref: github:docker/labs-ai-tools-for-devs?path=prompts/mcp/youtube_transcript.md
2189+
icon: https://cdn.jsdelivr.net/npm/simple-icons@v7/icons/youtube.svg

prompts/mcp/filesystem.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ mcp:
66
volumes:
77
- "{{filesystem.paths|volume|into}}"
88
command:
9-
- "{{filesystem.paths|into}}
10-
parameters-values:
11-
filesystem.allowed_paths:
12-
- /Users/slim
9+
- "{{filesystem.paths|into}}"
10+
parameter-values:
11+
filesystem:
12+
paths:
13+
- /Users/local-test
1314
---
1415

prompts/mcp/youtube_transcript.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
mcp:
3+
- container:
4+
image: vonwig/youtube-transcript
5+
workdir: /app
6+
---

runbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ docker pull mcp/docker:prerelease
2020

2121
```sh
2222
# docker:command=build-release
23-
VERSION="0.0.5"
23+
VERSION="0.0.6"
2424
docker buildx build \
2525
--builder hydrobuild \
2626
--platform linux/amd64,linux/arm64 \

src/extension/.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

src/extension/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IMAGE?=docker/labs-ai-tools-for-devs
2-
TAG?=0.2.7
2+
TAG?=0.2.17
33

44
BUILDER=buildx-multi-arch
55

@@ -14,7 +14,7 @@ cross:
1414
cd host-binary && $(MAKE) cross
1515

1616
build-extension: cross ## Build service image to be deployed as a desktop extension
17-
docker buildx build --load --platform=linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64,windows/arm64 --tag=$(IMAGE):$(TAG) .
17+
docker buildx build --load --tag=$(IMAGE):$(TAG) .
1818

1919
install-extension: build-extension ## Install the extension
2020
docker extension install $(IMAGE):$(TAG)

src/extension/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
mcp_docker:
3-
image: mcp/docker:0.0.5
3+
image: mcp/docker:0.0.6
44
ports:
55
- 8811:8811
66
volumes:

src/git.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
dir
66
docker
77
[hasch.core :as hasch]
8-
jsonrpc))
8+
jsonrpc
9+
[jsonrpc.logger :as logger]))
910

1011
(set! *warn-on-reflection* true)
1112

@@ -87,7 +88,7 @@
8788
:volumes ["docker-prompts-git:/git"]
8889
:command (concat ["clone" "--depth" "1" (format "https://github.com/%s/%s" owner repo)]
8990
(when ref ["-b" ref])
90-
[(format "/project/%s" ref-hash)])}))))
91+
["/project"])}))))
9192

9293
(comment
9394
(clone {:dir "/Users/slim/crap" :owner "docker" :repo "labs-make-runbook" :ref "main" :ref-hash "crap"}))
@@ -130,6 +131,7 @@
130131
(pull {:dir dir :ref ref})
131132
(clone (merge git-ref-map {:dir (fs/parent dir) :ref-hash ref-hash})))]
132133
(when (not (= 0 (:exit-code m)))
134+
(logger/error (format "git error (%d): %s" (:exit-code m) (:pty-output m)))
133135
(jsonrpc/notify :error {:content (str m)}))
134136
(if path
135137
(let [cached-path (fs/file dir path)]

0 commit comments

Comments
 (0)