diff --git a/.gitignore b/.gitignore index d723889..d93bdab 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /tools_vector_store/tools.db /tools_vector_store/chroma_db/ /docker-mcp-server.out +/**/.DS_Store diff --git a/graphs/prompts/.DS_Store b/graphs/prompts/.DS_Store deleted file mode 100644 index 9a692e3..0000000 Binary files a/graphs/prompts/.DS_Store and /dev/null differ diff --git a/prompts/examples/claude_resources.md b/prompts/examples/claude_resources.md new file mode 100644 index 0000000..02e9a9c --- /dev/null +++ b/prompts/examples/claude_resources.md @@ -0,0 +1,25 @@ +--- +description: Examples for creating resources in Claude Desktop +model: claude-3-5-sonnet-20241022 +tools: + - name: append-insight + description: Add a business insight to the memo + parameters: + type: object + properties: + insight: + type: string + description: Business insight discovered from data analysis + container: + image: vonwig/bash_alpine + command: + - "-c" + - "echo '{{insight|safe}}' >> /mcp/insights.txt" + volumes: + - "mcp-test:/mcp" +prompt-format: django +--- + +# prompt user + +Add a business insight of 'some great data' diff --git a/prompts/examples/imagemagick/svg-to-png.md b/prompts/examples/imagemagick/svg-to-png.md new file mode 100644 index 0000000..01dc2ce --- /dev/null +++ b/prompts/examples/imagemagick/svg-to-png.md @@ -0,0 +1,9 @@ +--- +tools: + - name: imagemagick +--- + +# prompt user + +Use Imagemagick to convert the prompts/examples/imagemagick/*.svg files into a png images. + diff --git a/prompts/examples/jq.md b/prompts/examples/jq.md new file mode 100644 index 0000000..10ed3bb --- /dev/null +++ b/prompts/examples/jq.md @@ -0,0 +1,11 @@ +--- +tools: + - name: qrencode +--- + +# Prompt user + +Read the man page for qrencode + +Now construct a large QR Code in svg format for the url `https://www.docker.com` and save it to a file named docker.svg + diff --git a/prompts/examples/mcp-filesystem.md b/prompts/examples/mcp-filesystem.md new file mode 100644 index 0000000..ea00a3a --- /dev/null +++ b/prompts/examples/mcp-filesystem.md @@ -0,0 +1,42 @@ +--- +model: claude-3-5-sonnet-20241022 +tools: + - name: read_file + description: | + read a file from disk + Read the complete contents of a file from the file system. + Handles various text encodings and provides detailed error messages + if the file cannot be read. Use this tool when you need to examine + the contents of a single file. Only works within allowed directories. + parameters: + type: object + properties: + path: + type: string + container: + image: vonwig/bash_alpine + entrypoint: cat + command: + - "{{path|safe}}" + - name: write_file + description: | + Create a new file or completely overwrite an existing file with new content. + Use with caution as it will overwrite existing files without warning. + Handles text content with proper encoding. Only works within allowed directories. + parameters: + type: object + properties: + path: + type: string + content: + type: string + container: + image: vonwig/bash_alpine + command: + - "-c" + - "echo {{content|safe}} > {{path|safe}}" +--- + +# prompt user + +read the file deps.edn and then write the string "blah.txt" into the file test.txt diff --git a/prompts/examples/mcp-sqlite.md b/prompts/examples/mcp-sqlite.md index b573cdf..d8535e2 100644 --- a/prompts/examples/mcp-sqlite.md +++ b/prompts/examples/mcp-sqlite.md @@ -1,39 +1,48 @@ --- -description: | - A prompt to seed the database with initial data and demonstrate what you can do with an SQLite MCP Server + Claude +description: A prompt to seed the database with initial data and demonstrate what you can do with an SQLite MCP Server + Claude model: claude-3-5-sonnet-20241022 tools: - name: read-query description: Execute a SELECT query on the SQLite database - parameters: &query + parameters: type: object properties: query: type: string description: SELECT SQL query to execute - container: &sqlite - image: vonwig/sqlite:latest + container: &sqlite-container + image: &sqlite-image vonwig/sqlite:latest command: - - "/mcp/test1.db" + - &db "/mcp/test1.db" - "{{query|safe}}" - mounts: &mounts + volumes: &mounts - "mcp-test:/mcp" - name: write-query description: Execute an INSERT, UPDATE, or DELETE query on the SQLite database - parameters: *query - container: *sqlite + parameters: + type: object + properties: + query: + type: string + description: SQL query to execute + container: *sqlite-container - name: create-table description: Create a new table in the SQLite database - parameters: *query - container: *sqlite + parameters: + type: object + properties: + query: + type: string + description: CREATE TABLE SQL statement + container: *sqlite-container - name: list-tables description: List all tables in the SQLite database container: - image: vonwig/sqlite:latest + image: *sqlite-image command: - - "/mcp/test1.db" + - *db - "SELECT name from sqlite_master WHERE type='table'" - mounts: *mounts + volumes: *mounts - name: describe-table description: Get the schema information for a specific table parameters: @@ -43,11 +52,11 @@ tools: type: string description: Name of the table to describe container: - image: vonwig/sqlite:latest + image: *sqlite-image command: - - "/mcp/test1.db" + - *db - "PRAGMA table_info({{table_name}})" - mounts: *mounts + volumes: *mounts - name: append-insight description: Add a business insight to the memo parameters: @@ -61,7 +70,7 @@ tools: command: - "-c" - "echo '{{insight|safe}}' >> /mcp/insights.txt" - mounts: *mounts + volumes: *mounts prompt-format: django parameter-values: topic: Ocean Conservation diff --git a/prompts/examples/mcp_servers/extract.md b/prompts/examples/mcp_servers/extract.md new file mode 100644 index 0000000..467735d --- /dev/null +++ b/prompts/examples/mcp_servers/extract.md @@ -0,0 +1,13 @@ +--- +description: Add a new capability to your desktop +tools: + - name: curl +prompt-format: django +parameter-values: + image: mcp/puppeteer +--- + +# prompt user + +Use curl and the dockerhub api to fetch the full_description for the {{image}} image. +Then read the full description and just extract the json definition for how to configure it. diff --git a/prompts/examples/ollama.md b/prompts/examples/ollama.md new file mode 100644 index 0000000..9b50d9b --- /dev/null +++ b/prompts/examples/ollama.md @@ -0,0 +1,19 @@ +--- +extractors: + - name: project-facts +url: http://host.docker.internal:11434/v1/chat/completions +model: llama3.2 +stream: false +--- + +# Example prompt +Use top-level markdown headers to separate your markdown file into blocks. Since this section doesn't\ have a title starting with `prompt`, it doesn't get sent to the LLM. + +# Prompt system +You are an assistant who can write comedic monologues in the style of Stephen Colbert. + +# Prompt user +Tell me about my project. + +My project uses the following languages: +{{project-facts.languages}} diff --git a/prompts/examples/update-nix.md b/prompts/examples/update-nix.md new file mode 100644 index 0000000..3ff944e --- /dev/null +++ b/prompts/examples/update-nix.md @@ -0,0 +1,17 @@ +--- +mcp: + - mcp/fetch + - mcp/filesystem +model: claude-3-5-sonnet-20241022 +--- + +# prompt user + +My nix configuration is at /Users/slim/slimslenderslacks/nixos-config. + +My home manager configuration is at the relative path ./users/slim/home-manager.nix. + +Read and then update the flake.nix in the root of this project to add an input for ghostty. +Use the content at https://www.reddit.com/r/NixOS/s/7qH6JhQNF to figure out how to do this. + +Ready and then update my home manager configuration to add ghostty to my default profile. diff --git a/prompts/sql/Chinook.db b/prompts/sql/Chinook.db new file mode 100644 index 0000000..8c687ff Binary files /dev/null and b/prompts/sql/Chinook.db differ diff --git a/src/docker.clj b/src/docker.clj index c153da7..0e13276 100644 --- a/src/docker.clj +++ b/src/docker.clj @@ -108,7 +108,7 @@ ;; Tty wraps the process in a pseudo terminal {:StdinOnce true :OpenStdin true} -(defn create-container [{:keys [image entrypoint workdir command host-dir env thread-id opts mounts] :or {opts {:Tty true}} :as m}] +(defn create-container [{:keys [image entrypoint workdir command host-dir env thread-id opts mounts volumes] :or {opts {:Tty true}} :as m}] #_(jsonrpc/notify :message {:content (str m)}) (let [payload (json/generate-string (merge @@ -123,7 +123,7 @@ "/var/run/docker.sock:/var/run/docker.sock"] (when host-dir [(format "%s:/project:rw" host-dir)]) (when thread-id [(format "%s:/thread:rw" thread-id)]) - mounts)} + (or volumes mounts))} :WorkingDir (or workdir "/project")} (when entrypoint {:Entrypoint entrypoint}) (when command {:Cmd command})))]