Skip to content

Instantly share code, notes, and snippets.

@codefromthecrypt
Last active April 10, 2025 02:54
Show Gist options
  • Save codefromthecrypt/8a96493bee2c2b45a513073dc5a6811a to your computer and use it in GitHub Desktop.
Save codefromthecrypt/8a96493bee2c2b45a513073dc5a6811a to your computer and use it in GitHub Desktop.
Goose MCP practice

Source diagram of this LI post on goose https://www.linkedin.com/posts/adrianfcole_genai-opensource-activity-7315217199844003840-sX7Q

sequenceDiagram
    participant CLI as Goose CLI
    participant MCP as MCP Server (developer)
    participant LLM

    Note over CLI: User runs `goose run -t "list the files in this directory"`
    Note right of CLI: Forks own binary to start MCP server for "developer" via stdio
    activate MCP
    MCP ->> MCP: Initialize and ready
    deactivate MCP

    CLI ->> MCP: initialize: {clientInfo, protocolVersion}
    activate MCP
    MCP -->> CLI: response: {capabilities, instructions, serverInfo}
    deactivate MCP

    CLI ->> MCP: tools/list
    activate MCP
    MCP -->> CLI: response: {tools: [{name: "shell", ...}, ...]}
    deactivate MCP

    CLI ->> LLM: user: "list the files in this directory"
    activate LLM
    LLM ->> CLI: assistant: {toolRequest: {name: "developer__shell", args: {command: "ls -l"}}}
    deactivate LLM

    CLI ->> MCP: tools/call: {name: "shell", args: {command: "ls -l"}}
    activate MCP
    MCP -->> CLI: response: {result: {content: [{text: "total 496\n-rw-r--r-- ..."}]}}
    deactivate MCP

    CLI -->> LLM: [user, assistant, tool: "total 496\n-rw-r--r-- ..."]
    activate LLM
    LLM ->> CLI: content: "Here are the files: * ACCEPTABLE_USAGE.md\n..."
    deactivate LLM

    Note over CLI: Displays to user: "Here are the files: * ACCEPTABLE_USAGE.md\n..."
    
    CLI ->> MCP: Close stdin
    activate MCP
    MCP ->> MCP: Exits
    deactivate MCP
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment