nycdata
Enables to discover, inspect, query, and profile live NYC Open Data through a CLI and MCP server, providing a developer-first interface to Socrata APIs.
README
nycdata
A developer-first CLI and MCP server for discovering, inspecting, querying, and profiling live NYC Open Data.
nycdata sits above NYC's Socrata APIs. It does not mirror datasets or replace NYC as the source of truth. It makes the path from project idea to verified API integration faster and less error-prone.
Repository: https://github.com/HT224/nycdata
Status
Early MVP (0.2.0). Implemented CLI commands:
searchdescribequeryprofile
The MCP server exposes the same capabilities to coding agents. Planned next: generated types, saved queries, and deterministic client generation.
Requirements
- Node.js 20+
- No credentials required for normal public reads
- Optional Socrata application token for higher rate limits
Install locally
npm install
npm run build
npm link
nycdata --help
nycdata-mcp
For development without linking:
npm run dev -- search "restaurant inspections"
Optional token
export SOCRATA_APP_TOKEN="your-token"
The token is sent through the X-App-Token header. It is never added to URLs or generated output.
Discover datasets
nycdata search "restaurant inspections"
nycdata search "motor vehicle crashes" --limit 5
nycdata search "311 complaints" --format json
Inspect schema and metadata
nycdata describe 43nn-pn8j
nycdata describe erm2-nwe9 --format json
Query live data
nycdata query 43nn-pn8j --limit 5
nycdata query 43nn-pn8j \
--select "camis,dba,boro,grade,grade_date" \
--where "boro = 'Brooklyn' AND grade = 'A'" \
--order "grade_date DESC" \
--limit 10
nycdata query 43nn-pn8j \
--near "40.6895,-73.9724" \
--radius 1000 \
--location-field location \
--limit 10 \
--show-url
Formats:
nycdata query h9gi-nx95 --limit 10 --format table
nycdata query h9gi-nx95 --limit 10 --format json
nycdata query h9gi-nx95 --limit 10 --format csv
Profile before building
nycdata profile 43nn-pn8j
nycdata profile erm2-nwe9 --sample-size 250 --format json
Profiles are intentionally bounded. Row counts are queried live; null rates and cardinality are explicitly sample-derived so the CLI does not download an entire dataset by accident.
MCP server
nycdata-mcp runs a local stdio MCP server with four read-only tools:
search_datasetsdescribe_datasetquery_datasetprofile_dataset
Each tool uses the same live NYC Open Data client as the CLI. Query results are capped at 1,000 rows per call, profile samples are capped at 1,000 rows, and proximity radii are capped at 50 km.
After building the package, configure an MCP client to run:
{
"mcpServers": {
"nycdata": {
"command": "node",
"args": ["/absolute/path/to/nycdata/dist/mcp.js"],
"env": {
"SOCRATA_APP_TOKEN": ""
}
}
}
}
The token entry is optional. The server writes protocol messages to stdout and diagnostics to stderr.
Agent workflow
An agent can:
- search for candidate datasets;
- inspect the chosen dataset's actual fields and row semantics;
- run a small live query;
- profile data quality;
- build application code from verified results instead of guessed schemas.
Architecture
The CLI is a thin presentation layer over reusable TypeScript modules:
client.ts— catalog, metadata, and SODA requestsquery.ts— dataset validation and SoQL URL constructionprofile.ts— bounded data-quality analysisformat.ts— table, JSON, and CSV outputmcp.ts— stdio MCP transport and safe tool schemasindex.ts— public core exports for future CLI/MCP/scaffold consumers
See plan.md for scope, principles, milestones, and deferred work.
Development
npm run check
npm run test:live-mcp
check runs lint, TypeScript checks, unit/in-memory MCP tests, and the production build. test:live-mcp launches the built stdio server through a real MCP client and calls all four tools against live NYC data.
Data source
- Portal: https://opendata.cityofnewyork.us/
- Catalog: https://data.cityofnewyork.us/
- API documentation: https://dev.socrata.com/
Dataset schemas and update patterns vary by agency. Always inspect and profile a dataset before treating rows as canonical entities.
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。