ai-orders-agent

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.

Category
Visit Server

README

ai-orders-agent

Scroll-through of the live site at ai-orders-agent.vercel.app: the landing page ("Every order where AI met the bench"), headline stats (929 orders, 297 attorney sanctions, 631 with full text), the "Connect your own LLM" MCP / ChatGPT setup steps, and the /chat demo

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured