wraft-mcp
MCP server for Wraft that lets AI agents discover and run curated document-lifecycle tools over Wraft's REST API, including content types, templates, document creation/update, PDF builds, and approval flows via stdio or hosted HTTP.
README
wraft-mcp
MCP server for Wraft — lets AI agents (Cursor, Claude Code, Claude Desktop) discover and run curated document-lifecycle tools over Wraft's /api/v1 REST API.
Two entrypoints, one shared tool set:
- stdio (
wraft-mcp) — the client spawns the server locally; auth via env vars - Streamable HTTP (
wraft-mcp-http) — a hosted, stateless service at/mcp; auth via per-requestx-api-keyheader
Tools
| Tool | What it does |
|---|---|
list_content_types |
Content types (document variants) with their fields |
list_data_templates / get_data_template |
Pre-authored templates with fillable fields |
create_data_template |
Author a template from markdown — [Field Name] placeholders become fillable holder fields (must match the content type's fields) |
list_documents / get_document |
Documents in the organisation |
create_document_from_template |
Preferred create path: fills a template's placeholders from a field-values map and creates the document |
create_document |
Raw-payload create (escape hatch) |
update_document |
Update content (creates a version) |
build_document |
Generate the PDF (synchronous, up to ~2 min) |
transition_document_state |
Move a document through its approval flow |
list_flows / get_flow / list_flow_states |
Approval flows and their states |
whoami |
Verify the key: user, email, organisation, roles |
All list_* tools accept page and return page_number / total_pages / total_entries — paginate before concluding something doesn't exist.
Field machine names
create_document_from_template takes fields keyed by machine name: the field's
name lowercased, apostrophes stripped, spaces → _, other characters removed
("Client Name" → client_name). Get field names from get_data_template
(under content_type.fields).
Write tools are not idempotent
A timed-out create_* or build_document call may still have completed on the
server. List or fetch before retrying — a blind retry creates a duplicate
document or another build version.
Cursor / Claude Code configuration
Local (stdio) — recommended for individuals:
{
"mcpServers": {
"wraft": {
"command": "npx",
"args": ["-y", "wraft-mcp@0"],
"env": {
"WRAFT_BASE_URL": "https://app.your-wraft.example",
"WRAFT_API_KEY": "wraft_..."
}
}
}
}
During development (before npm publish): "command": "node", "args": ["/ABS/PATH/wraft-mcp/dist/index.cjs"].
Remote (hosted HTTP):
{
"mcpServers": {
"wraft": {
"url": "https://mcp.your-domain.example/mcp",
"headers": { "x-api-key": "wraft_..." }
}
}
}
Client timeouts: build_document can run up to 120 s. Raise your MCP
client's tool-call timeout accordingly (Cursor: "timeout" per server entry)
or builds will appear to fail while still completing server-side.
API keys: what to know
- Keys are unscoped. A Wraft API key carries its owner's full role permissions — this server's curated tool list limits what the agent can reach, not what the credential could do elsewhere. Create a dedicated least-privilege user for MCP keys.
- IP-whitelisted keys don't work via the hosted server. Wraft sees the MCP
server's IP, not yours, so whitelisted keys get
403 ip_not_whitelisted. Use a key without an IP whitelist for hosted access, or run stdio from an allowed machine. Do not whitelist the MCP server's egress IP — that nullifies the control for everyone behind the proxy. - Keys are never logged by this server; redaction of
x-api-key/authorizationmust also be configured in any logging/APM middleware added around it.
Hosted deployment
docker build -t wraft-mcp .
docker run -p 8080:8080 \
-e WRAFT_BASE_URL=https://app.your-wraft.example \
-e ALLOWED_ORIGINS=https://your-web-agent.example \
wraft-mcp
| Env | Meaning |
|---|---|
WRAFT_BASE_URL |
Upstream Wraft instance. Must be https:// (startup assertion; http://localhost allowed for local testing only). Clients cannot override it — x-wraft-base-url is rejected. |
PORT |
Listen port (default 8080) |
ALLOWED_ORIGINS |
Comma-separated browser origins. Fail-closed: unset = every request carrying an Origin header is rejected (DNS-rebinding defense). Header-less clients (Cursor) are unaffected. |
MAX_BODY_BYTES |
Request body cap (default 2 MiB) |
Endpoints: POST /mcp (MCP, stateless — POST only), GET /healthz (probes).
The server is stateless (no MCP sessions): run any number of replicas with
no sticky routing; x-api-key is read on every request and forwarded only to
WRAFT_BASE_URL.
Hosting checklist
- Build and push the image; deploy with the env above
- DNS
mcp.<domain>+ TLS at the edge - Edge rate limit (required) and max request body size
- Ingress read timeout ≥ 120 s (the
build_documentupstream timeout) - Wire
GET /healthzinto liveness/readiness probes - Smoke-test from Cursor with
whoami, then run onecreate_document_from_template→build_document→transition_document_statechain
Development
npm install
npm test # unit tests (template fill engine)
npm run typecheck
npm run build # dist/index.cjs (stdio) + dist/http.cjs (HTTP)
Publishing (maintainers)
Publish only via CI with a scoped npm token, 2FA on the account, and
npm publish --provenance. Only the wraft-mcp stdio bin is meant for the
registry; wraft-mcp-http ships in the Docker image. After publishing, verify
the documented pinned npx config works on a clean machine.
License
AGPL-3.0-only — see LICENSE.md.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。