
deAPI MCP Server
io.github.deapi-ai由 GitHub 帳號 deapi-ai 發布v0.6.3更新於 Nov 7, 2026
39 AI tools: transcription, video description, image & video generation, TTS, music, OCR via deAPI
概覽
遠端 MCP 伺服器,透過 39 個 deAPI 工具提供影像、影片、音訊生成、轉錄、OCR、語音合成與向量嵌入能力。
- 可以做什麼
- 生成與處理影像:文生圖、圖生圖、去背、放大、OCR
- 生成與處理影片:文/圖/音訊生影片、影片描述、影片放大
- 轉錄音訊與影片檔案或連結,並將文字轉為語音和音樂
- 產生文字向量嵌入,並用提示詞增強工具優化提示詞
- 查詢帳戶餘額、列出可用模型、查詢或等待非同步任務狀態
- 用搭配的價格工具估算各項操作費用
- 適用情境
- 適合讓助理直接生成或編輯媒體、轉錄錄音或影片連結,或在對話中執行 deAPI 推論任務。價格工具可在消耗額度前先估算成本。
- 執行需求
- 需要 deAPI 帳戶及在 deAPI 設定頁建立的 API 權杖。託管端點使用 OAuth 2.0(授權碼 + PKCE);自行部署需 Python 3.11 以上,且非本機回環位址時必須設定 DEAPI_JWT_SECRET_KEY。需能連線至 deAPI API。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 deAPI MCP Server,將其新增到工作區。
- 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。
交給代理程式安裝
把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。
閱讀 https://sourceweft.com/mcp/io.github.deapi-ai%2Fmcp-server-deapi/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。其他 MCP 客戶端
把它新增到你客戶端的 mcpServers 設定中。 客戶端會在首次連接時完成 OAuth 登入。
{
"mcpServers": {
"deapi": {
"type": "http",
"url": "https://mcp.deapi.ai/mcp"
}
}
}README
deAPI MCP Server
Production-ready Model Context Protocol (MCP) server for the deAPI REST API. This server exposes all deAPI AI capabilities as MCP tools, enabling LLMs to perform audio transcription, image generation, OCR, video generation, text-to-speech, and more.
deAPI v2 — this server targets the deAPI v2 client API (OpenAI-aligned noun paths under
/api/v2/*). API v1 is not supported: the tools send v2 payloads only.
Features
- Complete API Coverage: 39 deAPI tools exposed via MCP, covering every v2 client endpoint
- Smart Adaptive Polling: Automatically polls async jobs with optimized intervals based on job type
- OAuth 2.0 Authentication: Secure token exchange via OAuth Authorization Code flow with PKCE
- Error Recovery: Automatic retry logic with exponential backoff
- Progress Reporting: Real-time progress updates to MCP clients
- Type Safety: Full Pydantic schema validation
- Production Ready: Built with FastMCP framework for reliability
Available Tools
Audio Tools
audio_transcription- Transcribe audio files to text using Whisper modelsaudio_transcription_price- Calculate transcription costtext_to_audio- Convert text to natural speech (TTS)text_to_audio_price- Calculate TTS costtext_to_music- Generate music from text description and lyricstext_to_music_price- Calculate music generation costaudio_url_transcription- Transcribe audio from URLs of completed Twitter Spacesaudio_url_transcription_price- Calculate Twitter Spaces transcription cost
Video Transcription Tools
video_file_transcription- Transcribe video files to textvideo_file_transcription_price- Calculate video file transcription costvideo_url_transcription- Transcribe videos from URLs (YouTube, Twitter/X, Twitch, Kick, TikTok)video_url_transcription_price- Calculate video URL transcription cost
Image Tools
text_to_image- Generate images from text promptsimage_to_image- Transform images with text guidanceimage_to_text- Extract text from images (OCR)image_remove_background- Remove background from imagesimage_upscale- Upscale images to higher resolutiontext_to_image_price- Calculate image generation costimage_to_image_price- Calculate image transformation costimage_to_text_price- Calculate OCR costimage_remove_background_price- Calculate background removal costimage_upscale_price- Calculate upscaling cost
Video Tools
text_to_video- Generate videos from text promptsimage_to_video- Animate static images into videosaudio_to_video- Generate video conditioned on audio contentvideo_description- Describe a video in text (from an uploaded file or a video URL)video_upscale- Upscale a video to higher resolutiontext_to_video_price- Calculate text-to-video costimage_to_video_price- Calculate image-to-video costaudio_to_video_price- Calculate audio-to-video costvideo_description_price- Calculate video description costvideo_upscale_price- Calculate video upscaling cost
Embedding Tools
text_to_embedding- Generate text embeddings for semantic searchtext_to_embedding_price- Calculate embedding cost
Prompt Tools
prompt_booster- Enhance a prompt for any deAPI inference type using AI guides (synchronous, returns refined prompt directly)prompt_booster_price- Calculate prompt-enhancement cost
Utility Tools
get_balance- Check account balanceget_available_models- List available AI models with specificationscheck_job_status- Query async job status by ID; withwait_secondsit waits for the job and returns the finished result in the original tool's shape. A failed job reportssuccess: falsewitherror_reason,error_code,retryableandrefunded
Webhooks
Every generation tool accepts webhook_url (HTTPS) and an optional webhook_secret (32–255 chars). deAPI calls that URL when the job finishes, signed with X-DeAPI-Signature: sha256=<HMAC-SHA256(secret, "<timestamp>.<body>")>; the tool still returns the result to the caller as usual.
Model-driven defaults
Generation parameters such as width, height, steps, frames and fps default to the selected model's own values when left unset — each model has different limits, so there is no fixed default that works everywhere. The get_available_models output and every tool description list each model's accepted ranges. Set enhance_prompt: true on text_to_image/image_to_image to let deAPI rewrite the prompt; the result then includes prompt_boost with the prompt actually used.
Installation
Prerequisites
For running the MCP server:
- Python 3.11 or higher
uv,pip, orcondafor package management
For a deAPI account:
- Sign up at app.deapi.ai and create an API token at app.deapi.ai/settings/api-keys
Setup
- Clone the repository:
- Choose your Python environment setup:
Option A: Using uv (recommended - fastest)
Option B: Using pip
Option C: Using conda
- (Optional) Create a
.envfile for configuration:
Usage
Running the Server
The server can run in two modes:
Local Mode (for use with Claude Desktop on the same machine):
The server starts on http://localhost:8000. On loopback it may run without DEAPI_JWT_SECRET_KEY
(it then signs OAuth tokens with a per-process key, so a restart logs clients out).
Remote Mode (for deployment to a remote server):
See the Remote Deployment section for production deployment options.
Connecting from Claude Desktop / Claude.ai
Option 1: Add Connector (Recommended)
Both Claude Desktop and Claude.ai support MCP connectors with built-in OAuth authentication.
- Get your deAPI token from app.deapi.ai/settings/api-keys
- In Claude Desktop or Claude.ai, go to Settings → Connectors → Add Connector
- Fill in the connector details:
- Click Add — Claude will automatically authenticate via OAuth and discover all tools.
For details on the OAuth flow, see AUTH.md.
Option 2: Config File with Bearer Token (Local Development)
Best for: Server running on the same machine, quick setup without OAuth.
Edit your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Replace YOUR_DEAPI_TOKEN with your actual deAPI token. Save the file and restart Claude Desktop.
Using the Tools
Authentication is handled at the connection level, not per-tool-call. Tools do NOT accept a deapi_api_token parameter.
Here's an example workflow:
- Get available models:
- Check your balance:
- Generate an image:
- Transcribe audio:
Note: When calling tools via Claude Desktop or MCP SDK, authentication is handled automatically through the server connection (OAuth or HTTP headers). See AUTH.md for detailed OAuth setup.
Architecture
Key Components
- DeapiClient (
deapi_mcp/deapi_client.py): HTTP client with auth forwarding, built on the deAPI Python SDK transport - PollingManager (
deapi_mcp/polling_manager.py): Smart adaptive polling for async jobs - Schemas (
deapi_mcp/schemas.py): Pydantic models for type safety - Auth code store (
deapi_mcp/auth_code_store.py): single-use OAuth authorization codes, in Redis whenDEAPI_REDIS_HOSTis set (so any replica can finish a login), otherwise in process memory - Webhooks (
deapi_mcp/webhooks.py): optional HMAC-verified receiver for deAPI completion callbacks, so waiting tools wake on the callback instead of polling (DEAPI_WEBHOOKS_INTERNAL) - Tools (
deapi_mcp/tools/): Organized tool implementationsaudio.py- Audio transcription, TTS & music generation toolsimage.py- Image generation, transformation, OCR, background removal & upscalingvideo.py- Video generation, image/audio-to-video, description & upscale toolsembedding.py- Text embedding toolsprompt.py- Prompt booster toolsutility.py- Balance, models, status tools
Smart Adaptive Polling
The server uses job-type-specific polling strategies:
Polling uses exponential backoff with a configurable multiplier (default: 1.5x,
DEAPI_POLLING_<TYPE>__BACKOFF_FACTOR).
Error Handling
- HTTP Errors: Reads are retried (3 attempts) with exponential backoff; a job submission is retried only when it provably was not processed (rate limited, or the connection never opened), so a job is never submitted twice
- Long jobs: one tool call waits at most
DEAPI_TOOL_MAX_WAIT(45 s, below the 60 s call timeout many MCP clients use). A job still running then returnssuccess: true, done: falsewith itsjob_id, andcheck_job_status(job_id, wait_seconds=...)resumes the wait - Job Failures: Reported with the API's reason, error code, and whether the job is retryable / was refunded
- API Errors: Properly formatted error responses
Configuration
Configuration can be set via environment variables (prefixed with DEAPI_). A variable set to
an empty value (DEAPI_REDIS_PORT=) counts as unset and takes the default. Comments go on their
own line: some tools (docker --env-file, kubectl create configmap --from-env-file) keep text
after a value, # ... included, as part of that value. .env.example lists
every variable with its default; the block below shows the common ones.
With internal webhooks on, every job the server submits carries its own receiver URL and the API calls back the moment the job ends; the waiting tool wakes at once, with a slow poll underneath as a safety net. A caller-supplied webhook_url takes precedence for that job (the API takes one webhook per job), which then polls normally. A replayed delivery (same delivery_id) wakes nobody twice. The job registry is in process memory by default; with several replicas, see DEPLOYMENT.md.
Development
Project Structure
Running Tests
Install dev dependencies:
Run tests:
Run smoke tests (requires a running server):
Code Formatting
Format code with Black:
Lint with Ruff:
Type-check with mypy (strict):
CI runs all three plus the test suite on Python 3.11–3.14.
Building your own server on the core
deapi_mcp is importable, so a deployment can assemble its own server from the same tools
and add what it needs (for example its own metrics) without forking:
As with the stock server, set DEAPI_JWT_SECRET_KEY first: without it the app refuses to start
on a non-local host.
metrics is an optional overlay that instruments tool calls and OAuth and mounts its own
routes; the stock server (build_app()) passes none. job_registry replaces the in-process
registry that completion webhooks wake waiting tools through, for a deployment whose replicas
share one receiver URL: implement deapi_mcp.webhooks.JobRegistry (or subclass
JobCompletionRegistry, relay signal to the other replicas and call wake where it arrives).
Its start/stop run with the app's lifespan. Recorders for per-call outcomes and
rejected logins plug in through deapi_mcp.observability. Settings an overlay can use
(DEAPI_METRICS_TOKEN, DEAPI_METRICS_REDIS_DB, DEAPI_METRICS_PREFIX) are already defined
in deapi_mcp.config; the core itself never reads them.
The package ships type information (py.typed) and exposes deapi_mcp.__version__.
API Token Security
Important: The MCP server does NOT store API tokens. Authentication works as follows:
- For Remote HTTP Server: Authentication is handled via OAuth 2.0 (Authorization Code with PKCE) or HTTP headers (Authorization: Bearer token)
- Token forwarding: The server forwards authentication to the deAPI API for each request
- No persistence: Tokens are used only for the specific request and never persisted or logged
- Per-connection auth: Tools do NOT accept
deapi_api_tokenparameters - authentication is managed at the connection level
Always keep your API tokens secure and never commit them to version control. See AUTH.md for detailed OAuth setup.
Remote Deployment
For production environments or when you want to host the MCP server on a remote machine, use the remote server mode.
Quick Start with Docker
- Build and run with Docker:
- Or use Docker Compose (reads
DEAPI_JWT_SECRET_KEYfrom the environment or.env):
- Configure Claude Desktop to connect:
Manual Remote Deployment
- On your remote server:
- For production with systemd:
- Behind a reverse proxy (nginx + SSL):
Cloud Deployment Options
- Railway.app: Push to GitHub, connect repository, deploy automatically
- Fly.io:
fly launch && fly deploy - Heroku:
heroku create && git push heroku main - DigitalOcean: Use App Platform or Droplets with Docker
- AWS/GCP/Azure: Deploy with container services (ECS, Cloud Run, Container Instances)
For detailed deployment instructions, security considerations, monitoring, and troubleshooting, see DEPLOYMENT.md.
Troubleshooting
Connection Issues
If the server fails to connect:
- Check your API token is valid
- Verify network connectivity to api.deapi.ai
- Check the logs for specific error messages
- For remote servers: verify firewall rules and that port 8000 is accessible
Job Timeouts
If jobs are timing out:
- Check your balance with
get_balance - Verify the job type timeout is appropriate
- Use
check_job_statusto check if the job is still processing
Model Not Found
If you get model errors:
- Use
get_available_modelsto see available models - Ensure you're using the correct model name
- Check if the model supports your requested operation
Remote Connection Issues
If remote MCP connection fails:
- Test the server:
curl http://your-server:8000/health(a bareGET /mcpanswers 405: the transport is stateless, POST only) - Check server logs:
docker logs mcp-server-deapiorjournalctl -u mcp-server-deapi - Verify firewall rules and SSL certificates (if using HTTPS)
- Ensure MCP endpoint is accessible from your client
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md.
Support
For issues related to:
- This MCP Server: Open an issue
- A security vulnerability: do not open a public issue; see SECURITY.md
- deAPI Platform: Visit docs.deapi.ai
- MCP Protocol: Visit modelcontextprotocol.io
來源:README.md,提交 a4d6c0b
工具
0版本歷史
3- v0.6.3最新Nov 7, 2026
- v0.6.2Nov 5, 2026
- v0.3.0Sep 16, 2026
評分
已滿足適用檢查項的 85%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
- 已宣告認證方式必需10 分
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分