---
title: "Streaming chat via Claude Agent SDK + MCP (replaces /v1/chat-stream)"
method: POST
path: "/v1/agent/chat"
tags: ["Agent"]
---

# Streaming chat via Claude Agent SDK + MCP (replaces /v1/chat-stream)

`POST /v1/agent/chat`

## Request

- Base URL: `https://spss.insightgenius.io` (the document declares no server; this is the origin it was published from)
- URL: `https://spss.insightgenius.io/v1/agent/chat`
- Auth: none declared

Open an Agent SDK session and stream the response.

The agent connects to our own MCP server over loopback SSE, executes tools
to compute answers, and streams results back to the browser as SSE events.
Every tool call is logged to agent_tool_calls (Supabase).

file_id resolution priority:
  1. Explicit file_id in the form (used by /try light demo + stateless API).
  2. project_id → primary file (used by the full app at /app where the
     user is logged in and we know which project they're working on).

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/insightgenius/apis/spss-insightgenius-api.md) · [All operations](https://skmtc.dev/insightgenius/apis/spss-insightgenius-api/llms.txt) · [OpenAPI document](https://skmtc.dev/insightgenius/apis/spss-insightgenius-api/revisions/0d165df595f0?raw)
