ai-orders-agent
Enables querying and filtering a read-only dataset of AI-related court orders with full-text search, facets, and record retrieval via MCP, OpenAPI, or REST endpoints.
README
ai-orders-agent

The live deployment at ai-orders-agent.vercel.app.
Agent-facing service for the AI Court Orders dataset — one Vercel project that exposes the same queries four ways:
- Chat (
/chat) — a hosted chat UI; ask in plain English, no setup. A funded, rate-limited LLM (OpenRouter DeepSeek by default) answers by calling the dataset tools (see Chat below). - MCP (
/api/mcp) — add as a custom connector in Claude Desktop / claude.ai, or any MCP client. - OpenAPI (
/openapi.json) — import into a ChatGPT GPT (Actions) or any function-calling LLM. - REST/JSON (
/api/*) — call directly from code or the browser.
It is read-only and stateless: it live-fetches the dataset the AI-orders-explorer repo publishes (that repo owns the data pipeline, the human web explorer, and the Claude-Code skill — this one is purely the agent surface) and caches it in memory.
Data source
Set ORDERS_DATA_BASE to where the dataset (explorer_data.json and
bar_opinions.json) is published. Defaults to the live published copy at
https://legalhack.io/data (943 records). See .env.example.
Endpoints
GET /api/search?q=&<filters>&limit=&full=&count= |
full-text search + filters |
GET /api/list?<filters> |
filter without a text query |
GET /api/record/{id} · GET /api/pdf/{id} |
one record · its PDF/links |
GET /api/facets?field=&limit=&all=&<filters> |
distinct values + counts (honors all search/list filters) |
GET /api/stats · GET /api/bar?state= |
summary · state-bar opinions |
GET /api/mcp · GET /openapi.json |
MCP endpoint · OpenAPI spec |
GET /chat · POST /api/chat |
hosted chat UI · streaming chat backend |
Filters (search/list/facets): judge (title-insensitive), court (alias-aware: sdny/S.D.N.Y./full name),
state, type, consequence, ai_type, applies_to (multi-value), source, jurisdiction,
tag, requires, date_from, date_to, has_pdf, has_link.
requires=<key> matches records whose reqs[key] is set — disclose (~128), certify_if_ai (~106),
verify, prohibited, certify_all, proprietary — answering "which courts require AI disclosure / a
certification?". Because facets honors every filter, facets?field=court&consequence=sanctions_attorney
ranks courts by attorney-sanction count and facets?field=court&requires=disclose ranks them by disclosure
requirements. The compact projection includes summary.
Chat
/chat is a streaming chat UI. The backend (POST /api/chat) runs a bounded
tool-calling loop: an LLM answers questions by calling the same dataset
operations the MCP/REST surfaces use (tool definitions are shared via
lib/tools.ts, so the surfaces never drift). It is read-only — the tools only
search and read the public dataset.
Provider. Default is OpenRouter (CHAT_PROVIDER=openrouter) on a cheap
DeepSeek model. Set CHAT_PROVIDER=anthropic or openai to switch; each reads
its own server-only key. Keys never reach the browser.
Rate limiting. The funded path is protected by three independent limits —
per-IP burst, per-IP daily cap, and a global daily kill-switch — backed by
Upstash Redis. Set UPSTASH_REDIS_REST_URL and
UPSTASH_REDIS_REST_TOKEN for the public deploy. Without Upstash, limiting
falls back to a best-effort in-memory limiter that is not durable across Vercel
invocations — fine for local dev, not safe for a public funded endpoint.
See .env.example for all chat/rate-limit variables.
Run / deploy
npm install
npm run dev # http://localhost:3000 (try /chat, /api/stats, /openapi.json, /api/mcp)
npm test # query-logic parity tests
vercel deploy # or push to a Vercel-connected GitHub repo
Connect it
- Claude (Desktop or claude.ai): add a custom connector pointing at
https://<your-deploy>/api/mcp. - ChatGPT: create a GPT → Actions → import
https://<your-deploy>/openapi.json. - Other LLMs / code: call the REST endpoints, or use the OpenAPI spec for function-calling.
Query behavior (court aliasing, title-insensitive judge match, multi-value
applies_to, facet placeholder handling) mirrors the explorer's orders CLI.
License
MIT — see LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。