MCP server
Add one URL to an MCP-compatible app to use Queria. Sign-in, the usage allowance, and the tools and functions
Queria’s MCP server URL is https://mcp.queria.io. Add it to an app that supports MCP, and the AI finds and aggregates Queria’s data. Nothing needs installing.
- Steps with screenshots for Claude, ChatGPT and Microsoft 365 Copilot are in Use from AI chat
- Send your AI “Read https://docs.queria.io/en/setup.md and connect Queria”, and it walks you through adding it and checks the connection (Have your AI connect Queria)
- AI agents that can run commands, such as Claude Code and Codex, can do the same with the Queria CLI and the Queria skill. The CLI runs SQL on your computer, so the allowance below does not apply and no sign-in is needed
Adding it
claude mcp add --transport http queria https://mcp.queria.ioOpen /mcp inside Claude Code and pick queria to open Queria’s sign-in screen.
codex mcp add queria --url https://mcp.queria.io
codex mcp login queria{
"mcpServers": {
"queria": {
"url": "https://mcp.queria.io"
}
}
}Sign-in and consent
When you add https://mcp.queria.io, Queria’s sign-in and consent screen opens. Accounts are free.
- Approving hands the app an API token. With it, the AI can read the datasets and reports of the accounts you belong to (personal and organizations), private ones included. It can also create, edit and delete reports and change their visibility, and save tables (CSV or SQL results) as private datasets. It cannot delete datasets or change their visibility
- Queria instructs the AI to delete or publish reports only when you ask. Reports the AI creates are saved as private
- The app renews the connection while you use it. It expires after 90 days without use; reconnect from the app when that happens. Reconnecting from the same app revokes the token handed over before
- Connected apps appear under “Connected apps and devices” on the API tokens page with a name such as “Claude (MCP)”. Click “Disconnect” to stop the app from reading Queria data
- If the AI cannot use
save_table, connect again from the app. The new connection receives a token that allows saving tables - For an app that cannot open the sign-in screen, issue a token on the API tokens page and pass it as
Authorization: Bearer <API token>. To let the AI create or edit reports or save tables, issue the token with “Allow changes to datasets and reports” turned on - SQL that reads a private dataset runs on Queria’s server. The result rows go to the AI and are sent to the AI’s provider (Anthropic, OpenAI and so on). Do not ask the AI to aggregate datasets you do not want to hand over
How often the AI can check the numbers
The AI runs SQL with query to check numbers while it writes its answer, then shows tables, charts and maps in the conversation with show_chart at the end.
query runs within your plan’s weekly usage allowance. On the free plan that is about 200 SQL runs a week on their own. When it runs out, the AI stops looking further, answers from what it has found so far, and tells you when the allowance comes back. The Pro allowance is 10 times the free plan.
AI agents that can run commands, such as Claude Code and Codex, can run the same SQL on your computer with the Queria CLI (uvx queria sql). The CLI does not use the query allowance and needs no sign-in. Only the limit on data reads applies (Limits). Install the Queria skill to teach your AI how to use the CLI.
The show_chart view
show_chart shows the SQL result in a view inside the conversation, as a table, chart or map.
- The top of the view shows the AI’s description of the result: the data, the conditions and how the numbers were counted
- “Data used” below the table lists the tables the SQL read. Clicking one opens that table on its dataset’s page
- The table shows the first 200 rows. To sort or filter, ask the AI and it rewrites the SQL and shows the result again. URLs in the table are links that open the source page. The SQL is folded under “How it was calculated” at the bottom and can be opened to read. When there is a chart, the table is folded too
- The view appears in apps that support MCP Apps (claude.ai, Claude Desktop and others). In apps that cannot show it, the AI writes the numbers out instead
- SQL that reads a private dataset runs only on Queria’s server. When the result has many rows, the view shows only the first ones
Save your own data
The AI can save a CSV you give it, or the result of SQL it ran, as your own private dataset on Queria with save_table. Ask, for example, “Save this CSV to Queria”.
- Read the saved table as
<dataset name>.main.places.query,show_chartand report SQL can join it with other datasets like any other dataset - One save holds up to 1,000 rows. Column types of a CSV are detected automatically; a SQL result keeps its column types
- Saving again under the same name adds a new version of the same dataset. You cannot save under the name of a public dataset
- By default the table is saved to your personal account. To save to an organization, give the AI its handle
- Saving fails when it would exceed your storage limit for private datasets (Pricing)
- Connections an organization made read-only cannot save
Tools
| Tool | What it does |
|---|---|
list_datasets |
List datasets |
search_catalog |
Search datasets, tables and columns by keyword |
get_dataset |
A dataset’s description, license and sources |
list_tables |
List tables |
list_columns |
List columns |
query |
Run SQL and return the result rows to the AI |
show_chart |
Show an SQL result as a table, chart or map in a view in the conversation |
list_docs |
List the pages of these docs |
read_doc |
Read one page of these docs as Markdown |
list_reports |
List your reports, dashboards and maps |
create_report |
Create a report, dashboard or map |
update_report |
Change the content (also block by block) or visibility |
get_report |
Read the content (the block document, and Markdown for reports) |
delete_report |
Delete a report, dashboard or map |
search_reports |
Search the public reports (showcase) |
fork_report |
Copy a public report into a report of your own |
save_table |
Save a CSV or a SQL result as your own private dataset |
open_issue |
Open a public issue on a dataset for wrong data or a change request |
submit_feedback |
Report data you want or documentation errors to Queria |
Arguments and behavior are in the MCP tools reference.
Trade area SQL functions
In the SQL of query and show_chart, you can call trade area functions provided by Queria. The numbers match the radius trade area in area analysis. The datasets a function reads are added for you.
| Function | Returns |
|---|---|
trade_area_population(lng, lat, radius_m) |
Population, households and number of small areas inside the circle (one row). Columns: population, households, small_areas |
trade_area_small_areas(lng, lat, radius_m) |
The small areas the circle overlaps, with population and households apportioned by overlapping area. Columns: key_code, city_name, area_name, source_population, source_households, share, population, households |
trade_area_facilities(lng, lat, radius_m) |
Shops and facilities inside the circle (unattended equipment such as ATMs and vending machines excluded). Columns: longitude, latitude, name, industry_code, industry_name (middle group of the Japan Standard Industrial Classification), address, phone, website, source_as_of |
trade_area_land_prices(lng, lat, radius_m) |
Land price points inside the circle (latest year of each survey). Columns: longitude, latitude, land_price_type_name, year, use_category, current_price (yen/m²), change_rate, place_name |
trade_area_competition(lng, lat, radius_m, points) |
Population and number of competitors inside the circle (one row). points is the name of a table (dataset.schema.table) with lng, lat and verified (boolean) columns, whose points are counted as competitors. verified tells whether the store has been confirmed to exist. Columns: population, households, competitors, verified_competitors, population_per_store (population ÷ (competitors + 1)), population_per_verified_store (population ÷ (verified_competitors + 1)) |
lng and lat are longitude and latitude within Japan. The radius radius_m is 100 to 3000 (m). These functions work only inside the MCP server, not in reports or the CLI. Travel-time areas by walking, cycling or driving are drawn with the map block in reports (Pro) (Create reports).
SELECT * FROM trade_area_population(139.393896, 35.679414, 1000)
trade_area_competition returns the population per store if one more store opened. The function has no threshold for “few competitors”; write that comparison in your SQL.
SELECT * FROM trade_area_competition(139.393896, 35.679414, 800, 'stores.main.places')
When the columns of the table have other names than lng, lat and verified, rename them in a WITH clause of the same SQL and pass the WITH name as points.
WITH competitors AS (
SELECT longitude AS lng, latitude AS lat, is_open AS verified FROM stores.main.places
)
SELECT * FROM trade_area_competition(139.393896, 35.679414, 800, 'competitors')
SQL function for addresses
Inside the SQL of query and show_chart, geocode turns addresses into coordinates, town IDs and postal codes. It calls the Queria Geocoder API once per address.
| Function | Returns |
|---|---|
geocode(addresses) |
One row per address. Columns: address (the address you passed), matched_address, lat, lng, match_level, coordinates_level, lg_code, machiaza_id (ABR town ID), postal_code, evidence (match evidence) |
Pass the addresses as a list: up to 100 per call, each up to 100 characters. Each distinct address is looked up once. An address that does not match comes back as a row with only address filled. A table column cannot be passed directly, so join the result back to your table on address.
evidence holds the source of the point the coordinates came from (evidence.point), which part of the address matched which town and number (evidence.matched), and the extra matching steps used (evidence.steps). See include=evidence in the Queria Geocoder API reference for each field.
SELECT * FROM geocode(['東京都千代田区紀尾井町1-3', '東京都千代田区千代田1-1'])
SQL function for company names
Inside the SQL of query and show_chart, resolve_company turns Japanese company names into corporate numbers (法人番号). It calls the Queria Company Resolver API (https://company-resolver.queria.io/v1/forward/batch) with up to 20 companies per request.
| Function | Returns |
|---|---|
resolve_company(names, addresses := NULL) |
One row per name and address pair. Columns: name (the name you passed), address (the address you passed), status, same_name_count, corporate_number, matched_name, prefecture, city, lg_code |
Pass the names as a list: up to 100 per call, each up to 200 characters. To pass addresses, give a list of the same length, with NULL for companies without an address. Each address can be up to 200 characters. Companies in the city of the address are ranked first.
status is the result of the match: matched means exactly one company matched, ambiguous means several companies meet the same conditions (their count is in same_name_count), candidates means there is no exact match but similar companies exist, and not_found means there are no candidates. The corporate_number and following columns describe the top candidate, so filter on status = 'matched' to keep only confirmed matches. A table column cannot be passed directly, so join the result back to your table on name (and address).
SELECT * FROM resolve_company(['トヨタ自動車株式会社', '株式会社クエリア'], addresses := ['愛知県豊田市', NULL])
SQL function for combining shop lists
Inside the SQL of query and show_chart, merge_points combines two point tables, such as your own list of shops and a shop dataset. The same shop appears only once.
| Function | Returns |
|---|---|
merge_points(points, others) |
Every row of points, plus the rows of others that are not the same shop as any row of points. The columns of both tables are matched by name (a column that only one table has is NULL in the other table’s rows), with source (the name of the table the row came from) and merged (the number of others rows merged into the points row) added. Input columns named source or merged are replaced with these values |
Pass points and others as table names (dataset.schema.table) or as names from a WITH clause in the same SQL. Both need name, lng and lat columns. Other columns are optional. points can have up to 10,000 rows.
Two rows are treated as the same shop when the shorter name is contained in the longer one (including identical names) and they are within 100 m of each other. Names are compared after converting full-width letters and digits to half-width, lowercasing letters and removing spaces and symbols. The shorter name must be at least 2 characters long and at least a quarter of the length of the longer one.
Narrow others to the area and type of shop in the WITH clause before passing it. To pass the result to trade_area_competition, it needs a verified column. When only one table has verified, the other table’s rows have NULL there, so fill it with coalesce as in the example below.
WITH mine AS (
SELECT 店名 AS name, lng, lat FROM cafes.main.places
),
stores AS (
SELECT name, longitude AS lng, latitude AS lat, is_open AS verified
FROM stores.main.places
WHERE city_code = '13212' AND category = 'cafe'
),
merged AS (
SELECT * REPLACE (coalesce(verified, true) AS verified) FROM merge_points('mine', 'stores')
)
SELECT * FROM trade_area_competition(139.393896, 35.679414, 800, 'merged')
How an AI can read these docs
With the MCP tools
From an MCP app, list_docs and read_doc read these docs. Arguments are in the MCP tools reference.
With the CLI
queria docs list lists the pages, and queria docs show <name> prints one page as Markdown.
queria docs list
queria docs show reference/mcp-tools
Options are in the CLI reference.
From a URL
These docs are also published in forms you can read without parsing HTML.
https://docs.queria.io/llms.txt: an index of the pageshttps://docs.queria.io/llms-full.txt: all pages as one text- Add
.mdto the end of a page URL to get its Markdown (e.g.https://docs.queria.io/reference/mcp-tools.md)
queria --help, queria --version and the MCP server’s instructions point to these as well.
