# Gemini MCP Server > **Gemini MCP Server** is a hosted, multitenant Model Context Protocol (MCP) server run by **MewCP** (https://mewcp.com), giving AI agents managed access to Gemini. > > MewCP takes care of all MCP infrastructure for you — credential storage, OAuth flows, > token refresh, and production-grade auto-scaling — so your AI agents can connect to > third-party services and run freely without you managing any MCP server yourself. > > To connect your agent to this server you need a MewCP account and two values: > - MEWCP_KEY — your personal API key (dashboard → Developer) > - CREDENTIAL_ID — the stored credential MewCP securely injects per request > > Server page: https://mewcp.com/mcp/gemini > MewCP docs: https://docs.mewcp.com > Full catalog: https://mewcp.com/llms.txt ## About Access Google's Gemini models for text generation, reasoning, coding, multimodal analysis and AI-powered workflows. Process text, images and structured data through advanced AI capabilities. ## How to connect Server Page URL: https://mewcp.com/mcp/gemini Gateway URL: https://gateway.mewcp.com/gemini/mcp Every request to this server requires two headers: Authorization: Bearer — your MewCP API key (dashboard → Developer) x-mewcp-credential-id: — the stored credential ID for this service All connection snippets and ready-to-use code examples are available on the server page and in this document below. --- ## Server documentation **Access Google's most capable AI models through a single MCP tool.** A Model Context Protocol (MCP) server that exposes Google Gemini's API for generating text using state-of-the-art large language models. ## Overview The mewcp-gemini MCP Server provides direct access to Google's Gemini LLMs: - Generate high-quality text responses from natural language prompts - Choose between fast and capable Gemini model variants - Integrate Gemini's reasoning into any MCP-compatible AI workflow Perfect for: - AI agents that need to delegate subtasks to a powerful LLM - Generating summaries, translations, code, or creative content - Augmenting workflows with Gemini's reasoning and language capabilities ## Tools
generate_text — Generate text using Gemini LLM Generate text using Gemini LLM **Inputs:** ``` - `query` (string, required) — Required. Natural language prompt to send to Gemini. Any text is accepted; no length limit is enforced by this tool. - `model` (string, optional, default: gemini-2.5-flash) — Optional. Gemini model name, e.g., 'gemini-2.5-flash' or 'gemini-2.5-pro'. Defaults to 'gemini-2.5-flash'. ``` **Output `data` schema:** ```typescript { prompt: string; response: string; } ```
## API Parameters Reference
Response Envelope Every tool returns the same top-level envelope. Only `data` varies per tool. ```json // Success { "success": true, "statusCode": 200, "retriable": false, "retry_after_seconds": null, "error": null, "data": { ... } } // Error { "success": false, "statusCode": 400, "retriable": false, "retry_after_seconds": null, "error": { "code": "{ERROR_CODE}", "message": "{description}", "details": {} }, "data": null } ``` - `retriable` — `true` when it is safe to retry (rate limit, network error, 503). `false` for validation and auth errors. - `retry_after_seconds` — seconds to wait before retrying; present only when `retriable` is `true` and the upstream specifies a delay. - `error.code` — machine-readable string: `VALIDATION_ERROR`, `AUTH_ERROR`, `UPSTREAM_ERROR`, `SERVER_ERROR`.
## Getting Your Gemini API Key
Steps 1. Go to [Google AI Studio API Keys](https://aistudio.google.com/app/apikey) 2. Sign in with your Google account and navigate to the API keys section 3. Click **Create API Key** 4. Copy the generated key — you will only see it once
## Troubleshooting
Missing or Invalid Headers - **Cause:** API key not provided in request headers or incorrect format - **Solution:** 1. Verify `Authorization: Bearer YOUR_API_KEY` and `X-Mewcp-Credential-Id: CREDENTIAL-ID` headers are present 2. Check API key is active in your MewCP account
Insufficient Credits - **Cause:** API calls have exceeded your request limits - **Solution:** 1. Check credit usage in your Curious Layer dashboard 2. Upgrade to a paid plan or add credits for higher limits 3. Contact support for credit adjustments
Credential Not Connected - **Cause:** No Gemini credential linked to your account - **Solution:** 1. Go to **Credentials** in your MewCP dashboard 2. Add your API key (static) 3. Retry the request with the correct `X-Mewcp-Credential-Id` header
Malformed Request Payload - **Cause:** JSON payload is invalid or missing required fields - **Solution:** 1. Validate JSON syntax before sending 2. Ensure all required tool parameters are included 3. Check parameter types match expected values
Server Not Found - **Cause:** Incorrect server name in the API endpoint - **Solution:** 1. Verify endpoint format: `mewcp-gemini/mcp/generate_text` 2. Use correct server name from documentation 3. Check available servers in your Curious Layer account
Gemini API Error - **Cause:** Upstream Gemini API returned an error - **Solution:** 1. Check Gemini service status at [Google Status Page](https://status.cloud.google.com) 2. Verify your credential has the required permissions 3. Review the error message for specific details
---
Resources - **[Gemini API Documentation](https://ai.google.dev/gemini-api/docs)** — Official API reference - **[Gemini API Reference](https://ai.google.dev/api)** — Complete endpoint reference - **[FastMCP Docs](https://gofastmcp.com/v2/getting-started/welcome)** — FastMCP specification - **[FastMCP Credentials](https://pypi.org/project/fastmcp-credentials/)** — FastMCP Credentials package for credential handling
--- ## Connection snippets ### Python (fastmcp) ```python import asyncio from fastmcp import Client from fastmcp.client.transports import StreamableHttpTransport SERVER_URL = "https://gateway.mewcp.com/gemini/mcp" MEWCP_KEY = "YOUR_MEWCP_KEY" CREDENTIAL_ID = "YOUR_CREDENTIAL_ID" transport = StreamableHttpTransport( url=SERVER_URL, headers={ "Authorization": f"Bearer {MEWCP_KEY}", "x-mewcp-credential-id": CREDENTIAL_ID, } ) async def main(): client = Client(transport) async with client: await client.ping() tools = await client.list_tools() resources = await client.list_resources() prompts = await client.list_prompts() # Change the tool name and arguments with actual tool and arguments available in server result = await client.call_tool("example_tool", {"param": "value"}) print(result) asyncio.run(main()) ``` ### TypeScript (MCP SDK) ```typescript import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; const SERVER_URL = "https://gateway.mewcp.com/gemini/mcp"; const MEWCP_KEY = "YOUR_MEWCP_KEY"; const CREDENTIAL_ID = "YOUR_CREDENTIAL_ID"; const transport = new StreamableHTTPClientTransport(new URL(SERVER_URL), { requestInit: { headers: { Authorization: `Bearer ${MEWCP_KEY}`, "x-mewcp-credential-id": CREDENTIAL_ID, }, }, }); const client = new Client({ name: "mewcp-client", version: "1.0.0", }); await client.connect(transport); const tools = await client.listTools(); console.log("Available tools:", tools.tools.map(t => t.name)); // Change the tool name and arguments to a tool available on your server const result = await client.callTool({ name: "example_tool", arguments: { param: "value" }, }); console.log("Tool result:", result); ``` ### VS Code (settings.json) ```json { "servers": { "mewcp-gemini": { "type": "http", "url": "https://gateway.mewcp.com/gemini/mcp", "headers": { "Authorization": "Bearer YOUR_MEWCP_KEY", "x-mewcp-credential-id": "YOUR_CREDENTIAL_ID" } } } } ``` ### Cursor (mcp.json) ```json { "mcpServers": { "gemini": { "url": "https://gateway.mewcp.com/gemini/mcp", "headers": { "Authorization": "Bearer YOUR_MEWCP_KEY", "x-mewcp-credential-id": "YOUR_CREDENTIAL_ID" } } } } ``` ### Claude Desktop (claude_desktop_config.json) ```json "mcpServers": { "gemini": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "https://gateway.mewcp.com/gemini/mcp", "--transport", "http-only", "--header", "Authorization: Bearer YOUR_MEWCP_KEY", "--header", "x-mewcp-credential-id: YOUR_CREDENTIAL_ID" ] } } ```