Structured-sh
MCP server providing managed persistent memory for AI agents. Read and write structured state across sessions, tools, and restarts at 1000+ requests per second, with no infrastructure to self-host or operate.
README
<p align="center"> <strong>■ structured</strong><br> <sub>schema-native memory for AI agents</sub> </p>
<p align="center"> <a href="https://structured.sh">structured.sh</a> · <a href="#quick-start">Quick Start</a> · <a href="#connect-to-claude--cursor">Connect to Claude</a> · <a href="#mcp-tools">MCP Tools</a> · <a href="#api-reference">API Reference</a> · <a href="DEPLOY.md">Deploy</a> </p>
Define schemas. Write structured data. Query with SQL. All as Parquet files you own.
docker compose up
What is this?
Structured gives AI agents (and humans) persistent, queryable memory:
- Define a memory — name + typed schema (like a table)
- Write records — buffered and auto-flushed to Parquet files
- Query with SQL — DuckDB runs directly against the Parquet files
- Own your data — everything is local files on disk, no vendor lock-in
Works with Claude Desktop, Cursor, Windsurf, Cline, or any MCP-compatible client.
Architecture
┌──────────────────────────────────────────────────────┐
│ docker compose up │
│ │
│ ┌──────────┐ ┌──────────────┐ ┌────────────┐ │
│ │Dashboard │ │ REST API │ │ MCP Server │ │
│ │ :3000 │───▶│ :3001 │◀───│ stdio │ │
│ │ │ │ │ │ │ │
│ │Vite+React│ │ Hono + WASM │ │ 9 tools │ │
│ └──────────┘ │ │ └────────────┘ │
│ │ SQLite (sql.js) │
│ │ DuckDB (wasm) │
│ │ Parquet (tiny-parquet) │
│ └──────┬───────┘ │
│ │ │
│ ./data/ │
│ ├── structured.db ← metadata │
│ └── parquet/ ← your data │
│ ├── user_prefs/ │
│ │ └── 2026/04/09/...parquet │
│ └── campaign_data/ │
│ └── 2026/04/09/...parquet │
└──────────────────────────────────────────────────────┘
Zero native dependencies. Everything runs in WASM — no C++ builds, no platform issues.
Quick Start
1. Clone and configure
git clone https://github.com/structured-sh/structured.git
cd structured
Edit docker-compose.yml and set your credentials:
environment:
- API_KEY=your-secret-api-key # Used by MCP clients & scripts
- DASHBOARD_PASSWORD=your-password # Protects the dashboard UI
Two separate credentials:
API_KEY— machine auth for MCP clients, scripts, and analytics ingestionDASHBOARD_PASSWORD— human auth for the web dashboard. Leave unset to disable login (local-only use).
2. Start the stack
docker compose up -d
| Service | URL |
|---|---|
| Dashboard | http://localhost:3000 |
| API | http://localhost:3001 |
| MCP | stdio (auto-connected) |
3. Create a memory
curl -X POST http://localhost:3001/memories \
-H "Authorization: Bearer your-secret-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "user_preferences",
"fields": [
{ "name": "key", "type": "string" },
{ "name": "value", "type": "string" },
{ "name": "priority", "type": "int32" }
],
"description": "User preference settings"
}'
4. Write data
curl -X POST http://localhost:3001/memories/user_preferences/write \
-H "Authorization: Bearer your-secret-api-key" \
-H "Content-Type: application/json" \
-d '{
"data": [
{ "key": "theme", "value": "dark", "priority": 1 },
{ "key": "language", "value": "en", "priority": 2 }
]
}'
5. Query with SQL
curl -X POST http://localhost:3001/query \
-H "Authorization: Bearer your-secret-api-key" \
-H "Content-Type: application/json" \
-d '{ "sql": "SELECT * FROM user_preferences ORDER BY priority" }'
Memory names work as table names — DuckDB resolves them to Parquet files automatically.
6. Access raw files
# Files on disk
ls ./data/parquet/user_preferences/
# DuckDB CLI
duckdb -c "SELECT * FROM read_parquet('./data/parquet/user_preferences/**/*.parquet')"
# Python
import duckdb
duckdb.sql("SELECT * FROM './data/parquet/user_preferences/**/*.parquet'").show()
Connect to Claude / Cursor
Local (Docker)
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"structured": {
"command": "docker",
"args": ["exec", "-i", "structured-mcp", "node", "index.js"]
}
}
}
For Cursor, add to Settings → Features → MCP Servers:
{
"structured": {
"command": "docker",
"args": ["exec", "-i", "structured-mcp", "node", "index.js"]
}
}
Cloud (structured.sh)
Coming soon — hosted version at structured.sh
{
"mcpServers": {
"structured": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-proxy", "https://mcp.structured.sh"]
}
}
}
MCP Tools
Once connected, just talk naturally. The AI picks the right tool.
| Tool | What to say |
|---|---|
create_memory |
"Create a memory for tracking daily sales with fields: date, revenue, units" |
list_memories |
"What memories do I have?" |
describe_memory |
"Show me the schema for daily_sales" |
write_memory |
"Save today's sales: date=2026-04-09, revenue=1250.50, units=42" |
query_memory |
"What's the total revenue this month?" |
store_document |
"Remember this config for later" |
get_document |
"Get the document abc-123" |
flush_memory |
"Flush all pending data to disk" |
delete_memory |
"Delete the test_data memory" |
Ingesting Data from Your Apps
Use the templates in templates/ to send events from external systems:
| Template | Use case |
|---|---|
templates/ingest-app-analytics.js |
Mobile/web app events (installs, actions, purchases) |
templates/ingest-webhook.js |
Stripe, GitHub, Shopify webhooks |
templates/query-report.js |
Generate SQL reports → terminal, Markdown, or Slack |
// Example: track an install from your iOS app
import { track } from './templates/ingest-app-analytics.js';
await track('install', 'user_abc', { platform: 'ios', app_version: '1.0.0' });
Then query across all your events:
SELECT event, COUNT(*) as n, COUNT(DISTINCT user_id) as users
FROM app_events
WHERE timestamp > now() - INTERVAL '30 days'
GROUP BY event ORDER BY n DESC
Dead Letter Queue
Records rejected by strict or evolve schema modes are not dropped — they're automatically written to _dlq_{memory_name} for inspection:
-- See what was rejected and why
SELECT _reason, _payload, _rejected_at
FROM _dlq_app_events
ORDER BY _rejected_at DESC
LIMIT 20
API Key Rotation
Rotate your API key at any time from the dashboard Connect page without restarting:
- Go to Connect → API Key section
- Click Rotate Key
- Copy the new key (shown once)
- Update your MCP config and any scripts
The old key is invalidated immediately.
API Reference
Auth (Dashboard)
| Method | Path | Description |
|---|---|---|
GET |
/auth/status |
Check if dashboard auth is enabled |
POST |
/auth/login |
Login with { password }, returns session token |
GET |
/auth/me |
Validate current session (X-Session-Token header) |
POST |
/auth/logout |
Logout (client discards token) |
Memories
| Method | Path | Description |
|---|---|---|
GET |
/memories |
List all memories |
POST |
/memories |
Create a memory |
GET |
/memories/:name |
Get memory details |
PUT |
/memories/:name |
Update memory |
DELETE |
/memories/:name |
Delete memory |
POST |
/memories/:name/write |
Write records |
POST |
/memories/:name/flush |
Flush to Parquet |
GET |
/memories/:name/preview |
Preview data |
GET |
/memories/:name/files |
List Parquet files |
Query
| Method | Path | Description |
|---|---|---|
POST |
/query |
Execute DuckDB SQL |
Store (Documents)
| Method | Path | Description |
|---|---|---|
POST |
/documents |
Store a JSON document |
GET |
/documents/collections |
List collections |
GET |
/documents/:collection |
List documents |
DELETE |
/documents/:collection/:id |
Delete document |
Settings
| Method | Path | Description |
|---|---|---|
GET |
/settings/api-key |
Get masked current API key |
POST |
/settings/rotate-key |
Generate new API key |
Files
| Method | Path | Description |
|---|---|---|
GET |
/files/* |
Download raw Parquet file |
MCP (SSE)
| Method | Path | Description |
|---|---|---|
GET |
/sse |
SSE stream for MCP clients |
POST |
/messages |
JSON-RPC messages |
Schema Modes
| Mode | Behavior |
|---|---|
flex |
Accept all fields, no validation (default) |
evolve |
Accept all, detect and log schema drift |
strict |
Reject records with mismatched fields → DLQ |
Field Types
| Type | Parquet Type | Notes |
|---|---|---|
string |
BYTE_ARRAY (UTF-8) | Default |
int32 |
INT32 | |
int64 |
INT64 | |
float32 |
FLOAT | |
float64 |
DOUBLE | |
boolean |
BOOLEAN | |
timestamp |
INT64 (millis) | Unix ms, UTC |
Stack
Only 7 npm packages. No native addons — everything runs in WASM or pure JS.
| Package | What it does |
|---|---|
hono + @hono/node-server |
HTTP router — fast, Web-standard API |
@duckdb/duckdb-wasm |
SQL query engine, runs fully in WASM |
sql.js |
SQLite in WASM — stores schema metadata |
tiny-parquet |
Pure-JS Parquet writer, zero native deps |
@modelcontextprotocol/sdk |
MCP server/tool registration |
zod |
Schema validation for API inputs |
Runtime: Node.js ≥ 20
Because everything runs in WASM, there are no C++ builds, no node-gyp, no platform-specific binaries. The Docker image works on any architecture Docker supports.
Development
# Local dev (no Docker)
cd api && npm install && node index.js
cd dashboard && npm install && npm run dev
# Full stack
docker compose up --build
License
Apache 2.0
<p align="center"> <sub>Built with <a href="https://npmjs.com/package/tiny-parquet">tiny-parquet</a> · Powered by <a href="https://duckdb.org">DuckDB</a> · <a href="https://structured.sh">structured.sh</a></sub> </p>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。