AI with Jspreadsheet Server
ULTIMATE
Jspreadsheet Server owns the live copy of every document, so its AI features work on the same spreadsheet the users are editing, under the same permissions, and their changes reach everyone in real time.
Three ways in
| AI agent | MCP server | PROMPT formula | |
|---|---|---|---|
| Package | @jspreadsheet/server-agent |
@jspreadsheet/mcp |
@jspreadsheet/openai |
| Who talks to the model | Your server | The AI client | Your server |
| Where the user is | In your application, in a chat next to the spreadsheet | In Claude Code, Claude Desktop, an IDE or another agent | In a cell |
| What it does | Reads the document and edits it with tools, in a conversation | Exposes documents as MCP tools the client discovers and calls | Computes a cell from a prompt |
| Who pays for the model | You, with quotas through hooks | The client's owner | You |
All three reach the document through the server, so they can be combined: a team works in the browser while an analyst's Claude Code edits the same workbook through MCP, and the in-app assistant answers questions about both.
What they share
- The live document. No exports or stale copies: the AI reads what a person wrote a second ago.
- Your authentication. Every request carries the user's token into the
beforeConnect,beforeLoadandbeforeChangehooks, so the AI can open and change exactly what its caller can. See Authentication. - One write path. An AI edit is an ordinary operation: validated, applied, persisted by your adapter and broadcast. Your storage never needs to know an AI was involved.
- Formulas stay formulas. The agent and MCP write
=SUM(B2:C2), not today's result, so the spreadsheet keeps working afterwards.
The AI agent
A streamed chat that turns plain-language requests ("add a total per region", "highlight the overdue tasks", "chart Q2 by product") into spreadsheet operations. It reads the document, calls tools until the job is done, and streams its answer. Requests can include attachments (Excel, CSV, PDF and images).
For products that expose AI to their own users, it provides the necessary controls:
allowrefuses a prompt before it costs anything: per-user or per-address budgets, a site-wide budget, rate limits, attachment limits.usagereceives the token counts of every model call, for budgets and billing.promptkeeps conversations in sessions, in your storage.
The MCP server
The mcp extension serves your documents over the Model Context Protocol at /mcp, with tools to list, read, create and edit them. Claude Code, Claude Desktop, IDE assistants and agents built on the MCP SDKs can use them with the token they carry.
claude mcp add --transport http sheets https://sheets.example.com/mcp \
--header "Authorization: Bearer <token>"
The PROMPT formula
=PROMPT("Translate ", A2, " to French") joins its arguments into a prompt for an OpenAI model. The browser shows a placeholder while the server, which holds the API key, evaluates the prompt and broadcasts the result into the cell for everyone.
Intrasheets
Intrasheets is the Excel-like application built on these pieces; its AI assistant is a chat pane that calls the agent. Try both on a shared workbook in the Intrasheets demo.
Cost and privacy
- Budgets. The agent and the formula spend your model credits. Set quotas with the agent's
allowandusagehooks before opening the assistant to the public. See Usage & billing. - Model choice. A small, fast model such as Claude Haiku covers most spreadsheet requests at a fraction of the cost; keep a larger model for heavy analysis.
- Data. The model provider receives only the document of the request and its attachments. MCP clients receive only what their token can read.
- Keys. Model keys live on the server, never in the browser.