Skip to main content

structx-mcp

PyPI License

Model Context Protocol (MCP) server for struct-x — install in Claude Desktop, Cursor, Windsurf, or any MCP-compatible client and give your agent first-class structured-extraction tools.

You: extract the product details from this Aeron chair page →
     [pastes URL or HTML]
Agent: [calls structx_extract under the hood, returns typed JSON]
     {
       "title": "Aeron Chair",
       "price_cents": 179500,
       "brand": "Herman Miller",
       …
     }

No HTTP plumbing, no schema-writing detours — the agent just uses extraction.

Install

pip install structx-mcp

Then add to your MCP client's config.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "structx": {
      "command": "structx-mcp",
      "env": {
        "STRUCTX_API_KEY": "sx_..."
      }
    }
  }
}

Restart Claude Desktop. Confirm by typing /mcp and verifying structx is listed.

Cursor

.cursor/mcp.json (project-scope) or ~/.cursor/mcp.json (user-scope):

{
  "mcpServers": {
    "structx": {
      "command": "structx-mcp",
      "env": { "STRUCTX_API_KEY": "sx_..." }
    }
  }
}

Windsurf / any other MCP client

Same pattern — command: "structx-mcp", env: { STRUCTX_API_KEY: ... }. The server speaks the standard MCP stdio protocol.

Tools the agent gets

Tool What it does
structx_extract Extract structured JSON from raw content (HTML / markdown / text / JSON / emails) using a JSON Schema you provide OR a pre-built template slug. Returns per-field confidence scores.
structx_infer_schema Don't have a schema yet? Paste raw content, get a draft schema back with per-field rationales. Plus matching templates from the public catalog.
structx_extract_from_url Fetch a URL and extract in one call. Sandboxed (HTTPS only, public DNS only, 10MB cap, no redirects). Replaces the two-call fetch_url → extract pattern.
structx_list_templates Browse every public template — saves the agent from hand-writing a schema for common formats (Stripe events, GitHub issues, product pages, news articles).
structx_usage Current credit usage for the API key. Pre-flight check before batches, or post-mortem after a RateLimitError.

Why use an MCP server vs. the SDK directly?

The Python SDK (structx-sdk) is for building applications. This MCP package is for putting struct-x inside the AI tools you already use — Claude Desktop, Cursor, Windsurf. The agent calls these tools natively, no app code required.

Both are first-party; they share the same backend, same credit pool, same API key.

Security

structx_extract_from_url is sandboxed at the network layer:

  • HTTPS only (no http://, file://, ftp://, etc.)
  • Hostname blocklist for cloud metadata targets (169.254.169.254, metadata.google.internal, etc.)
  • Hostname suffix blocklist for internal-network conventions (.internal, .local, .cluster.local, .consul)
  • DNS resolution + IP classification — refuses any private, loopback, link-local, multicast, or reserved IP
  • No redirect following (one less SSRF vector)
  • 10MB response cap

This matches the defenses on the struct-x backend's webhook outbound-URL validator. See src/structx_mcp/_url_safety.py for the implementation.

Development

git clone https://github.com/struct-x-ai/struct-x
cd struct-x/mcp/structx-mcp

# Install editable + the SDK from the local checkout (the SDK is in
# the same monorepo at sdk/python/).
pip install -e "../../sdk/python" -e ".[dev]"

pytest -q

License

MIT — see LICENSE.

Metadata

Release files for structx-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for structx-mcp 0.1.0
File Size Uploaded Provenance Actions
structx_mcp-0.1.0.tar.gz 12.1 kB With provenance Details for structx_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for structx-mcp 0.1.0
File Interpreter ABI Platform Actions
structx_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for structx_mcp-0.1.0-py3-none-any.whl

Total release size: 26.0 kB

Release files / structx_mcp-0.1.0.tar.gz

Download URL structx_mcp-0.1.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a7e4efaaa18dd8c45448e7921f22a8b59e17ac0d3f896777cb765b8fa16e042d
BLAKE2b-256 checksum
How to use checksums
b8ba83a7e1e7273098fb3eca77dd0934033b54c13f901a5d5bc145b03adef351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / structx_mcp-0.1.0-py3-none-any.whl

Download URL structx_mcp-0.1.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f25f6906aabd0d7d7639e86fdb4cf92dc85cbfadd1a297ca58f1c5d20f034d81
BLAKE2b-256 checksum
How to use checksums
3c5150ef665ffdd462a73cc3af1f25b35a6d88a99f3ac79e60ee5f30aa2d7743
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Security for structx-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for structx_mcp-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page