Connector guide7-minute read13 MCP tools7 languages

Connect Gemini to Microsoft Copilot via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

HCBy HelpCode teamUpdated 7 min read Open-source on GitHub

No credit card · 7-day trial · Self-host alternative available

Google Gemini API

Google Gemini API

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

tools

13

Region

INTL

Category

Public Data

Authentication

API Key

Required env vars

GEMINI_API_KEY
Install in one click on Cloud

7-day free trial · No credit card

  • 7-day free trial
    No credit card required
  • GDPR & SOC 2 ready
    EU data residency, audit logs
  • Open-source on GitHub
    Open source · AGPL-3.0
  • Works with ChatGPT, Claude, Gemini
    Any MCP-compatible client

Summary

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Guided setup

Connect Google Gemini API to Microsoft Copilot in 2 minutes

Start a free trial on AnythingMCP Cloud, connect Google Gemini API in the guided setup, then add your MCP URL to Microsoft Copilot. No code and no server to run.

No credit card · 7-day trial · Self-host alternative available

Try asking

Example prompts for Google Gemini API

Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.

Google Gemini API · live via MCP
Share
Opus 4.7

Claude is AI and can make mistakes. Please double-check responses.

💡 No install? Use cloud.anythingmcp.com directly. Sign in, click Connectors → Google Gemini API, paste your credentials, mint an MCP API key and you're done. No Docker, no git clone, no local server.

Gemini API + Microsoft Copilot

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Prerequisites

See the full setup instructions baked into the connector (visible in the in-app store when you select the connector). The required environment variables for this connector are:

GEMINI_API_KEY

Step 1 — Get credentials

  1. Open Google AI Studio at https://aistudio.google.com/apikey and sign in with your Google account.
  2. Click Create API key, pick or create a Google Cloud project, and copy the key. It usually starts with AIza.
  3. Paste it into GEMINI_API_KEY and install the connector. The key is sent only to Google.
  4. To generate images, or for higher limits, enable billing for the key's project in AI Studio (Get API key, then Set up billing). Image models have no free tier.
  5. Run gemini_list_models to see which models your key can use. It costs nothing.

Billing: the Gemini API runs on your own key. Every call except the model list, the Files API and token counting is billed to the key's project or counts against its free tier. On the free tier, text and embedding models are free within per-minute and per-day limits, and Google may use free-tier prompts to improve its products. The AI uses cheap, fast defaults (gemini-3.1-flash-lite for text, gemini-embedding-001 for embeddings) unless you ask for a stronger model, and gemini_count_tokens estimates a long prompt for free before you send it.

Pictures cost money: gemini_generate_image and gemini_edit_image create or change pictures with Nano Banana and show them right in the chat. The default image model costs about $0.034 per picture, the most capable one about $0.13, so the AI confirms with you before every picture. Pictures over 4 MB are not returned: ask for a smaller size.

Files by link: gemini_analyze_file_url answers questions about an image, PDF, text or CSV file or a short video given by a public HTTPS link of up to 15 MB. Gemini fetches the link itself, so it must open without a login. The Files API tools list and read the project's stored files, which expire after 48 hours. gemini_delete_file is switched off at install.

Common errors: 400 with an invalid key: the key is wrong or was deleted, so create a new one in AI Studio. 403: the key is restricted to other APIs (in the Google Cloud console under Credentials, API restrictions, allow the Generative Language API), the API is off in its project, or a file link is not public. 404: the model code does not exist, so check gemini_list_models. 429: a free-tier or paid-tier limit was reached, or an image model was called without billing; wait, or enable billing. A 400 saying the free tier is not available means it is not offered in your region: enable billing. A request blocked by Google's safety filters comes back as an error and is not retried.

The connector does not upload files, stream audio or video (Live API), generate speech or video (Veo), or handle context caching, batch jobs, tuned models or file search stores.

Step 2 — Install the adapter

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

Step 3 — Add the connector in Microsoft Copilot

Your server URL: in AnythingMCP, open MCP Servers → the server this connector is on, and copy its URL (https://cloud.anythingmcp.com/mcp/…). Use it wherever this guide shows YOUR_SERVER_ID.

Microsoft Copilot uses MCP servers through agents built in Copilot Studio: you add AnythingMCP to an agent as a tool, then publish the agent to Microsoft 365 Copilot and Teams. Copilot Studio connects from Microsoft's cloud over Streamable HTTP, which AnythingMCP supports.

  1. In Copilot Studio, open your agent (or create one), go to Tools and choose Add a tool → New tool → Model Context Protocol.
  2. Enter a Server name (for example AnythingMCP), a Server description that says what the connector does, and the Server URL https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID. Copilot Studio uses the description to decide when to call the server.
  3. Under authentication, choose API key, set Type to Header and the header name to X-API-Key, then select Create.
  4. In Add tool, choose Create a new connection, paste an MCP API key from AnythingMCP (MCP Servers → your server → API keys) and select Add to agent.
  5. Try it in the agent's Test pane: ask for something that needs the Gemini API tools.
  6. Select Publish, then Channels → Microsoft 365 and Microsoft Teams, keep Make agent available in Microsoft Copilot selected and choose Add channel. See agent in Teams installs it for you; in Microsoft 365 Copilot, type @ and pick the agent.

Prefer per-user sign-in? Choose OAuth 2.0 → Dynamic discovery instead of an API key: each user then signs in to AnythingMCP the first time the agent calls it.

Self-hosting? Use your instance's public HTTPS address instead of https://cloud.anythingmcp.com. Copilot Studio connects from Microsoft's cloud, so localhost does not work.

Available tools

ToolWhat it does
gemini_list_modelsList the Gemini models this API key can use, with their input and output token limits, whether they think, and the methods they support…
gemini_get_modelRead one Gemini model: display name, description, version, input and output token limits, default temperature, top-p and top-k, whether it…
gemini_generate_textAsk a Gemini model one question and get its text answer (generateContent)
gemini_generate_contentFull generateContent call for conversations and mixed input. contents is the list of turns: [{"role": "user", "parts": [{"text": "..."}]}…
gemini_analyze_file_urlAsk a Gemini model about a file on the web: an image, a PDF, a text or CSV file or a short video, given by its public HTTPS link (up to 15…
gemini_count_tokensCount how many input tokens a text is for a Gemini model, to estimate cost or check it fits the context window before a long call
gemini_embed_textTurn one text into an embedding vector (embedContent) for semantic search, clustering or similarity
gemini_batch_embed_textsEmbed up to 20 texts in one call (batchEmbedContents); the vectors come back in the order given
gemini_generate_imageCreate a picture from a text description with a Gemini image model (Nano Banana) and return it as an image the user can see
gemini_edit_imageChange an existing picture with a Gemini image model: describe the edit ("replace the sky with a sunset", "remove the person on the left"…
gemini_list_filesList the files stored in the project's Gemini Files API (uploaded for prompts, or generated), newest first, with name, display name, MIME…
gemini_get_fileRead one file of the Gemini Files API: display name, MIME type, size, state (PROCESSING, ACTIVE or FAILED), uri to use in…
gemini_delete_fileDelete a file from the Gemini Files API before it expires

Example prompts

  • "Read the supplier price list PDF at the link I paste below and list every product with its price."
  • "Ask Gemini to rewrite this product description in a shorter, friendlier tone for our online shop."
  • "How many tokens is this proposal for Gemini, and what would summarising it cost on the default model?"
  • "Create a product photo of our blue ceramic mug on a wooden table with Nano Banana, but tell me the cost and wait for my OK first."

FAQ

Which Copilot is this for? Microsoft 365 Copilot at work, through agents built in Copilot Studio. The Microsoft Copilot app for personal accounts has no option to add your own MCP server.

What do I need? A work account with access to Copilot Studio (a license or a trial) to build the agent. People who use it in Microsoft 365 Copilot or Teams need access to the agent: share it with them, or ask an admin to publish it to the organization. If your organization applies data policies to Power Platform connectors, they cover MCP servers too.

The agent doesn't call the tools. Check that the header name is exactly X-API-Key and that the key belongs to the same MCP server as the URL, and make the server description specific: Copilot Studio uses it to decide when to call the server. Publish the agent again after each change; in an open chat, type "start over" to get the new version.

Next steps

Was this guide helpful?

Connect Google Gemini API to Microsoft Copilot in 2 minutes

Start a free trial on AnythingMCP Cloud, connect Google Gemini API in the guided setup, then add your MCP URL to Microsoft Copilot. No code and no server to run.

Related guides

Connectors

Connect Gemini to ChatGPT via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Connectors

Connect Gemini to Claude via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Connectors

Connect Gemini to Cursor via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Connectors

Connect Gemini to Gemini CLI via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Connectors

Connect Gemini to Meta Muse via MCP

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

Connectors

Gemini MCP Server: Models, Files and Analysis

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.