sodabar
An MCP server that puts open data on tap, enabling LLM clients to search, inspect, and query 30,000+ civic datasets from Socrata portals with built-in guardrails like row caps and actionable error messages.
README
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
- What an agent session looks like
- The four tools
- The playground
- Key design decisions
- Limitations
- Reproduce it
- Project layout
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"]
}
}
}
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 |
|---|---|
search_datasets(query, domain, limit) |
"What datasets exist about X?" — full-text catalog search |
get_schema(dataset_id, domain) |
"What columns can I query, and what are their types?" |
query_dataset(dataset_id, select, where, group, order, limit, offset, domain) |
SQL-shaped aggregation and filtering via SoQL |
profile_column(dataset_id, column, top) |
"What values does this column take?" — vocabulary before where clauses |
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.md
Project 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 screenshots
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。