In a chat client (MCP)
The grid as an MCP App — the reader's keyboard and the model on one view.
@casoon/opengrid-mcp brings <opengrid-grid> into chat clients that support
MCP Apps. It is an adapter
over the public API, nothing in the grid knows about MCP. Installing it, its
sources and its tools are in the
package README.
In practice
The source is orders: 240 rows, whose CSV also holds margin and note — fields the
operator left out of fields.
- Open a source: “Open the orders as a grid.”
opengrid_openanswers with the session, the six columns andtotal: 240— no rows. - Filter and sort: “Only Germany, largest amounts first.”
opengrid_set_viewwith a filter oncountryand a sort onamountanswersFilter: country eq DE · Sort: amount desc · 88 matches; the grid applies it and says “Filtered by the assistant”. - The reader’s selection: the reader selects the four largest German orders in the grid
and asks “What’s odd about the rows I selected?”
opengrid_selectionreturns exactly those four rows: two identical orders, an amount with a quantity of 0, and a date after today. - Group and sum: “Revenue per country.”
opengrid_set_viewgroups bycountrywithamountsummed; the model getsGrouped by: country · 240 matches, the grid shows six group sums and a total. The new view clears the selection. - A field it may not name: “Which orders have the lowest margin?”
opengrid_set_viewwith a sort onmarginis refused:sort: margin is not a column of this grid.opengrid_describeconfirms the view is unchanged.
The view is the interface
Everything the reader chooses — sort, filters, columns, grouping, facets — is
one value, the view. The model works on the same value:
opengrid_set_view takes exactly what get_view returns, and opengrid_describe
answers with it. The server counts a view the model sets without a browser,
through the engine’s view_query — the same
translation the grid uses for get_query.
Two directions
| Reader → model | Each opengrid-view-change and opengrid-selection-change goes to the server, and one line goes into the model’s context: Filter: country eq DE · 52 matches · 3 selected. |
| Model → reader | The server keeps the session’s view. The grid asks for it when it becomes visible or focused and every few seconds while it is, and applies it with set_view(host, view, { notice }): one query, one announcement, the focus where it was. |
Rows
The grid’s rows come through an app-only tool; the model never receives a source. It receives rows only when the reader selects them and asks for an analysis — as the grid’s query plus the selected positions, read on the server.
In the host’s sandbox
A view runs under the host’s Content Security Policy, which allows no
WebAssembly. The package therefore ships the elements translated with wasm2js,
built from the same Rust as @casoon/opengrid, inlined into one HTML file.
tests/e2e/mcp-view.spec.js runs that file in a sandboxed iframe under the
hosts’ default policy, against the real server.