# StructuraMCP > Converts messy multi-page construction and procurement PDFs - Bills of Quantities (BoQ), supplier quotes, commercial/VAT invoices and technical spec sheets - into schema-strict JSON and CSV. Deterministic table parsing first (PyMuPDF + pdfplumber), LLM fallback only for low-confidence pages. Price: $0.08 USD per parsed page; re-parsing the same document + schema with the same key within 24h is free. Base URL: https://api-production-50c65b43.up.railway.app ## Connect - MCP (Streamable HTTP): https://api-production-50c65b43.up.railway.app/mcp - header `Authorization: Bearer ` - MCP manifest: https://api-production-50c65b43.up.railway.app/.well-known/mcp.json - REST OpenAPI 3.1: https://api-production-50c65b43.up.railway.app/openapi.json (interactive docs: https://api-production-50c65b43.up.railway.app/docs) - stdio: `uvx --from structura-mcp structura-mcp --transport stdio` with env `STRUCTURA_API_KEY` ## MCP tools - parse_document(schema, pdf_url | pdf_base64, output_format=json|csv|both, allow_llm=true): extract a PDF into a schema. Returns `document`, optional `csv`, `confidence` (0-1), `confidence_breakdown`, `needs_review`, `method` (deterministic | hybrid | llm), `warnings`, `billing`. - validate_boq_schema(document): free. Strict-schema validation plus qty x rate = amount and totals reconciliation for a BoQ. - list_schemas(include_json_schema=false): free. Schema names, versions, CSV columns, JSON Schemas. - compare_supplier_quotes(quotes): free. Item-by-item comparison of parsed `quote` documents, cheapest supplier per line. ## REST endpoints - POST /v1/parse (multipart: file, schema, output_format, allow_llm) - POST /v1/parse/url (JSON: {"schema": "boq", "pdf_url": "https://..."} or {"schema": "invoice", "pdf_base64": "..."}) - GET /v1/schemas, GET /v1/schemas/{name} - POST /v1/validate/boq, POST /v1/compare/quotes (free) - POST /v1/keys {"email": "..."} (free API key with trial pages) - GET /v1/usage, POST /v1/credits/checkout {"pages": 500} ## Schemas - boq: items[item_code, description, unit, qty, rate, amount, section, page], stated_subtotal, stated_vat, stated_total, computed_total, totals_reconcile - invoice: invoice_number, invoice_date, due_date, seller/buyer {name, address, tax_id}, currency, incoterms, line_items[item_code, description, hs_code, qty, unit_price, vat_rate, net_amount], vat_breakdown, subtotal, vat_total, total - quote: supplier, quote_number, quote_date, valid_until, payment_terms, delivery_terms, items[item_code, description, brand_model, unit, qty, unit_price, amount, lead_time_days], subtotal, tax, total - spec_sheet: product_name, manufacturer, model_number, standards[], attributes[section, name, value, unit] - Aliases accepted: bill_of_quantities, commercial_invoice, tax_invoice, supplier_quote, quotation, datasheet. ## Payment - New here? `POST https://api-production-50c65b43.up.railway.app/v1/keys` with JSON `{"email": "you@example.com"}` returns an API key with 20 free pages (one key per email). - API key with prepaid page credits (`Authorization: Bearer sk_struct_...`), or a metered Stripe subscription. - No key? Send `X-Payment-Proof: pi_...` (a succeeded USD Stripe PaymentIntent). Its value becomes pages at $0.08/page; unused pages stay on that proof for later calls. - HTTP 402 responses include `pages_required`, `amount_due_usd`, `credit_balance_pages` and `payment_options` with exact next steps. ## Errors All errors are JSON: {"error": {"code", "message", "hint", "retryable", ...}}. Follow `hint`, then retry. - unsupported_schema: use `valid_schemas` / `did_you_mean`. - missing_document / ambiguous_document: send exactly one of pdf_url or pdf_base64. - invalid_url / url_forbidden / url_not_pdf / url_fetch_failed: link directly to a public .pdf, or upload bytes. - invalid_base64 / invalid_pdf / corrupt_pdf / encrypted_pdf / empty_document: re-encode or re-export the PDF. - too_many_pages / file_too_large: split the document. - invalid_api_key (401), account_suspended (403), payment_required / insufficient_credits / payment_not_settled (402): see payment_options. - invalid_payment_proof / payment_proof_reused: send a fresh succeeded PaymentIntent id. - invalid_request (422): `fields` lists what to fix. ## Interpreting results - confidence >= 0.8: arithmetic and totals reconcile; safe to use. - needs_review = true: check `warnings` and `confidence_breakdown` (header_coverage, row_quality, arithmetic, totals, completeness). - Numbers are JSON numbers; dates are ISO-8601; `page` is 1-based.