跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Google Gemini API,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
让你的 AI 用你自己的 API 密钥使用 Google Gemini:向 Gemini 模型提问,通过链接分析图片和 PDF,统计 token,创建嵌入向量,并用 Nano Banana 生成或编辑图片,图片直接显示在聊天中。
试试这样问
Google Gemini API 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Google Gemini API、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Gemini API + ChatGPT
让你的 AI 用你自己的 API 密钥使用 Google Gemini:向 Gemini 模型提问,通过链接分析图片和 PDF,统计 token,创建嵌入向量,并用 Nano Banana 生成或编辑图片,图片直接显示在聊天中。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
GEMINI_API_KEY
步骤 1 — 获取凭证
- 打开 Google AI Studio(
https://aistudio.google.com/apikey),用你的 Google 账号登录。 - 点击 Create API key,选择或新建一个 Google Cloud 项目,然后复制密钥。密钥通常以
AIza开头。 - 把它粘贴到
GEMINI_API_KEY,然后安装连接器。密钥只会发送给 Google。 - 如需生成图片或更高的限额,请在 AI Studio 中为该密钥所在的项目启用结算(Get API key,然后 Set up billing)。图片模型没有免费层级。
- 运行
gemini_list_models,查看你的密钥可以使用哪些模型。这不产生费用。
计费:Gemini API 使用你自己的密钥。除模型列表、Files API 和 token 统计外,每次调用都会计入该密钥所在项目的费用,或占用其免费层级额度。在免费层级中,文本模型和嵌入模型在每分钟和每天的限额内免费使用,Google 可能会用免费层级的提示词来改进其产品。除非你要求更强的模型,AI 会使用便宜、快速的默认模型(文本用 gemini-3.1-flash-lite,嵌入用 gemini-embedding-001),发送长提示词之前可以用 gemini_count_tokens 免费估算。
图片需要付费:gemini_generate_image 和 gemini_edit_image 用 Nano Banana 生成或修改图片,并直接显示在聊天中。默认图片模型每张约 0.034 美元,最强的模型每张约 0.13 美元,因此 AI 每次生成图片前都会先与你确认。超过 4 MB 的图片不会返回,请要求更小的尺寸。
通过链接提供文件:gemini_analyze_file_url 可以回答关于图片、PDF、文本或 CSV 文件以及短视频的问题,文件通过公开的 HTTPS 链接提供,最大 15 MB。Gemini 会自己打开链接,所以链接必须无需登录即可访问。Files API 工具可以列出和读取项目中保存的文件,这些文件 48 小时后过期。gemini_delete_file 在安装时处于关闭状态。
常见错误:提示密钥无效的 400:密钥错误或已被删除,请在 AI Studio 中新建一个。403:密钥被限制为只能调用其他 API(在 Google Cloud console 的 Credentials、API restrictions 中允许 Generative Language API),项目中未启用该 API,或文件链接不是公开的。404:该模型代码不存在,请用 gemini_list_models 核对。429:达到了免费层级或付费层级的限额,或在未启用结算的情况下调用了图片模型;请等待,或启用结算。提示免费层级不可用的 400 表示你所在地区不提供免费层级:请启用结算。被 Google 安全过滤器拦截的请求会以错误返回,且不会重试。
此连接器不上传文件,不进行音频或视频流式传输(Live API),不生成语音或视频(Veo),也不支持上下文缓存、批处理任务、调优模型或文件搜索存储。
步骤 2 — 安装 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
步骤 3 — 在 ChatGPT 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
ChatGPT 在网页版的 Plugins 页面把 MCP 服务器添加为插件,仅付费套餐可用,不再需要开发者模式。在 Business 工作区中只有管理员和所有者可以添加;在 Enterprise 和 Edu 中,管理员可以授予 Create plugins with MCPs 权限。
- 前往 chatgpt.com/plugins,点击 +,然后选择 Add custom MCP server。
- 填写名称,例如 Name:
Gemini API。 - 在 Connection 下的 Server URL 中填入
https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,Authentication 保持为 OAuth。 - 选择 I understand and want to continue,然后点击 Create as a plugin。ChatGPT 提示时,登录 AnythingMCP 并允许访问。
- 在个人插件中安装这个新插件,然后在对话中输入 @ 并选择它。
可用工具
| Tool | What it does |
|---|---|
gemini_list_models | List 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_model | Read one Gemini model: display name, description, version, input and output token limits, default temperature, top-p and top-k, whether it… |
gemini_generate_text | Ask a Gemini model one question and get its text answer (generateContent) |
gemini_generate_content | Full generateContent call for conversations and mixed input. contents is the list of turns: [{"role": "user", "parts": [{"text": "..."}]}… |
gemini_analyze_file_url | Ask 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_tokens | Count 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_text | Turn one text into an embedding vector (embedContent) for semantic search, clustering or similarity |
gemini_batch_embed_texts | Embed up to 20 texts in one call (batchEmbedContents); the vectors come back in the order given |
gemini_generate_image | Create 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_image | Change 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_files | List the files stored in the project's Gemini Files API (uploaded for prompts, or generated), newest first, with name, display name, MIME… |
gemini_get_file | Read one file of the Gemini Files API: display name, MIME type, size, state (PROCESSING, ACTIVE or FAILED), uri to use in… |
gemini_delete_file | Delete a file from the Gemini Files API before it expires |
示例提示
- “读取我在下面贴出的链接中的供应商价目表 PDF,列出每个产品及其价格。”
- “让 Gemini 把这段商品描述改写得更简短、更亲切,用于我们的网店。”
- “这份方案在 Gemini 中有多少 token,用默认模型总结它要花多少钱?”
- “用 Nano Banana 生成一张我们的蓝色陶瓷马克杯放在木桌上的产品照片,但先告诉我费用,等我确认后再生成。”
FAQ
ChatGPT 免费套餐能用自定义 MCP 服务器吗? OpenAI 只为付费套餐提供自定义 MCP 服务器的说明,Free 套餐不在其列。
下一步
这份指南对你有帮助吗?