- Home
- MCP servers
- Gemini Image Generation
Gemini Image Generation
- typescript
0
GitHub Stars
typescript
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"mcp-mirror-sanxfxteam_gemini-mcp-server": {
"command": "npx",
"args": [
"-y",
"github:sanxfxteam/gemini-mcp-server"
],
"env": {
"GEMINI_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}This MCP server adds image generation capabilities by interfacing with Gemini 2 through a Model Context Protocol workflow. You can generate images by sending the generateImage tool request from an MCP client, enabling automated image creation in your workflows and apps.
How to use
You will use an MCP client to call the generateImage tool provided by this server. Start by running the MCP server locally, then send a request to generate images based on a text prompt. You can configure the client to specify how many images to produce, the aspect ratio, and how it handles person generation. Start the server with the standard start command, then test the flow using the client inspector or your regular MCP client workflow.
Typical usage patterns include generating a small set of images from a descriptive prompt, adjusting the aspect ratio to fit your layout, and controlling the number of samples for faster feedback. Ensure your Gemini API access is properly configured and your API key is available to the server either via environment variables or a local .env file.
How to install
Prerequisites you need before installing the server are Node.js and npm. Verify Node.js and npm are installed on your system.
# Ensure Node.js and npm are installed
node -v
npm -v
# Install dependencies for the MCP server
npm install
# Create a configuration file with your Gemini API key
# Example: put this in a .env file in the root directory
GEMINI_API_KEY=your_api_key_here
# Start the MCP server
npm start
If you want to test the server quickly using an inspector tool, you can run the following command to start via the inspector harness compatible with MCP servers.
npx @modelcontextprotocol/inspector npm run start
Additional content
Configuration and security notes: The server reads your Gemini API key to access the Gemini 2 image generation API. Store the key securely and avoid embedding it in client-side code. Use environment variables or a protected .env file in the server environment.
Configuration example: place the following MCP configuration in your client setup to connect to this server. It uses npx to run the MCP server package and passes your API key through the environment.
{
"mcpServers": {
"gemini-imagen": {
"command": "npx",
"args": ["-y", "github:sanxfxteam/gemini-mcp-server"],
"env": {
"GEMINI_API_KEY": "your_api_key_here"
}
}
}
}
Available tools
generateImage
Generates images using Gemini 2's experimental image generation API. You provide a prompt, the number of samples, and optional settings such as aspect ratio and person-generation controls.