sodabar
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sodabar How many rodent complaints are there in each NYC borough?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sodabar π₯€
An MCP server that puts open data on tap β four tools that let any LLM client search, inspect, and query 30,000+ civic datasets, with guardrails designed for a model on the other end.
Live demo: usmar-sodabar.static.hf.space β the same console, answered in your browser straight from the live NYC Open Data API.
The problem β and why it matters
Socrata powers the open-data portals of NYC, Chicago, Seattle, and hundreds of other governments β tens of thousands of live, queryable datasets. But an LLM can't use any of it directly: it doesn't know which datasets exist, what their columns are called, or how to write a SoQL query against them. And if you naively hand a model a raw HTTP tool, it will page 500,000 rows into its own context window or paste an HTML error page into its reasoning.
sodabar is a Model Context Protocol server that closes that gap. It exposes the catalog β schema β query workflow as four typed tools, with the sharp edges filed off server-side: row caps a tool call cannot exceed, dataset-id validation that fails before a request leaves the machine, and upstream errors rewritten into messages a model can act on ("check the dataset id and domain") rather than tracebacks it will hallucinate around.
Point Claude Desktop, Claude Code, or any MCP client at it:
{
"mcpServers": {
"sodabar": {
"command": "/path/to/sodabar/.venv/bin/python",
"args": ["-m", "sodabar.server"]
}
}
}Related MCP server: data-detective
What an agent session looks like
docs/agent-demo.md is a committed transcript of Gemini driving the server through the real MCP stdio transport. Given only the four tools and the question "Which NYC borough has logged the most 'Rodent' 311 complaints so far in 2026?", the model planned three calls on its own:
search_datasets("311 Complaints")β founderm2-nwe9get_schema("erm2-nwe9")β learnedcomplaint_type,created_date,boroughquery_dataset(select="borough, count(*)", where="complaint_type = 'Rodent' AND created_date BETWEEN β¦", group="borough", order="β¦ DESC", limit=3)
and answered: Brooklyn 5,521 Β· Manhattan 3,528 Β· Queens 3,079. No SoQL was written by a human at any point.
docs/demo-transcript.md is the scripted equivalent β every tool exercised over a real stdio subprocess session, regenerated with make demo.
The four tools
Tool | What it answers |
| "What datasets exist about X?" β full-text catalog search |
| "What columns can I query, and what are their types?" |
| SQL-shaped aggregation and filtering via SoQL |
| "What values does this column take?" β vocabulary before |
domain defaults to data.cityofnewyork.us but accepts any Socrata portal (data.seattle.gov, data.cityofchicago.org, β¦), so one server covers hundreds of cities.
The playground
make serve starts a FastAPI app whose REST routes mirror the MCP tools one-to-one β the console shows the exact tools/call envelope and the exact result an LLM client would see:

Guardrails are part of the demo. A malformed tool call gets a readable, actionable error β not a traceback:

The live static deployment serves the identical HTML with a 4 KB fetch shim that answers the /api/* routes in-browser, straight from the Socrata APIs (which send Access-Control-Allow-Origin: *) β a zero-backend demo of a backend project.
Key design decisions
Guardrails live server-side, not in the prompt.
$limitis clamped to 1,000 rows no matter what the model asks for; dataset ids must match Socrata'sxxxx-xxxxform (which also blocks path traversal through the resource URL); domains must be bare hostnames. A prompt can be ignored β a clamp cannot.Errors are written for the model that reads them. A 404 becomes "not found β check the dataset id and domain"; a SoQL 400 surfaces Socrata's own message with "check your SoQL syntax". The retry policy distinguishes transient failures (429/5xx: three attempts with backoff) from semantic ones (400/404: fail immediately).
One client, three consumers. The MCP server, the FastAPI playground, and the demo scripts share one
SocrataClient, so timeout, retry, and error behavior can't drift between what's tested and what's deployed.Tool descriptions teach the workflow. The server's
instructionsand each tool's docstring steer a model towardsearch β schema β queryand toward aggregating withgroupinstead of paging raw rows β the difference between a 6-row answer and a 6,000-row context spill.Tests mock the transport, not the code. All 54 tests run against
httpx.MockTransportβ CI needs no network and finishes in under a second, while retry logic, error mapping, and the FastAPI lifespan wiring are exercised for real.
Limitations
SoQL clauses are passed through to Socrata after shape checks, not parsed β a syntactically valid but expensive query (e.g.
groupon a high-cardinality column) is bounded by the row cap and Socrata's own timeouts, nothing stricter.Catalog search relies on Socrata's relevance ranking, which favors title matches; an agent may need two searches with different phrasings.
Anonymous (keyless) Socrata access is throttled upstream; sustained heavy use would need an app token, which the client doesn't currently send.
The committed transcripts hit the live API, so re-running
make demowill show current counts, not the committed ones.
Reproduce it
git clone https://github.com/UsmarHaider/sodabar && cd sodabar
make venv # python3 -m venv + editable install
make test # 54 tests, no network needed
make demo # scripted MCP stdio session β docs/demo-transcript.md (live API)
make serve # playground at http://127.0.0.1:8012
cp .env.example .env # then fill in GEMINI_API_KEY to run:
make agent-demo # Gemini plans the tool calls β docs/agent-demo.mdProject layout
sodabar/
βββ sodabar/
β βββ soql.py # query validation: 4x4 ids, domain shape, row caps
β βββ client.py # shared Socrata HTTP client: retries, error translation
β βββ server.py # the MCP server (4 tools, stdio transport)
β βββ service.py # FastAPI playground mirroring the tools over REST
β βββ web/index.html # self-contained console UI (no build step, no CDN)
βββ scripts/
β βββ demo_session.py # scripted MCP client session β docs/demo-transcript.md
β βββ agent_demo.py # Gemini function-calling over the MCP session
β βββ screenshot.sh # headless-Chrome captures of the console
β βββ deploy_space.py # builds + publishes the static HF Space demo
βββ tests/ # 54 tests, all offline (httpx.MockTransport)
βββ docs/ # committed transcripts + UI screenshotsAvailable Tools
4 toolsget_schemaA
Get a dataset's name, description, and column names/types. Call this before querying so column names in SoQL clauses are exact.
Inputs: dataset_id (required), domain. Returns: object
profile_columnA
Show the most frequent values of one column with counts β a quick way to learn a column's vocabulary before writing a where clause.
Inputs: column (required), dataset_id (required), top, domain. Returns: result
query_datasetA
Run a SoQL query against a dataset. Clauses mirror SQL: e.g. select='borough, count(*) as n', where="created_date > '2026-01-01'", group='borough', order='n DESC'. Rows are capped at 1000 per call.
Inputs: dataset_id (required), group, limit, order, +4 more. Returns: result
search_datasetsA
Search a Socrata portal's catalog by keyword. Returns dataset ids, names, and descriptions. Use the returned id with get_schema/query_dataset.
Inputs: query (required), limit, domain. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: searching for datasets, retrieving schema details, executing queries, and profiling column values. There is no overlap or ambiguity in purpose.
All tool names follow a consistent verb_noun pattern (search_datasets, get_schema, query_dataset, profile_column), making the API predictable and easy to navigate.
With only 4 tools, the server is well-scoped for its purpose of exploring and querying Socrata datasets. Each tool is essential and contributes to a cohesive workflow.
The tool set covers the full lifecycle of dataset exploration: discover datasets, inspect schema, query data, and understand column vocabulary. No critical operations are missing for the stated purpose.
Maintenance
Related MCP Connectors
Hosted MCP server for live public-data APIs and Skills for AI agents.
Agent-native MCP server over 49M+ US public and government records, privacy-first, always current.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server for discovering, downloading, querying, and analyzing datasets from Ontario's open data portals, allowing natural language questions and high-performance analytics via DuckDB.231MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants the ability to connect to, query, profile, and monitor data sources β turning any LLM into an interactive data engineering copilot.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides safe, read-only access to Boston's open data portal, enabling natural language exploration of civic datasets.2GPL 3.0
- AlicenseAqualityDmaintenanceAn MCP server that gives LLM agents typed, cached access to civic open-data portals via Socrata (SODA 2.1 + Discovery API), enabling search, query, profiling, sampling, and CSV export of datasets.6MIT