Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Agentrix MCP Tools
https://github.com/xmz-ai/agentrix-mcp-tools
Admin
Provides various tools for MCP.
Tokens:
6,906
Snippets:
54
Trust Score:
2.5
License:
Apache-2.0
Update:
9 months ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Install Dependencies and Build Project (Bash) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Navigates to the project directory, installs npm dependencies, and builds the TypeScript project into the 'dist/' directory. This is the initial setup step before local testing or publishing. ```bash cd gemini-image-mcp npm install npm run build ``` -------------------------------- ### Publish to npm (Bash) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Logs into an npm account if not already authenticated and then publishes the package to the npm registry with public access. This makes the MCP tool available for global installation. ```bash # Login to npm (first time only) npm login # Publish the package npm publish --access public ``` -------------------------------- ### Test MCP Server Locally (Bash) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Sets necessary environment variables for the Gemini API key, base URL, and model, then starts the local MCP server. This allows for immediate testing of the image generation functionality before deployment. ```bash # Set environment variables export GEMINI_API_KEY="your-api-key" export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta" export GEMINI_MODEL="gemini-2.5-flash-image" # Run the server npm start ``` -------------------------------- ### Troubleshoot npm Install Permissions (Bash) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Provides commands to resolve EPERM errors during `npm install`. Solutions include specifying an alternative npm cache directory or cleaning the npm cache forcefully before reinstalling dependencies. ```bash # Use a different cache directory npm install --cache /tmp/npm-cache-$USER # Or clean npm cache npm cache clean --force npm install ``` -------------------------------- ### Development Setup for Gemini Image MCP Server (Bash) Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Outlines the steps to set up and run the Gemini Image MCP server in development mode using npm. Includes installing dependencies, building the project, and running in watch mode. ```bash cd gemini-image-mcp # Install dependencies npm install # Build the project npm run build # Watch mode for development (auto-rebuild on changes) npm run dev # Run the built server npm start ``` -------------------------------- ### Install Gemini Image MCP Server via npm Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Installs the Gemini Image MCP Server globally using npm. This is the simplest way to get started if the package is published. ```bash npm install -g @agentrix/gemini-image-mcp ``` -------------------------------- ### Development Mode with Auto-Rebuild (Bash) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Starts the development server using `npm run dev`, which typically runs TypeScript in watch mode. This command is useful during development as it automatically recompiles code upon detecting file changes. ```bash npm run dev ``` -------------------------------- ### Configure Claude Desktop with Published Package (JSON) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Illustrates how to configure Claude Desktop to use the published `@agentrix/gemini-image-mcp` package. It shows configurations for direct command execution or via npx, including setting the necessary API key environment variable. ```json { "mcpServers": { "gemini-image": { "command": "gemini-image-mcp", "env": { "GEMINI_API_KEY": "your-api-key-here" } } } } ``` ```json { "mcpServers": { "gemini-image": { "command": "npx", "args": ["-y", "@agentrix/gemini-image-mcp"], "env": { "GEMINI_API_KEY": "your-api-key-here" } } } } ``` -------------------------------- ### Server Setup and Execution Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Instructions for running the Gemini Image MCP Server in standalone and development modes, including necessary environment variables and build commands. ```APIDOC ## Server Setup ### Standalone Mode To run the server as a standalone process: 1. **Set Environment Variables:** ```bash export GEMINI_API_KEY="your-api-key-here" export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta" export GEMINI_MODEL="gemini-2.5-flash-image" ``` 2. **Run the Server:** ```bash gemini-image-mcp ``` The server will output status information to stderr, indicating it's running on stdio. ### Development Mode For development purposes, follow these steps: 1. **Navigate to Project Directory:** ```bash cd gemini-image-mcp ``` 2. **Install Dependencies:** ```bash npm install ``` 3. **Build the Project:** ```bash npm run build ``` 4. **Run in Watch Mode (for auto-rebuilds):** ```bash npm run dev ``` 5. **Run the Built Server:** ```bash npm start ``` ``` -------------------------------- ### Install Gemini Image MCP Server from Source Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Installs the Gemini Image MCP Server by cloning the repository, installing dependencies, and building the project from source. ```bash git clone <repository-url> cd gemini-image-mcp npm install npm run build ``` -------------------------------- ### Configure Claude Desktop for Local MCP Server (JSON) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/QUICKSTART.md Modifies the Claude Desktop configuration file to point to the locally built `gemini-image-mcp` project. This enables Claude Desktop to use the local MCP server for image generation tasks by specifying the command and arguments. ```json { "mcpServers": { "gemini-image": { "command": "node", "args": ["/absolute/path/to/gemini-image-mcp/dist/index.js"], "env": { "GEMINI_API_KEY": "your-api-key-here" } } } } ``` -------------------------------- ### Development Commands for Gemini Image MCP Server Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Common commands for developing the Gemini Image MCP Server, including installing dependencies, building, and running in watch mode. ```bash # Install dependencies npm install # Build npm run build # Watch mode for development npm run dev # Run locally npm start ``` -------------------------------- ### Run Gemini Image MCP Server Standalone Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Starts the Gemini Image MCP Server as a standalone process. Requires setting necessary environment variables like GEMINI_API_KEY. ```bash export GEMINI_API_KEY="your-api-key-here" export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta" export GEMINI_MODEL="gemini-2.5-flash-image" gemini-image-mcp ``` -------------------------------- ### Error Handling Examples (JavaScript) Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Illustrates common error responses from the Gemini Image MCP Server, including missing API key, API errors, network timeouts, and cases where no image data is returned. ```javascript // Missing API Key Error (server startup) // Error: GEMINI_API_KEY environment variable is required // Process exits with code 1 // API Error Response { "content": [ { "type": "text", "text": "Error generating image: {\"error\":{\"code\":400,\"message\":\"Invalid API key\"}}" } ] } // Network Timeout Error (60 second timeout) { "content": [ { "type": "text", "text": "Error generating image: timeout of 60000ms exceeded" } ] } // No Image Data Returned { "content": [ { "type": "text", "text": "Error generating image: No image data returned from Gemini API" } ] } ``` -------------------------------- ### Generate Image Tool - Save to Disk (JavaScript) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Example of how to call the 'generate_image' tool to create an image and save it directly to a specified directory. Supports prompt and path arguments. ```javascript { "name": "generate_image", "arguments": { "prompt": "A cute cat sitting on a sofa", "path": "/Users/username/images" } } ``` -------------------------------- ### MCP Tool Call: Widescreen Image with Aspect Ratio Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt An example MCP tool call to `generate_image` specifying a widescreen aspect ratio (16:9) for the generated image. ```javascript // MCP Tool Call { "name": "generate_image", "arguments": { "prompt": "A futuristic cityscape with flying cars and neon lights", "aspectRatio": "16:9" } } // Response { "content": [ { "type": "text", "text": "Successfully generated 1 image for prompt: \"A futuristic cityscape with flying cars and neon lights\"" }, { "type": "image", "data": "iVBORw0KGgoAAAANSUhEUgAA...", "mimeType": "image/png" } ] } ``` -------------------------------- ### MCP Tool Call: Basic Image Generation (Base64) Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt An example MCP tool call to the `generate_image` function with a basic prompt, expecting base64 encoded image data in the response. ```javascript // MCP Tool Call { "name": "generate_image", "arguments": { "prompt": "A serene mountain landscape at sunset with a lake reflection" } } // Response { "content": [ { "type": "text", "text": "Successfully generated 1 image for prompt: \"A serene mountain landscape at sunset with a lake reflection\"" }, { "type": "image", "data": "iVBORw0KGgoAAAANSUhEUgAA...", "mimeType": "image/png" } ] } ``` -------------------------------- ### Generate Image Tool - Return Base64 Data (JavaScript) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Example of how to call the 'generate_image' tool to create an image and receive its base64 encoded data. Supports specifying prompt, aspect ratio, and negative prompts. ```javascript { "name": "generate_image", "arguments": { "prompt": "A serene mountain landscape at sunset with a lake reflection", "aspectRatio": "16:9", "negativePrompt": "people, buildings, text" } } ``` -------------------------------- ### Configure Gemini Image MCP Server for Claude Desktop (global) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Configuration for Claude Desktop to use a globally installed Gemini Image MCP Server. This requires the 'gemini-image-mcp' command to be available in the system's PATH. ```json { "mcpServers": { "gemini-image": { "command": "gemini-image-mcp", "env": { "GEMINI_API_KEY": "your-api-key-here" } } } } ``` -------------------------------- ### Publishing to npm Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Steps to publish the Gemini Image MCP Server to npm, including updating the version, building, logging in, and publishing. ```bash 1. Update version in `package.json` 2. Build the project: `npm run build` 3. Login to npm: `npm login` 4. Publish: `npm publish --access public` ``` -------------------------------- ### Run Gemini Image MCP Server (Bash) Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Provides bash commands to set up environment variables and run the Gemini Image MCP server in standalone mode. Requires API key, base URL, and model configuration. ```bash # Set required environment variables export GEMINI_API_KEY="your-api-key-here" export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta" export GEMINI_MODEL="gemini-2.5-flash-image" # Run the server gemini-image-mcp # Output (to stderr): # Gemini Image MCP Server running on stdio # Using base URL: https://generativelanguage.googleapis.com/v1beta # Using model: gemini-2.5-flash-image ``` -------------------------------- ### Configure Gemini Image MCP Server for Claude Desktop (npx) Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md Configuration for Claude Desktop to use the Gemini Image MCP Server via npx. This requires setting environment variables like GEMINI_API_KEY. ```json { "mcpServers": { "gemini-image": { "command": "npx", "args": ["-y", "@agentrix/gemini-image-mcp"], "env": { "GEMINI_API_KEY": "your-api-key-here", "GEMINI_BASE_URL": "https://generativelanguage.googleapis.com/v1beta", "GEMINI_MODEL": "gemini-2.5-flash-image" } } } } ``` -------------------------------- ### Image Generation Tool Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt This section details the `generate_image` tool, used for creating images based on text prompts. It supports various parameters like aspect ratio, negative prompts, and saving images to disk. ```APIDOC ## POST /tools/generate_image ### Description Generates an image based on a provided text prompt. Supports specifying aspect ratio, negative prompts to exclude certain elements, and an optional path to save the generated images directly to disk. ### Method POST ### Endpoint /tools/generate_image ### Parameters #### Request Body - **prompt** (string) - Required - The text description of the image to generate. - **aspectRatio** (string) - Optional - The desired aspect ratio of the image (e.g., "4:3", "16:9"). - **negativePrompt** (string) - Optional - A comma-separated list of elements to exclude from the generated image. - **path** (string) - Optional - The file system path where the generated images should be saved. If not provided, images are returned directly. ### Request Example ```json { "name": "generate_image", "arguments": { "prompt": "A cute cat sitting on a sofa in a cozy living room", "aspectRatio": "4:3", "negativePrompt": "dogs, people, text, watermarks" } } ``` ### Response #### Success Response (200) - **content** (array) - Contains a list of response objects, which can be of type "text" for status messages or "image" for image data. - **type** (string) - "text" or "image" - **text** (string) - Description of the operation outcome or errors. - **data** (string) - Base64 encoded image data (if type is "image"). - **mimeType** (string) - The MIME type of the image data (if type is "image"). #### Response Example ```json { "content": [ { "type": "text", "text": "Successfully generated 1 image for prompt: \"A cute cat sitting on a sofa in a cozy living room\"" }, { "type": "image", "data": "iVBORw0KGgoAAAANSUhEUgAA...", "mimeType": "image/png" } ] } ``` ``` -------------------------------- ### Gemini Image MCP Server generate_image Tool Schema Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Defines the input schema for the `generate_image` tool, detailing required and optional parameters like prompt, aspectRatio, negativePrompt, and path. ```typescript { name: "generate_image", description: "Generate an image using Gemini Banana API based on a text prompt", inputSchema: { type: "object", properties: { prompt: { type: "string", description: "The text prompt describing the image to generate" }, aspectRatio: { type: "string", enum: ["1:1", "16:9", "9:16", "4:3", "3:4"], description: "The aspect ratio of the generated image (default: 1:1)" }, negativePrompt: { type: "string", description: "Optional negative prompt describing what to avoid in the image" }, path: { type: "string", description: "Optional directory path to save generated images as PNG files" } }, required: ["prompt"] } } ``` -------------------------------- ### Error Handling Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Details common error scenarios encountered by the server, including missing API keys, API errors, network timeouts, and cases where no image data is returned. ```APIDOC ## Error Handling The server provides structured error responses for various failure conditions: ### Missing API Key When starting the server, if the `GEMINI_API_KEY` environment variable is not set, an error message will be displayed, and the process will exit. ``` Error: GEMINI_API_KEY environment variable is required ``` ### API Error Response If the Gemini API returns an error, the response will be formatted as follows: ```json { "content": [ { "type": "text", "text": "Error generating image: {\"error\":{\"code\":400,\"message\":\"Invalid API key\"}}" } ] } ``` ### Network Timeout Error A 60-second timeout is enforced for API requests. If a timeout occurs: ```json { "content": [ { "type": "text", "text": "Error generating image: timeout of 60000ms exceeded" } ] } ``` ### No Image Data Returned If the API call is successful but does not return image data: ```json { "content": [ { "type": "text", "text": "Error generating image: No image data returned from Gemini API" } ] } ``` ``` -------------------------------- ### Generate Image with Negative Prompt (JavaScript) Source: https://context7.com/xmz-ai/agentrix-mcp-tools/llms.txt Demonstrates how to call the 'generate_image' tool with a negative prompt to exclude specific elements from the generated image. This is useful for refining image content. ```javascript // MCP Tool Call { "name": "generate_image", "arguments": { "prompt": "A cute cat sitting on a sofa in a cozy living room", "aspectRatio": "4:3", "negativePrompt": "dogs, people, text, watermarks" } } // Response { "content": [ { "type": "text", "text": "Successfully generated 1 image for prompt: \"A cute cat sitting on a sofa in a cozy living room\"" }, { "type": "image", "data": "iVBORw0KGgoAAAANSUhEUgAA...", "mimeType": "image/png" } ] } ``` -------------------------------- ### Image Generation API Source: https://github.com/xmz-ai/agentrix-mcp-tools/blob/main/gemini-image-mcp/README.md This endpoint allows users to generate images from text prompts using the Gemini API. It supports various aspect ratios, negative prompts, and can either return base64 encoded images or save them to a specified directory. ```APIDOC ## POST /generate_image ### Description Generate an image from a text prompt. Can return base64 encoded images or save them to disk. ### Method POST ### Endpoint /generate_image ### Parameters #### Request Body - **name** (string) - Required - The name of the tool, which is 'generate_image'. - **arguments** (object) - Required - The arguments for the tool. - **prompt** (string) - Required - The text description of the image to generate. - **aspectRatio** (string) - Optional - The aspect ratio of the image. Options: "1:1", "16:9", "9:16", "4:3", "3:4". Default: "1:1". - **negativePrompt** (string) - Optional - Description of elements to avoid in the image. - **path** (string) - Optional - Directory path to save generated images. If provided, all images will be saved as PNG files instead of returning base64 data. ### Request Example #### Example 1: Return base64 data ```json { "name": "generate_image", "arguments": { "prompt": "A serene mountain landscape at sunset with a lake reflection", "aspectRatio": "16:9", "negativePrompt": "people, buildings, text" } } ``` #### Example 2: Save to disk ```json { "name": "generate_image", "arguments": { "prompt": "A cute cat sitting on a sofa", "path": "/Users/username/images" } } ``` ### Response #### Success Response (200) When `path` is NOT provided: - **message** (string) - Text confirmation message. - **images** (array of objects) - Base64 encoded image data with MIME type. - **data** (string) - Base64 encoded image string. - **mimeType** (string) - The MIME type of the image (e.g., "image/png"). When `path` is provided: - **message** (string) - Text message with list of saved file paths. #### Response Example #### Example 1: Base64 Data Response ```json { "message": "Successfully generated 1 image for prompt: 'A serene mountain landscape at sunset with a lake reflection'", "images": [ { "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=", "mimeType": "image/png" } ] } ``` #### Example 2: Save to Disk Response ``` Successfully generated 2 images for prompt: "A cute cat sitting on a sofa" Images saved to: - /Users/username/images/image_1737023456789_1.png - /Users/username/images/image_1737023456789_2.png ``` #### Error Response (e.g., 400, 500) - **error** (string) - A descriptive error message. ```