Skip to content

Commit 79c9ce3

Browse files
Add more content
1 parent 1a21f56 commit 79c9ce3

File tree

10 files changed

+283
-35
lines changed

10 files changed

+283
-35
lines changed

docs/content/projects/_index.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: "Other Projects"
3+
---

docs/content/tools/_index.md

+48
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,51 @@ cascade:
55
type: docs
66
---
77

8+
## Background
9+
10+
The `mcp/run` container is an mcp server, but it can be extended by giving it new
11+
containers, as tools, and prompts. Existing containers, like `curl` or `ffmpeg`, can
12+
then be exposed as MCP servers.
13+
14+
```mermaid
15+
flowchart LR
16+
desktop["Claude Desktop"]
17+
subgraph docker["Docker"]
18+
mcp["mcp/run"]
19+
end
20+
desktop --> docker
21+
docker -- extended by --- box1["Tools/Prompt Def (curl)"]
22+
docker -- extended by --- box2["Tools/Prompt Def (ffmpeg)"]
23+
style desktop fill:#f9f9f9,stroke:#333,stroke-width:2px
24+
style docker fill:#e6f3ff,stroke:#333,stroke-width:2px,color:#0066cc
25+
style mcp fill:#fff,stroke:#333,stroke-width:1px
26+
style box1 fill:#f9f9f9,stroke:#333,stroke-width:2px
27+
style box2 fill:#f9f9f9,stroke:#333,stroke-width:2px
28+
```
29+
30+
Our current definitions are markdown documents (see [examples](examples)).
31+
32+
```markdown
33+
---
34+
tools:
35+
- name: curl
36+
---
37+
38+
# prompt
39+
40+
Run the curl command, in silent mode, to fetch gists for user slimslenderslacks from GitHub.
41+
```
42+
43+
## Getting Started
44+
45+
We can use this to extend MCP clients like Claude Desktop, and create test new tools and prompts using
46+
VSCode. Instructions for these two paths are here.
47+
48+
1. Attach the MCP server [to Claude Desktop](quickstart).
49+
{{< callout >}}
50+
Claude Desktop has not yet implemented the `notifications/tools/list_changed`. This means that
51+
Claude doesn't reload our tool definitions until it is restarted. It's easier to develop
52+
prompts in VSCode where we can create a much more efficient inner loop.
53+
{{< /callout >}}
54+
2. [Test prompt definitions](quickstart_vscode) using our VSCode extension. Using VSCode as an
55+
mcp server can provide an effective inner loop for developing the content.

docs/content/tools/docs/_index.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
title: Documentation
33
---
44

5+
### Topics
6+
7+
* [How to author prompts](prompts)
8+
* [Updating Claude Desktop](claude-desktop)
9+
510

docs/content/tools/docs/claude-desktop.md

+13
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,16 @@ This will have already been exposed using this MCP server so when using Claude D
2929
You'll see a prompt asking if you want to run the "hello world" tool locally.
3030

3131
![consent](consent.png)
32+
33+
## More prompts
34+
35+
You can register new definitions in public github repos by adding additional `--register` arguments.
36+
37+
```
38+
"--register", "github:docker/labs-ai-tools-for-devs?path=prompts/examples/swagger.md"
39+
```
40+
41+
We are moving these registration command to a command line. It doesn't make sense to change the claude
42+
config each time you add or remote a defintion. However, because Claude Desktop has to be restarted
43+
every time a definition changes today (because of the missing notification), we will work
44+
with Anthropic to make this much smoother.

docs/content/tools/examples/_index.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: example prompts
33
---
44

5+
* [simplest definition we can think of](hello-world)
56
* [Use curl to fetch your GitHub gists](curl)
67
* [call swagger api](swagger)
78
* [create an animaged gif using ffmpeg](ffmpeg)
9+
* [read and write local files](filesystem)
10+
* [use sqlite from an mcp client](sqlite)
11+
* [working with local files](filesystem)
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: filesystem
3+
---
4+
5+
# Description
6+
7+
Add `read_file` and `write_file` tool containers.
8+
9+
# Prompt Code
10+
11+
```
12+
---
13+
model: claude-3-5-sonnet-20241022
14+
tools:
15+
- name: read_file
16+
description: |
17+
read a file from disk
18+
Read the complete contents of a file from the file system.
19+
Handles various text encodings and provides detailed error messages
20+
if the file cannot be read. Use this tool when you need to examine
21+
the contents of a single file. Only works within allowed directories.
22+
parameters:
23+
type: object
24+
properties:
25+
path:
26+
type: string
27+
container:
28+
image: vonwig/bash_alpine
29+
entrypoint: cat
30+
command:
31+
- "{{path|safe}}"
32+
- name: write_file
33+
description: |
34+
Create a new file or completely overwrite an existing file with new content.
35+
Use with caution as it will overwrite existing files without warning.
36+
Handles text content with proper encoding. Only works within allowed directories.
37+
parameters:
38+
type: object
39+
properties:
40+
path:
41+
type: string
42+
content:
43+
type: string
44+
container:
45+
image: vonwig/bash_alpine
46+
command:
47+
- "-c"
48+
- "echo {{content|safe}} > {{path|safe}}"
49+
---
50+
51+
# prompt user
52+
53+
read the file deps.edn and then write the string "blah.txt" into the file test.txt
54+
55+
```
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: hello world
3+
---
4+
5+
# Description
6+
7+
Just echo a greeting by running a container!
8+
9+
# Prompt Code
10+
11+
```markdown
12+
---
13+
name: hello-docker
14+
description: run the hello-docker
15+
model: claude-3-5-sonnet-20241022
16+
tools:
17+
- name: hello-docker
18+
description: print a secret message
19+
container:
20+
image: busybox:latest
21+
command:
22+
- echo
23+
- "Hello, World!"
24+
---
25+
26+
# prompt
27+
28+
Use hello world to print a secret message and then explain it to me
29+
```
30+

docs/content/tools/examples/sqlite.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: sqlite
3+
---
4+
5+
# Description
6+
7+
Use sqlite containers to provide 3 tools:
8+
9+
* `read-query`
10+
* `list-tables`
11+
* `describe-table`
12+
13+
The sqlite database ( /mcp/test1.db ) is mounted using a Docker volume.
14+
15+
Use these tools to ask Claude to explore the data using the tools above.
16+
17+
Here's a fully worked
18+
[example](https://github.com/docker/labs-ai-tools-for-devs/blob/main/prompts/examples/mcp-sqlite.md?plain=1)
19+
for building insights from a user defined topic.
20+
21+
# Prompt Code
22+
23+
```markdown
24+
---
25+
tools:
26+
- name: read-query
27+
description: Execute a SELECT query on the SQLite database
28+
parameters:
29+
type: object
30+
properties:
31+
query:
32+
type: string
33+
description: SELECT SQL query to execute
34+
container: &sqlite-container
35+
image: &sqlite-image vonwig/sqlite:latest
36+
command:
37+
- &db "/mcp/test1.db"
38+
- "{{query|safe}}"
39+
volumes: &mounts
40+
- "mcp-test:/mcp"
41+
- name: list-tables
42+
description: List all tables in the SQLite database
43+
container:
44+
image: *sqlite-image
45+
command:
46+
- *db
47+
- "SELECT name from sqlite_master WHERE type='table'"
48+
volumes: *mounts
49+
- name: describe-table
50+
description: Get the schema information for a specific table
51+
parameters:
52+
type: object
53+
properties:
54+
table_name:
55+
type: string
56+
description: Name of the table to describe
57+
container:
58+
image: *sqlite-image
59+
command:
60+
- *db
61+
- "PRAGMA table_info({{table_name}})"
62+
volumes: *mounts
63+
---
64+
65+
```
66+

docs/content/tools/quickstart.md

+11-35
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,25 @@
11
---
2-
title: Quick Start w/ VSCode
2+
title: Quick Start w/ Claude Desktop
33
weight: 1
44
---
55

66
{{% steps %}}
77

8-
### Download `.vsix` extension
8+
### Install
99

10-
Download the `.vsix` extension from the [releases page](https://github.com/docker/labs-ai-tools-vscode/releases).
10+
[Configure Docker Desktop](../docs/claude-desktop) to use the `mcp/run` Docker container.
1111

12-
### Install extension from `.vsix` file
12+
### Restart Claude Desktop
1313

14-
```sh
15-
code --install-extension <path-to-vsix-file>
16-
```
14+
Restarting desktop should be a one-time activity. However, Claude
15+
Desktop does not support the `tools/list_changed` notification so we
16+
currently have to restart desktop more less continuously. :)
1717

18-
or use the VSCode command palette `Extensions: Install from VSIX...`
18+
### Try a prompt
1919

20-
### Open a prompt
21-
With the extension installed, open a prompt in VSCode. Examples can be found in the [examples](https://github.com/docker/labs-ai-tools-for-devs/tree/main/prompts/examples) directory.
20+
Write a prompt in Claude that will run one of the tools in a registered defintion.
21+
For example:
2222

23-
### Configure OpenAI API Key, or use a different model.
24-
Default model is `gpt-4` provided by OpenAI. Use an the VSCode command palette `Docker AI: Set secret key` to set your API key.
25-
26-
**Changing the model:**
27-
Use the following keys in the prompt front-matter to change the model:
28-
29-
Anthropic:
30-
```yml
31-
---
32-
url: https://api.anthropic.com
33-
model: claude-3-5-sonnet-20240620
34-
---
35-
```
36-
37-
38-
Ollama:
39-
```yml
40-
---
41-
model: llama3.2
42-
url: https://docker.host.internal:11434/v1
43-
---
44-
```
45-
46-
### Run the prompt
47-
Use the VSCode command palette `Docker AI: Run this prompt` to run the prompt.
23+
> Use hello world to send a greeting and then respond to what comes back.
4824
4925
{{% /steps %}}
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Quick Start w/ VSCode
3+
weight: 1
4+
---
5+
6+
{{% steps %}}
7+
8+
### Download `.vsix` extension
9+
10+
Download the `.vsix` extension from the [releases page](https://github.com/docker/labs-ai-tools-vscode/releases).
11+
12+
### Install extension from `.vsix` file
13+
14+
```sh
15+
code --install-extension <path-to-vsix-file>
16+
```
17+
18+
or use the VSCode command palette `Extensions: Install from VSIX...`
19+
20+
### Open a prompt
21+
With the extension installed, open a prompt in VSCode. Examples can be found in the [examples](https://github.com/docker/labs-ai-tools-for-devs/tree/main/prompts/examples) directory.
22+
23+
### Configure OpenAI API Key, or use a different model.
24+
Default model is `gpt-4` provided by OpenAI. Use an the VSCode command palette `Docker AI: Set secret key` to set your API key.
25+
26+
**Changing the model:**
27+
Use the following keys in the prompt front-matter to change the model:
28+
29+
Anthropic:
30+
```yml
31+
---
32+
model: claude-3-5-sonnet-20240620
33+
---
34+
```
35+
36+
37+
Ollama:
38+
```yml
39+
---
40+
model: llama3.2
41+
url: https://docker.host.internal:11434/v1
42+
---
43+
```
44+
45+
### Run the prompt
46+
Use the VSCode command palette `Docker AI: Run this prompt` to run the prompt.
47+
48+
{{% /steps %}}

0 commit comments

Comments
 (0)