Skip to main content

Model Context Protocol server for struct-x — install in Claude Desktop, Cursor, Windsurf, or any MCP-compatible client to give your agent structured-extraction superpowers.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

structx_mcp-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

structx_mcp-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file structx_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: structx_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for structx_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7e4efaaa18dd8c45448e7921f22a8b59e17ac0d3f896777cb765b8fa16e042d
MD5 36e9d144443d31216178043e2d4100c5
BLAKE2b-256 b8ba83a7e1e7273098fb3eca77dd0934033b54c13f901a5d5bc145b03adef351

See more details on using hashes here.

Provenance

The following attestation bundles were made for structx_mcp-0.1.0.tar.gz:

Publisher: structx-mcp-publish.yml on struct-x-ai/struct-x

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structx_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: structx_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for structx_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f25f6906aabd0d7d7639e86fdb4cf92dc85cbfadd1a297ca58f1c5d20f034d81
MD5 258036e65524d72939553e0981cab675
BLAKE2b-256 3c5150ef665ffdd462a73cc3af1f25b35a6d88a99f3ac79e60ee5f30aa2d7743

See more details on using hashes here.

Provenance

The following attestation bundles were made for structx_mcp-0.1.0-py3-none-any.whl:

Publisher: structx-mcp-publish.yml on struct-x-ai/struct-x

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page