Transform data structure definitions into queryable MCP servers
Project description
Struct-MCP
Transform data structure definitions into queryable MCP servers. Define your data structures with business context and get an AI-queryable interface that can answer questions about field meanings, data lineage, and structure.
Quick Start
# Install
pip install struct-mcp
# Create a structure definition
echo "cheese_inventory:
description: 'Artisanal cheese catalog'
fields:
cheese_id:
type: string
description: 'Unique identifier for each cheese'
upstream_table: 'inventory.raw_cheese_data'
name:
type: string
description: 'Display name of the cheese'
stinkiness_level:
type: integer
nullable: true
description: 'Stinkiness rating from 1-10'
" > cheese.yaml
# Start MCP server
struct-mcp serve cheese.yaml
Supported Formats
Load from multiple input formats:
- YAML - Primary format with full business context
- JSON Schema - Standard JSON Schema files
- OpenSearch - Elasticsearch/OpenSearch mappings
- Avro - Apache Avro schemas
- Pydantic - Python BaseModel classes
- Protocol Buffer - .proto message definitions
struct-mcp serve schema.yaml # YAML
struct-mcp serve schema.json # JSON Schema/OpenSearch/Avro
struct-mcp serve model.py # Pydantic
struct-mcp serve messages.proto # Protocol Buffer
What You Can Ask
Once loaded, query your structures with natural language:
- "What does the cheese_id field represent?"
- "Which fields come from the inventory table?"
- "What fields are nullable and why?"
- "How is stinkiness_level calculated?"
- "Show me all array fields"
Python API
from struct_mcp import StructMCP, MCPServer
# Load any format
smc = StructMCP.from_file("cheese.yaml")
# Query programmatically
fields = smc.get_fields("cheese_inventory")
nullable_fields = smc.get_fields("cheese_inventory", nullable=True)
# Convert between formats
opensearch_mapping = smc.to_opensearch()
pydantic_model = smc.to_pydantic()
# Start MCP server
server = MCPServer(smc)
server.start()
Examples
See examples/ for sample files in all supported formats:
cheese_catalog.yaml- Artisanal cheese inventoryuser_profiles.yaml- User data with preferencesfinancial_transactions.yaml- Payment processing metadata
Documentation
For detailed setup, development, and API documentation, see setup.md.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file struct_mcp-0.1.0.tar.gz.
File metadata
- Download URL: struct_mcp-0.1.0.tar.gz
- Upload date:
- Size: 82.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c73bb3fca0186ba1a6f9fef74b0666e6ace7a68f91e9e3d57f6c8cb49f35584a
|
|
| MD5 |
4da3649d820075b4c201214c0959f987
|
|
| BLAKE2b-256 |
ff0cf7d6af68963dadff49bb6f7e828b35183494c58deb4e7305a00a811378ae
|
File details
Details for the file struct_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: struct_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcfa9233be76920094b998d5eef489c0c2910827a4cea28295a9d1b686f0cd02
|
|
| MD5 |
357bd787c076eb43d3b5fb8e2afa7b34
|
|
| BLAKE2b-256 |
3bdb40b1b49ea78a039fb1352f00814e0b1a87cc01b2737c76076edc94bd3be7
|