Chat with your data, without handing it over
- written by Roland BOLE (Instructor)
How a canister on an OpenCloud cloud engine stays the source of truth while ChatGPT or Claude asks the questions.
Blog image

Most “chat with your data” products start the same way: you give the AI your data. You upload a CSV, sync a folder into a vector index, or paste a database connection string into a third-party dashboard. From then on there are two copies of your data, yours and the one the model sees, and you have to trust that they stay in step and that the second copy is looked after as carefully as the first.

Hugo ask is a small, non-commercial demo for learning that does it the other way round. The data lives in exactly one place: a Motoko canister running on an OpenCloud cloud engine. ChatGPT and Claude never receive the dataset. Either one connects through the ICP MCP connector, signs in with the user’s Internet Identity, and calls a few read-only query methods. The canister answers from its own rows, and the assistant turns those answers into language.

The model does the talking. The canister does the counting, and decides who may ask.

What the demo contains

The app is two canisters on an OpenCloud engine subnet.

The backend is written in Motoko. It holds a 500-row snapshot of the Tobi-Bueck/customer-support-tickets dataset, published by Tobi Bück under CC BY-NC 4.0. The full dataset has 61,765 tickets, far too many to compile into a canister, so the snapshot is stratified: English and German tickets both appear, along with every priority from very_low to critical. Each ticket has a subject, body, reply, type, queue, priority, language and up to three tags. The rows are compiled directly into the canister, so answering a question never involves a call to Hugging Face or any other outside service.

The frontend is a static Astro site served from an asset canister. The cloud engine serves it under a readable domain, askhugo.samlinux–saz.opencloud.me, instead of only the raw canister address dud23-qyaaa-aaac3-qaaba-cai.icp0.io. It explains how the system works, shows the frontend canister id, and walks a user through connecting the ICP MCP connector in ChatGPT or Claude. It also has an Access page where people sign in and request access and where the admin approves them. The frontend publishes one other important file: /.well-known/ic-architecture, a small JSON manifest that lists the canisters belonging to this app.

There is no chat box on the website. You ask in ChatGPT or Claude.

How a question travels

12345678910111213frontend canister id, then a questiontool call (signed in with Internet Identity)GET /.well-known/ic-architecturedeclared canisters: frontend, backendread Candid interfacegetApiDoc(), schema()API guide + column catalogueexecute({ filters, groupBy, count })execute(json) as the user's principalrun the queryrows of named cellsresultanswer in plain languageUserChatGPT or ClaudeICP MCP connectorFrontend canisterBackend canisterUserChatGPT or ClaudeICP MCP connectorFrontend canisterBackend canister

First, the user adds the Internet Computer (ICP) plugin by DFINITY in ChatGPT, or adds the same connector in Claude at https://mcp.internetcomputer.org/mcp, and signs in with Internet Identity. The “Questions only” permission level is enough, because every data method is a query that cannot change state.

Next, the user pastes the frontend canister id into the chat. The Connect page shows that id. The connector opens the app from it and fetches the manifest. This is the trust boundary on the app’s side: the connector only calls canisters that the manifest declares.

The connector then reads the backend’s Candid interface, which is embedded in the Wasm module, and the assistant calls getApiDoc() and schema(). The API guide explains how to write a query. The schema lists every column, its type and what it means. With those two documents, the assistant can translate a question such as “How many high-priority tickets are in each queue? Then show me five German ones, subject and queue only” into one or two execute calls.

Finally, the canister on the OpenCloud engine runs the query against its own data and returns a page of rows, each a list of named cells. The assistant reads them and writes the answer.

A small, honest query language

execute takes a single JSON document. It isn’t SQL, and that’s intentional. A small language is easy for a model to learn from one page of documentation, and easy for a canister to run safely.

It supports three kinds of building blocks:

Filters

Narrow down the rows. contains works on text columns.

eqneqgtgteltltecontains
Shaping

Choose the columns, sort the rows and page through them.

selectorderBydesclimitoffset
Aggregates

Compute numbers over the rows, optionally grouped by one column.

countsumavgminmaxgroupBy

Results come back in pages with a hard cap. When the long text fields (body or answer) are selected, a page holds at most 20 rows; otherwise it holds 50. A ticket body averages around 420 characters, so even a full-text page stays far below the Internet Computer’s 2 MB limit on query responses. A response includes hasMore, so the model knows when to fetch the next page.

Mistakes don’t crash anything. An unknown column, an unknown operator or a limit above the cap returns an error message, which the model can read and correct.

The aggregates are the point of the design. When the assistant says “there are 23 high-priority tickets in Technical Support,” that number was computed by the canister over the real rows. It wasn’t estimated by a model reading a sample of text, and it can’t come from a stale copy, because there is no copy.

Identity is the access control

Every call that reaches the backend through the connector is signed with the user’s Internet Identity. The canister therefore knows the caller’s principal on every request, without passwords, API keys or tokens pasted into a prompt.

Access control is a short list of principals kept in the backend. Who may call which method depends on the caller’s role:

Canister controller

Takes the admin role. Any previous admin stays on the list as an enabled member. This is the recovery path if the admin’s Internet Identity is lost.

claimAdmin()
Any signed-in user

Is recorded as pending. Asking again does not change a decision, and a request never grants admin.

requestAccess()
Admin

Manages the list from the Access page. Enabling turns a pending or disabled principal on. Removing deletes a non-admin record and frees the slot. The admin cannot disable or remove itself, and the anonymous principal cannot be enabled or removed.

setAccess(principal, enabled)removeAccess(principal)listAccess()
Enabled users

Can read the API guide, the schema and the data. Everyone else gets “Access denied. Ask the admin to enable your Internet Identity.”

getApiDoc()schema()execute()

Anonymous callers of the update methods are rejected even earlier, in the canister’s inspect hook, before their arguments are decoded.

The website signs users in with a fixed derivation origin. As a result, the principal a user sees on the Access page is the same principal the connector presents when it calls the backend on that user’s behalf. So when the admin approves someone on the website, that person’s ChatGPT or Claude session can read the data, and disabling or removing them cuts it off again. No secret is ever shared with the model.

Why a cloud engine

OpenCloud cloud engines run canisters with zero cycles. The engine operator pays at the engine level, so the app itself doesn’t manage a token balance or top-ups. The design respects that model:

Self-contained

No call attaches cycles, and the backend makes no calls to other subnets. The data and the logic sit in the same canister.

No inference

Engines do offer an inference endpoint through the engine operator, but a public chat method would let anyone who can call it spend the engine’s inference credit. The user brings their own model, here ChatGPT or Claude, and the canister only serves data.

Self-describing API

The Candid interface is kept in the Wasm metadata, so the connector can discover the API without any extra configuration.

This divides the work cleanly. The engine provides cheap, always-on, tamper-resistant compute and storage for the data. The assistant provides language understanding. The user’s Internet Identity links the two.

What this demonstrates

  • One copy of the truth. The dataset lives in a canister on an OpenCloud cloud engine, and that canister is the source of truth. The AI queries it but never holds it.
  • Exact answers. Counts, filters and groupings are computed deterministically by the canister, and the model only puts them into words.
  • One identity for people and their assistants. Internet Identity is both the login for the website and the credential behind the assistant’s calls, and one admin decides who gets in.
  • Discovery by manifest. A single JSON file plus a self-describing API is everything an assistant needs to start using an app, once it has been given the frontend canister id. No custom plugin for this app, and no hosted middleware.

Limits, stated plainly

  • The data is a fixed snapshot. Changing it means a new build and deploy, and on purpose there is no method that uploads or replaces rows.
  • There is one read-only table and a small query language, not a general database.
  • The dataset’s licence is non-commercial, so this is a demo for learning. A product would need data it is allowed to use commercially.
  • Publishing the ic-architecture manifest counts as accepting the ICP MCP App Operator Terms. Only the person operating the app can make that decision.

Try it

All you need is ChatGPT or Claude and an Internet Identity. Setting it up takes three steps, and only the second one involves waiting.

1. Connect your assistant

  • ChatGPT: add the Internet Computer (ICP) plugin by DFINITY.
  • Claude: add a connector with the URL https://mcp.internetcomputer.org/mcp.

In both cases, sign in with your Internet Identity and choose the permission level Questions only. That’s all the demo needs, because every data method is a read-only query.

2. Request access

Open the Hugo ask site and go to the Access page. Sign in with the same Internet Identity you used in step 1 and click to request access. Your principal is now pending until the admin enables it. Approval happens by hand, so it can take a little while.

Open Hugo ask

3. Ask your first question

Start a new chat and paste the frontend canister id together with your question. The Connect page shows the id as well.

Frontend canister id: dud23-qyaaa-aaac3-qaaba-cai

How many high-priority tickets are in each queue? Then show me five German ones, subject and queue only.

The assistant reads the API guide, looks up the schema, queries the canister and answers. Every number in its reply comes from the canister on the OpenCloud engine.

Once the assistant knows the canister, follow-up questions work without the id. A few to start with:

  • What share of the tickets is written in German, and what share in English?
  • Which three queues have the most critical tickets?
  • Show me ten incidents from Technical Support, subject and priority only.
  • Which tags appear most often on high-priority tickets?
  • Find tickets whose subject contains “login” and show how the support team answered them.
Highlight img
If something doesn't work
  • “Access denied. Ask the admin to enable your Internet Identity.” Your request is still pending, or you signed in with a different Internet Identity on the website than in the assistant. Both must be the same.
  • The assistant doesn’t use the canister. Check that the ICP connector is enabled for this chat, and paste the frontend canister id again.
  • The assistant guesses instead of querying. Ask it explicitly to query the canister, for example “Use the Hugo ask canister to count …”.

Dataset: Tobi-Bueck/customer-support-tickets by Tobi Bück, CC BY-NC 4.0. A 500-row stratified sample is used here as a non-commercial demo for learning.