diff --git a/docs/MCP_GUIDE.md b/docs/MCP_GUIDE.md index 3621e98..5c749f6 100644 --- a/docs/MCP_GUIDE.md +++ b/docs/MCP_GUIDE.md @@ -1,10 +1,34 @@ # Dive MCP Server: Comprehensive Guide -This guide provides detailed instructions on how to run the `dive` Model Context Protocol (MCP) server and connect various clients to it. The MCP integration allows AI agents to programmatically perform deep container image analysis. +This guide provides detailed instructions on how to build and run the `dive` Model Context Protocol (MCP) server and connect various clients to it. --- -## 1. Running the Dive MCP Server +## 1. Building the Server + +Before running the MCP server, you need to build the `dive` binary from source to ensure you have the latest MCP features. + +### Prerequisites +- **Go**: Version 1.24 or higher. +- **Task** (Optional): A task runner for simplified builds. + +### Standard Build (Recommended) +If you have `task` installed: +```bash +# Build the binary for your local platform +task build-local +``` +The binary will be created at `./dive`. + +### Manual Build +Alternatively, use the standard Go compiler: +```bash +go build -o dive ./cmd/dive +``` + +--- + +## 2. Running the Dive MCP Server The `dive` binary includes a built-in MCP server. You can run it using the `mcp` subcommand. @@ -39,7 +63,7 @@ dive mcp --transport sse --port 8080 --- -## 2. Connecting MCP Clients +## 3. Connecting MCP Clients ### Claude Desktop Add `dive` to your `claude_desktop_config.json` (usually found in `%APPDATA%\Claude\claude_desktop_config.json` on Windows or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS). @@ -86,7 +110,7 @@ mcpServers: --- -## 3. Available Tools & Capabilities +## 4. Available Tools & Capabilities Once connected, your AI agent will have access to the following tools: @@ -104,7 +128,7 @@ Agents can also "read" analysis results via URI: --- -## 4. Powerful Usage Examples +## 5. Powerful Usage Examples Once the server is connected, you can use natural language prompts to perform complex analysis. Here are a few examples of what you can ask your AI agent: @@ -125,7 +149,7 @@ Once the server is connected, you can use natural language prompts to perform co --- -## 5. Security & Performance Tuning +## 6. Security & Performance Tuning ### Security Sandbox To prevent the AI from accessing arbitrary tarballs on your host, use the sandbox flag to restrict `docker-archive` lookups: @@ -150,7 +174,7 @@ mcp: --- -## 5. Troubleshooting: "Missing sessionId" +## 7. Troubleshooting: "Missing sessionId" If you encounter a `Missing sessionId` error when using SSE, ensure you are providing the `Mcp-Session-Id` header in your HTTP requests. **Recommendation:** Switch to the `streamable-http` transport and use the `/mcp` endpoint, which handles session negotiation automatically during the initial handshake.