Skip to main content
Glama

Gemini MCP Server

A general-purpose MCP server that uses the Google Gemini API to generate text and images (Imagen).

Generated images are returned as local absolute paths (the image data itself is not included in the tool call result). The intended use is as the first stage of a two-step flow: pass the saved file to ftp_upload_file in ftp-mcp to make it a public URL, then register it in the WordPress media library with wp_upload_media_from_url in wp-mcp. Text generation results are returned directly as the tool call result.


1. Setup

cd gemini-mcp
npm install

Copy config.json.example to config.json and enter the API key issued by Google AI Studio ( https://aistudio.google.com/apikey ) (This file contains an API key, so never publish, share, or commit it to Git. It is included in .gitignore).

cp config.json.example config.json
{
  "api_key": "AIza................................",
  "default_text_model": "gemini-2.5-flash",
  "default_image_model": "imagen-4.0-generate-001"
}
  • api_key: The API key issued by Google AI Studio.

  • default_text_model: The model ID used when the model parameter of generate_text is omitted.

  • default_image_model: The model ID used when the model parameter of generate_image is omitted.

The model lineup is updated from time to time in Google's official documentation, so check the latest model IDs at https://ai.google.dev/gemini-api/docs/models (text) / https://ai.google.dev/gemini-api/docs/imagen (image).

The server itself can start even if the API key is not set (left as a placeholder). When you actually call generate_text / generate_image, you will get an authentication error from Google.

Related MCP server: MCP Nano Banana

2. Registering with Claude Code

Add the MCP server information to .mcp.json in the root folder of the project that uses Claude Code.

{
  "mcpServers": {
    "gemini": {
      "command": "node",
      "args": ["/MCPの保存パス/gemini-mcp/index.js"],
      "env": {
        "GEMINI_MCP_CONFIG_PATH": "/MCPの保存パス/gemini-mcp/config.json"
      }
    }
  }
}

After registering, restart the Claude Code session to reload the MCP server.

3. Provided Tools

  • gemini_check_config — Checks whether the API key is set and the default model names (does not call the API).

  • generate_text — Generates text for a prompt and returns it as is.

    • prompt (required): The input prompt.

    • system_instruction (optional): A system instruction that specifies the overall behavior of the model.

    • temperature (optional, 0–2): The randomness of the output.

    • model (optional): A model ID that overrides default_text_model.

    • Return value: The generation model name and generated text.

  • generate_image — Generates an image from a text prompt and saves it as PNG/JPEG in the specified local folder.

    • prompt (required): A description of the image you want to generate.

    • output_dir (required): The absolute path of the destination directory (created automatically if it does not exist).

    • file_prefix (optional, default image): The prefix of the saved file name.

    • number_of_images (optional, default 1, max 4): The number of images to generate.

    • aspect_ratio (optional, default 1:1): 1:1 / 3:4 / 4:3 / 9:16 / 16:9.

    • negative_prompt (optional): Elements you do not want included.

    • model (optional): A model ID that overrides default_image_model.

    • Return value: The generation model name, prompt, absolute path/MIME type of each saved file, etc.

Notes

  • The dependency library is Google's official @google/genai SDK.

  • If a request is blocked by the safety filter, or if the response contains no content, it is returned as an error.

  • For image generation use cases (article eye-catch images, in-body images, etc.) and how to reflect them in the article body, see docs/tasks/eyecatch-image.md / docs/tasks/image-embed.md (on each project side).

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nao9net/gemini-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server