home / mcp / cogview-4 text-to-image mcp server
Provides an MCP-compliant interface to generate images from text prompts using CogView-4 API.
Configuration
View docs{
"mcpServers": {
"2716025420-mcp-zhipu-text-to-image-kuma": {
"command": "python",
"args": [
"F:\\mcp3\\varable_try_mcp.py"
],
"env": {
"ZHIPU_API_KEY": "your_api_key_here"
}
}
}
}This MCP server provides an interface to generate images from text prompts using the CogView-4 API via the MCP (Model Context Protocol) standard. It enables you to run the image generator locally or remotely and connect through MCP clients such as Claude Desktop or Cline, with robust logging and error handling.
You can run the MCP server locally or connect to it from MCP clients to generate images from text prompts. The server supports stdio MCP mode and integrates CogView-4 for image generation. To start using it, ensure you have a valid API key from the CogView/Open Platform and enable your MCP client to communicate with the server via the configured stdio interface.
Prerequisites you need before installation:
- Python 3.8 or newer for the server runtime.
- Node.js and npm for optional npm-based usage.
- A CogView-4 API key obtained from the智谱 AI开放平台.
Install the MCP server package globally using npm (recommended for quick start) or install from source and run the Python script directly.
npm install -g mcp-zhipu-text-to-image-kumaCreate an environment file or set the variable in your environment. You must provide your CogView-4 API key to authorize image generation.
ZHIPU_API_KEY=your_actual_api_key_hereRun the MCP server directly from the source file via Python.
python F:\mcp3\varable_try_mcp.pyStart the MCP server using npm if you installed via npm.
npm startConfigure your MCP client to connect to the server through a stdio MCP entry. The following examples show how to set up the server entry on Claude Desktop or Cline. These configurations reference the command used to launch the server and the required environment variable.
{
"mcpServers": {
"mcp-zhipu-text-to-image-kuma": {
"command": "python",
"args": ["F:\\mcp3\\varable_try_mcp.py"],
"env": {
"ZHIPU_API_KEY": "your_api_key_here"
}
}
}
}You can run the server directly from the source or use the npm-based start command.
# From source
python varable_try_mcp.py
# Or via npm (if installed)
npm startPrimary tool available is generate_image, which creates images from prompts. It accepts a required prompt and optional size and quality parameters. The API endpoint used is the CogView-4 generation service with a 60-second timeout.
Generates an image from the provided prompt and optional size and quality, returning the image URL and related metadata.