|
| 1 | +# Goose MCP Recipe Example |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This example demonstrates how to use [Goose][goose], an AI agent framework by |
| 6 | +Block, with the Envoy AI Gateway (aigw). It shows how to create a single agent |
| 7 | +that handles both LLM (Large Language Model) calls and MCP (Model Context |
| 8 | +Protocol) tool calls through the same gateway. |
| 9 | + |
| 10 | +Goose is an AI agent framework for tools and LLMs. MCP connects AI models to |
| 11 | +external tools. The [example recipe](kiwi_recipe.yaml) searches for flights |
| 12 | +from New York to Los Angeles on a specified date using the Kiwi flight search. |
| 13 | + |
| 14 | +This demonstrates single-agent origin, where all AI interactions, LLM and MCP, |
| 15 | +flow through the Envoy AI Gateway for observability, security, and routing. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +- Ollama installed and running. |
| 20 | +- Goose installed. |
| 21 | +- aigw binary installed. |
| 22 | + |
| 23 | +## Manual Steps |
| 24 | + |
| 25 | +1. **Start Ollama** on your host machine: |
| 26 | + |
| 27 | + Run Ollama on all interfaces with a large context size to support access from Docker and handle complex tasks. |
| 28 | + |
| 29 | + ```bash |
| 30 | + OLLAMA_CONTEXT_LENGTH=131072 OLLAMA_HOST=0.0.0.0 ollama serve |
| 31 | + ``` |
| 32 | + |
| 33 | +2. **Start aigw with MCP configuration**: |
| 34 | + |
| 35 | + Launch aigw in standalone mode to route LLM requests to Ollama and MCP requests to the Kiwi flight search server. |
| 36 | + |
| 37 | + ```bash |
| 38 | + OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_API_KEY=unused aigw run --mcp-json '{"mcpServers":{"kiwi":{"type":"http","url":"https://mcp.kiwi.com"}}}' |
| 39 | + ``` |
| 40 | + |
| 41 | +3. **Run the Goose recipe**: |
| 42 | + |
| 43 | + Execute the flight search recipe with Goose, directing it to the Envoy AI Gateway (port 1975) for both LLM and MCP access. |
| 44 | + |
| 45 | + ```bash |
| 46 | + OPENAI_HOST=http://127.0.0.1:1975 OPENAI_API_KEY=test-key \ |
| 47 | + goose run --provider openai --model qwen3:1.7b --recipe kiwi_recipe.yaml --params flight_date=31/12/2025 |
| 48 | + ``` |
| 49 | + |
| 50 | + - Replace `qwen3:1.7b` with your preferred Ollama model. |
| 51 | + - Set `flight_date` to a future date in DD/MM/YYYY format. |
| 52 | + |
| 53 | +4. **Verify the output**: |
| 54 | + |
| 55 | + The recipe outputs a JSON structure with the top 3 flight options from New |
| 56 | + York to Los Angeles, including airline, flight number, and price. |
| 57 | + |
| 58 | + Example output: |
| 59 | + |
| 60 | + ```json |
| 61 | + { |
| 62 | + "contents": [ |
| 63 | + { |
| 64 | + "airline": "Example Airlines", |
| 65 | + "flight_number": "EA123", |
| 66 | + "price": "$299" |
| 67 | + }, |
| 68 | + ... |
| 69 | + ] |
| 70 | + } |
| 71 | + ``` |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +[goose]: https://block.github.io/goose/ |
0 commit comments