doubao-image-mcp
v0.2.5
Published
Doubao AI image generation MCP server
Downloads
377
Readme
Custom MCP Server
A Model Context Protocol (MCP) server that exposes custom tools for Claude.
Tools Available
generate_image - Generate images using Doubao AI and save to local file
- Parameters:
prompt(string, required): Text description of the image to generatesize(string, optional): Output image size. Supported values:2K,3K, or<width>x<height>(for example3072x2048)
- Returns: Generation details (model, requested/returned size) and path to the locally saved image file
- Default settings:
- Model (preferred): doubao-seedream-5-0-260128
- Automatic fallbacks when the account has not activated the preferred model:
- doubao-seedream-5-0-lite-260128
- doubao-seedream-4-5-251128
- Size: 2K
- Sequential image generation: disabled
- Response format: url
- Watermark: false
- Stream: false
- Requirements: Set
DOUBAO_API_KEYenvironment variable with your API key
Setup and Installation
Install dependencies:
npm installBuild the server:
npm run buildSet up environment variable for Doubao API:
export DOUBAO_API_KEY="your-api-key-here"Or add it to your shell profile (
.bashrc,.zshrc, etc.).Run the server:
npm start
For development with auto-reload:
npm run devAutomated npm Publishing
This project publishes to npm automatically when a Git tag like v0.2.1 is pushed.
This workflow uses npm Trusted Publishing (OIDC), so no NPM_TOKEN secret is required.
- In npm package settings, configure Trusted Publisher:
- Provider:
GitHub Actions - Owner:
strzhao - Repository:
doubao-image-mcp - Workflow file:
npm-publish.yml - Environment: leave empty
- Provider:
- Ensure
package.jsonversion matches the tag (v<version>) - Push tag to trigger workflow:
git push origin v0.2.1Connecting to Claude Code
To use this MCP server with Claude Code, add it to your Claude Code configuration:
Edit your Claude Code config file (usually at
~/.claude/claude_desktop_config.json)Add the server configuration (recommended: run from npm package via
npx):
{
"mcpServers": {
"doubao-image-mcp": {
"command": "npx",
"args": ["-y", "doubao-image-mcp"]
}
}
}Or if you want to run it from the local project directory:
{
"mcpServers": {
"doubao-image-mcp": {
"command": "npm",
"args": ["start"],
"cwd": "/absolute/path/to/this/project"
}
}
}Adding More Tools
To add more tools:
- Add the tool definition to the
toolsarray insrc/index.ts - Add a new case in the
switchstatement in theCallToolRequestSchemahandler - Rebuild and restart the server
Development
- Write TypeScript code in the
src/directory - The project uses
tsxfor development with hot reload - Build output goes to
dist/directory
License
MIT
