# 1. Set up & start KubeMQ (/aiway/tutorial/setup)



This first step gets KubeMQ running locally and confirms the two Aiway doors — the **A2A** agent gateway and the **MCP** gateway — are live on the shared HTTP server (port `9090`). Both are enabled by default, so there is nothing to turn on.

<Callout type="info">
  Need Docker? Get it from [docker.com/get-started](https://www.docker.com/get-started/). Already have a KubeMQ server reachable on port `9090`? Skip straight to the probes in Step 2.
</Callout>

## Setup steps [#setup-steps]

<Steps>
  <Step>
    ### Start KubeMQ [#start-kubemq]

    Run KubeMQ locally with a single Docker command. This starts the broker with gRPC on port `50000`, the shared HTTP server (where the A2A and MCP gateways live) on port `9090`, and the dashboard on port `8080`.

    <RunKubeMQ ports="[50000, 9090, 8080]" />

    Confirm the dashboard is up at `http://localhost:8080`, then move on to verify the Aiway endpoints.
  </Step>

  <Step>
    ### Verify the A2A agent roster [#verify-the-a2a-agent-roster]

    The A2A gateway exposes the agent registry at `GET /agents`. On a fresh server the roster is empty — that is exactly what you want to see before registering an agent in the next step.

    ```bash title="Terminal"
    curl http://localhost:9090/agents
    ```

    You should get back an empty roster:

    ```json
    {
      "agents": []
    }
    ```

    An empty list confirms the A2A gateway is live and ready to accept registrations. You'll register `research-agent-01` here in Step 2.
  </Step>

  <Step>
    ### Verify the MCP gateway [#verify-the-mcp-gateway]

    The MCP gateway answers at `POST /mcp`. Open a session with a JSON-RPC `initialize` call — this negotiates the MCP protocol version (`2025-11-25`) and proves the gateway is reachable.

    ```bash title="Terminal"
    curl -X POST http://localhost:9090/mcp \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -d '{
        "jsonrpc": "2.0",
        "id": 1,
        "method": "initialize",
        "params": {
          "protocolVersion": "2025-11-25",
          "capabilities": {},
          "clientInfo": { "name": "aiway-tutorial", "version": "1.0.0" }
        }
      }'
    ```

    A successful handshake returns the server's protocol version and capabilities:

    ```json
    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "protocolVersion": "2025-11-25",
        "capabilities": { "tools": {} },
        "serverInfo": { "name": "kubemq-mcp", "version": "1.0.0" }
      }
    }
    ```

    <Callout type="info">
      The MCP **session** protocol version (`2025-11-25`) is a different field from the A2A **Agent Card** `protocolVersions` (which is `["1.0"]`, used when you register an agent in Step 2). They are two distinct layers — don't conflate them.
    </Callout>
  </Step>
</Steps>

With KubeMQ running and both Aiway gateways answering, you're ready to build an agent and register it with the fabric.

<Card title="Next: Build & register an agent" href="/aiway/tutorial/build-and-register-an-agent" description="Write a plain-HTTP Python agent — no KubeMQ SDK — and register its Agent Card with Aiway." />
