2dai-mcp-server
MCP server for 2DAI that enables AI assistants to generate images and videos, upload references, browse the public feed, and manage cloud drive on a 2DAI account.
README
2dai-mcp-server
MCP server for 2DAI — lets Claude, Cursor, Cline, Windsurf and any other MCP host generate images and video, upload references, browse the public feed, and organise your cloud drive on your own 2DAI account.
- Runs locally over stdio via
npx— nothing to install permanently. - Authenticates with a 2DAI API key (create one at 2dai.io → Dashboard → Integrations → API keys).
- Finished images come back as inline previews so the model can see what it made and iterate.
Quick start
Claude Code
claude mcp add 2dai --env TWODAI_API_KEY=2dai_sk_... -- npx -y 2dai-mcp-server
Claude Desktop / Cursor / Cline / Windsurf (JSON config)
{
"mcpServers": {
"2dai": {
"command": "npx",
"args": ["-y", "2dai-mcp-server"],
"env": { "TWODAI_API_KEY": "2dai_sk_..." }
}
}
}
The key is read from the environment only — never pass it as a tool argument.
Hosted alternative — mcp.2dai.io:800
Every host that speaks remote MCP (Streamable HTTP) can point at our hosted
server instead of running npx locally. No install, no Node runtime, no
process lifecycle — just a URL and a Bearer key.
Endpoint — https://mcp.2dai.io:800/mcp
Auth — Authorization: Bearer 2dai_sk_... on every request (same key you'd
put in TWODAI_API_KEY for the stdio flow).
Claude Desktop / Cursor / Cline / Windsurf (remote-MCP JSON shape — check
your host's docs, some hosts still spell the type "remote"):
{
"mcpServers": {
"2dai": {
"type": "streamable-http",
"url": "https://mcp.2dai.io:800/mcp",
"headers": { "Authorization": "Bearer 2dai_sk_..." }
}
}
}
Claude Code
claude mcp add --transport http 2dai https://mcp.2dai.io:800/mcp \
--header "Authorization: Bearer 2dai_sk_..."
Both transports (stdio via npx and hosted via HTTP) expose the exact same
tools and the exact same behavior. Pick whichever fits: npx when you want
zero third-party dependency and full control of the process, hosted when you
want zero install and a single URL.
Tools
| Tool | What it does | Scope | Spends credit |
|---|---|---|---|
get_account |
Account status: credit, tier, key label/scopes/spend cap | read | no |
generate_image |
Text-to-image (style/quality default to auto) | generate | yes |
generate_with_refs |
Image from references: face-ref, character-ref, style-transfer, smart-edit (edit refs[0] per the prompt) |
generate | yes |
generate_video |
Animate a still creation into a short clip | generate | yes |
generate_similar |
Re-run an existing creation ("more like this one") | generate | yes |
generate_wallpaper |
Expand a creation into a wallpaper dimension (standard, photo, widescreen, ultrawide); quality fixed at Ultra, price follows the dimension |
generate | yes |
check_generation |
Poll a queued generation by queueId | read | no |
cancel_generation |
Cancel a still-waiting generation (charge refunded); explains itself when it is too late | generate | no |
upload_image |
Upload a local image / base64 as a reference | generate | no |
download_creation |
Save the full-resolution asset to disk, or return an inline preview | read | no |
list_creations |
Page, search, sort and filter the library (folders, trash, activity lenses, smart collections, shared folders, random pick). Rows include nsfwFlagged/nsfwRate so agents can apply their own safeguards |
read | no |
browse_feed |
Page through the public feed (other creators' published work) | read | no |
list_folders |
Page through the account's folders | read | no |
manage_folder |
Folder CRUD + favorites, poster, and sidebar groups (create/rename/delete/move-to-group/list-groups) | manage | no |
organise_creation |
Move / trash / restore / like / unlike one creation; batch-trash / batch-restore up to 100; permanent delete stays one-at-a-time |
manage | no |
publish_creation |
Publish / unpublish a creation on the public feed | publish | no |
get_stats |
One consolidated stats read: counters, streak, storage, 30/90-day generation volume + spend, top refs/styles/keywords | read | no |
get_wallet_status |
$2DAI balance, USD credit, effective tier + the four signals it derives from | finance | no |
get_lock |
Staking-lock status (none / active / expiring-soon) | finance | no |
get_wallet_history |
Transactions, balance chart, credit chart, or credit sources | finance | no |
get_token_price |
Cached $2DAI/USD quote with its staleness | read | no |
All wallet tools are read-only — no tool on this server can move money. The finance
scope is opt-in and never part of a key's defaults; enable it in the dashboard's key settings
when you want an agent to see wallet data.
Least privilege
Scopes are set per key in the dashboard. A coding agent that only generates needs
read + generate; add manage for drive organisation, publish only if you want it
posting to the public feed, and finance only for wallet reads. You can also set a
per-key spend cap — the server reports actionable errors when a cap or scope blocks a call.
Configuration (env)
| Variable | Default | Meaning |
|---|---|---|
TWODAI_API_KEY |
— (required) | Your 2DAI API key |
TWODAI_PREVIEWS |
1 |
Attach downscaled inline previews to finished generations |
TWODAI_PREVIEW_MAX_SIDE |
512 |
Longest edge of those previews, in px |
TWODAI_WAIT_BUDGET_MS |
45000 |
How long a generation call blocks before degrading to a queueId |
TWODAI_IDEMPOTENCY_WINDOW_MS |
30000 |
Window in which an identical re-submit is treated as a retry, not a new charge |
TWODAI_ALLOW_ANY_PATH |
0 |
Allow file reads/writes outside the working directory |
TWODAI_API_BASE |
production API | API origin override (for self-hosted testing) |
Notes for agents
- Generation spends real credit. Check
get_accountfirst when unsure, and never generate speculatively. - Long generations return a
queueId— collect withcheck_generation; re-submitting would be charged again. - Rapid identical submits inside the idempotency window are deduplicated, never double-charged.
upload_image/download_creationpaths are confined to the working directory unlessTWODAI_ALLOW_ANY_PATH=1.
The 2DAI stack
We currently use our Gen 7.1 model, and unlike others, we don't resell model access. All our models originate from the open-source community or our own R&D — we then disassemble, modify, fine-tune and optimize them to align with our legacy and 2DAI❤️ART lines. They also run on our own private cloud network.
Every tool response carries the model version and stack summary (via
get_account.platform), so an agent can hand these facts back to a user who
asks "what powers you?" without extra plumbing.
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。