pr-legislative-x402
Click on "Install 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., "@pr-legislative-x402search for bills about solar energy"
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.
pr-legislative-x402
Pay-per-call access to structured Puerto Rico legislative data, over the x402 agent-payment standard.
▶ Live demo: pr-legislative-x402.vercel.app — try /health, /v1/preview, /v1/bills/search?q=solar. (Sample data, payments off.)
An HTTP API + MCP server that lets AI agents search and read measures of the Puerto Rico Legislative Assembly (Asamblea Legislativa) — and pay per call in USDC on Base, autonomously, no accounts or API keys.
Data originates from OpenStates / SUTRA (public source); the value sold here is
the cleaned, structured, topic-tagged, bilingual layer that CivicaPR built
on top of it — the same corpus behind civicapr.com/legislacion (~4,900 measures).
Status: scaffold. Runs end-to-end on built-in sample data with zero secrets. Wire it to the live Neon DB + a wallet to go paid.
Why this exists (and why it protects the data, not exposes it)
The public site already serves this data free to any scraper. This project adds a separate, controlled, paid channel for machines — which is strictly more control than a public HTML page:
Read-only.
DATABASE_URLshould point at a role withSELECTonly. The code issues no writes.Bounded responses. Search returns summary rows capped at 25 (no abstract); full detail is a separate, pricier single-record call. Extracting the whole corpus therefore costs per bill — bulk scraping isn't cheap.
Neutral naming. Given the live
CIVICAtrademark conflict, this package is deliberately not branded "Civica."Free tier stays free. The human site is untouched; this is an additive paid API tier for agents.
Related MCP server: oom-x402-mcp
Architecture
Agent (Claude Code / OpenClaw)
│ calls MCP tools: search_pr_legislation, get_pr_bill
▼
MCP server (src/mcp) ── wraps fetch with wallet auto-pay (x402) ──┐
│ │ 402 → pay USDC on Base → retry
▼ ▼
HTTP API (src/server) ── x402 payment gate ──▶ priced routes ──▶ Neon `bills` (read-only)
free: /health, /v1/preview └─ falls back to sample dataPayment layer is isolated in src/server/x402.ts (seller) and
src/mcp/pay-fetch.ts (buyer) so the young x402 SDK can churn without touching
the rest of the app.
Quickstart (dev — no wallet, no DB)
npm install
npm test # bounds + paywall-config tests, on sample data
npm run dev:server # API on http://localhost:4021, payments OFF
# in another shell:
curl localhost:4021/v1/preview
curl 'localhost:4021/v1/bills/search?q=solar'
curl localhost:4021/v1/bills/PC%20456Point an agent at the MCP server (payments off):
PR_X402_API_BASE=http://localhost:4021 npm run dev:mcpEndpoints
Method | Path | Tier | Price* |
GET |
| free | — |
GET |
| free | — (corpus counts only) |
GET |
| paid |
|
GET |
| paid |
|
*Prices live in one place: src/server/routes.ts.
Going paid (production)
Point at real data — create the read-only role with
scripts/neon-readonly-role.sql, then setDATABASE_URLto that role's pooled Neon connection string.Set your receiving wallet —
RECEIVING_WALLET_ADDRESS= a Base address you control. (This project never handles a seller private key; USDC settles on-chain to that address.)Enable + configure the facilitator —
PAYMENTS_ENABLED=true, plus the Coinbase CDP keys the facilitator needs (CDP_API_KEY_ID/CDP_API_KEY_SECRET).Deploy — see "Deploy" below.
✅ The seller wiring (
src/server/x402.ts) is verified against the real@x402/express@2.xAPI — anx402ResourceServer+ExactEvmScheme, CAIP-2 networks,accepts-shaped routes — and the unpaid → 402 challenge is certified on Base Sepolia (npm run test:testnet). The remaining unproven leg is a live paid settlement (402 → pay → 200), which needs a funded testnet key — seeTESTNET.mdto run it, then flip to mainnet.
Deploy
Vercel (recommended for a data API). All routes rewrite to one serverless
function (api/index.ts) that runs the same Express app. vercel.json is
included.
vercel # link + preview deploy
vercel --prod # production
# set env in the dashboard (or `vercel env add`):
# DATABASE_URL, PAYMENTS_ENABLED, RECEIVING_WALLET_ADDRESS,
# X402_NETWORK, CDP_API_KEY_ID, CDP_API_KEY_SECRETContainer / VPS / your own box. A multi-stage Dockerfile is
included:
docker build -t pr-legislative-x402 .
docker run -p 4021:4021 --env-file .env pr-legislative-x402Option | Good for | Notes |
Vercel (serverless) | data API like this | Near-zero compute; reuses your existing stack. Recommended. |
Cheap VPS ($5/mo) / Docker | always-on control | Fine; more ops than Vercel for no real gain here. |
Closet box | selling compute (GPU/inference/transcription) | Only worth it when your marginal cost beats cloud. For a data API the box adds downtime/ISP risk with no upside — skip it here. |
Use it from an agent (MCP)
Copy examples/claude-mcp-config.json into a
project .mcp.json, point PR_X402_API_BASE at your deployment, and (for a
paid server) set a dedicated low-balance WALLET_PRIVATE_KEY. Tools exposed:
search_pr_legislation, get_pr_bill.
Quality gates
npm run typecheck·npm test(17 tests) ·npm run build— all run in CI (.github/workflows/ci.yml) on push/PR.HTTP layer: zod-validated inputs (400 on bad query/identifier), JSON 404 + error handlers, CORS, security headers, and a best-effort rate limit on the free routes. API described in
openapi.yaml.
Buyer side (agents that pay)
The MCP auto-pays only if WALLET_PRIVATE_KEY is set — use a dedicated,
low-balance Base key, never a treasury wallet. Unset = plain fetch, which
works against an open dev server.
Layout
src/
data/ schema.ts (types + zod inputs + limit clamp) · queries.ts (Neon, read-only) · mock.ts (sample corpus)
server/ routes.ts (price config) · x402.ts (seller gate) · middleware.ts (cors/ratelimit/errors) · app.ts · index.ts
mcp/ index.ts (tools) · pay-fetch.ts (buyer auto-pay)
api/ index.ts (Vercel serverless entry)
scripts/ neon-readonly-role.sql
examples/ claude-mcp-config.json
test/ bounds.test.ts · paywall.test.ts · validation.test.ts
openapi.yaml · vercel.json · Dockerfile · .github/workflows/ci.ymlMIT. Built by R21 Digital.
Available Tools
2 toolsget_pr_billA
Get full detail for one Puerto Rico legislative measure by identifier: abstract, sponsors, and action history.
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | Bill identifier, e.g. 'PC 456' or 'ps-123'. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does add context by listing what the full detail includes (abstract, sponsors, action history), which is useful. However, it does not disclose behaviors like error handling for invalid identifiers, rate limits, or whether partial data can be returned. This is moderate transparency for a read-only lookup tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that front-loads the verb and resource, lists the key return fields, and contains no filler. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter, get-by-id tool, the description is largely complete: it explains what the tool does, what the parameter is, and what the response contains. However, it does not mention the sibling search tool, which could help an agent decide between the two, and there is no output schema to clarify return format. This is a minor gap for the simplicity of the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%: the identifier parameter has a description with examples ('PC 456' or 'ps-123'). The description adds no additional parameter meaning beyond what the schema already provides; it merely repeats 'by identifier'. This meets the baseline for full schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's action ('Get full detail'), the specific resource ('one Puerto Rico legislative measure'), and the scope ('by identifier: abstract, sponsors, and action history'). This specific verb+resource+scope framing effectively distinguishes it from the sibling search tool, which is for searching legislation rather than retrieving full detail by ID.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit guidance on when to use this tool versus the sibling search_pr_legislation. The description implies the tool is for retrieving full details by identifier, but it does not state that search should be used when an identifier is unknown, nor does it mention any exclusions or alternatives. This lacks explicit usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_pr_legislationA
Search measures (proyectos y resoluciones) of the Puerto Rico Legislative Assembly by text, chamber, or status. Returns summary rows.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows (1-25). | |
| query | No | Free text matched against bill title or identifier (e.g. 'cannabis', 'PC 456'). | |
| status | No | Filter by status slug, e.g. 'ley', 'aprobada', 'radicada'. | |
| chamber | No | upper = Senado, lower = Cámara de Representantes. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden for behavioral disclosure. It states 'Returns summary rows,' which hints at the output form, but it does not disclose matching behavior, result ordering, or potential empty results. Since the tool is a read-only search, the risk is lower, but the description could add more context about what 'summary' entails. It is not misleading, so a mid-range score is appropriate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that leads with the verb 'Search' and quickly covers resource, criteria, and return type. Every phrase earns its place; there is zero redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given it is a straightforward search tool with four well-documented optional parameters and no output schema, the description covers the core purpose and return format. It lacks guidance on when to use the sibling get_pr_bill, which would improve completeness, but the essential context for a search tool is present. The schema already covers parameter details, so the description does not need to repeat them.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds minimal semantic value beyond the schema: it groups criteria as 'text, chamber, or status' but does not elaborate on the 'status' slug or provide examples. It does not increase understanding of individual parameters beyond the schema's own descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches for Puerto Rico Legislative Assembly measures (proyectos y resoluciones) using specific criteria (text, chamber, status) and returns summary rows. This is a specific verb + resource + criteria, and it distinguishes itself from the sibling get_pr_bill by being a search/discovery tool rather than a fetch-by-ID tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description makes the search purpose clear but provides no explicit guidance on when to use this tool vs. the sibling get_pr_bill. Usage is implied (search to find measures), but there are no stated exclusions, prerequisites, or alternative recommendations. This is adequate but lacks explicit direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
The two tools have clearly distinct purposes: one searches for legislation with filters, the other retrieves full details for a specific measure. There is no overlap or ambiguity.
Both tools follow a verb_noun pattern, but one uses 'pr_bill' and the other 'pr_legislation,' which is a minor inconsistency in resource naming. Overall style is consistent and readable.
With only two tools, the set feels thin for a legislative domain, though it may be sufficient for a minimal read-only API. The count is borderline but not unreasonable.
The tool surface covers search and detail retrieval, which are the core operations for accessing legislative measures. No significant gaps are apparent, though more specialized endpoints (e.g., by chamber or session) could be added.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
15 paid AI agent primitives via x402 (USDC on Base). Pay-per-call MCP server.
Agent-commerce MCP server for x402/USDC payments and affiliate splits on Base.
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Search 15K+ MCP services, A2A agents, and x402 APIs from 5 registries. Paid via x402 (USDC on Base).
Related MCP Servers
- FlicenseAqualityBmaintenanceMCP server for a live x402 payment gateway on Base (USDC). Lets AI agents discover, preview for free, then pay per call — with prepaid gasless payments, signed receipts, and delta delivery.7

oom-x402-mcpofficial
FlicenseNot gradedqualityBmaintenanceMCP server exposing 1,000+ pay-per-call API endpoints across agent infrastructure (memory, coordination, secrets, verification), data, compute, finance, weather, geography, and reference categories — payments via x402 protocol in USDC on Base.- AlicenseNot gradedqualityCmaintenanceMCP server that provides AI agents with pay-per-call access to a suite of tools (honeypot check, token market, DeFi yields, etc.) via USDC on Base using the x402 protocol.4MIT
- FlicenseNot gradedqualityBmaintenanceA small, autonomous, pay-per-call MCP server that AI agents discover and pay for per call, with revenue landing directly in a USDC wallet on Base via the x402 payment protocol.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/CDVolvik/pr-legislative-x402'
If you have feedback or need assistance with the MCP directory API, please join our Discord server