npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

gemini-apicore-mcp

v1.0.1

Published

Gemini MCP Server for APICore - 基于 APICore 渠道的 Gemini 2.5 Flash Image 图片处理服务

Readme

Gemini APICore MCP - 基于 APICore 渠道的图像生成服务

项目概述

Gemini APICore MCP 是一个基于 APICore 渠道的 Gemini 2.5 Flash Image MCP(Model Context Protocol)服务器,专门用于图像生成和处理。它可以无缝集成到 Claude Desktop、Cursor 等支持 MCP 协议的 AI 助手中,通过 APICore 平台提供强大的图像生成能力。

核心特性

🎯 主要功能

  • 文生图:根据文字描述生成高质量图片
  • 图生图:基于参考图片和描述生成新图片
  • 自动保存:生成的图片自动下载并保存到本地
  • APICore 渠道:通过 APICore 平台访问 Gemini 2.5 Flash Image

🚀 技术优势

  • TypeScript 编写:类型安全,开发体验更好
  • 标准 MCP 协议:完全符合 MCP 规范,兼容性强
  • 错误处理:完善的错误处理和重试机制
  • 调试支持:内置调试模式,方便问题排查

快速开始

1. 安装依赖

cd /Users/chengfeng/Desktop/图形mcp/apicore
npm install

2. 配置环境变量

# 复制环境变量模板
cp .env.example .env

# 编辑 .env 文件,填入你的 APICore API 密钥
# APICORE_API_KEY=sk-your-apicore-key

3. 构建项目

npm run build

4. 配置 Claude Desktop

编辑配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\\Claude\\claude_desktop_config.json

添加以下配置:

{
  "mcpServers": {
    "gemini-apicore": {
      "command": "node",
      "args": ["/Users/chengfeng/Desktop/图形mcp/apicore/dist/index.js"],
      "env": {
        "APICORE_API_KEY": "sk-your-apicore-key",
        "OUTPUT_DIR": "~/Desktop/generated_images"
      }
    }
  }
}

5. 重启 Claude Desktop

使用示例

在配置好的 Claude Desktop 中,你可以:

文生图

请生成一张图片:一只可爱的橘猫在阳光下打瞌睡

图生图

请基于这张图片生成新图片:
参考图片: https://example.com/cat.jpg
描述: 将这只猫改为在雪地里玩耍的场景

API 说明

可用工具

1. generate_image_from_text

根据文字描述生成图片

参数:

  • prompt (string, 必需): 图片生成描述
  • output_dir (string, 可选): 保存目录
  • save_images (boolean, 可选): 是否保存图片,默认 true

2. generate_image_from_image

基于参考图片生成新图片

参数:

  • image_url (string, 必需): 参考图片 URL
  • prompt (string, 必需): 生成描述
  • output_dir (string, 可选): 保存目录
  • save_images (boolean, 可选): 是否保存图片,默认 true

3. test_apicore_connection

测试 APICore API 连接状态

环境变量

| 变量名 | 说明 | 默认值 | |--------|------|--------| | APICORE_API_KEY | APICore API 密钥(必需) | - | | OUTPUT_DIR | 图片保存目录 | ./outputs | | APICORE_BASE_URL | APICore 基础 URL | https://ismaque.org | | DEBUG | 调试模式 | false |

开发指南

本地开发

# 安装依赖
npm install

# 开发模式运行
npm run dev

# 构建项目
npm run build

# 生产模式运行
npm start

调试模式

# 启用调试输出
DEBUG=true npm run dev

# 或者通过命令行参数
npm run dev -- --debug

测试连接

# 测试 APICore API 连接
npm run test

APICore 配置

  1. 注册账号: 访问 APICore 注册账号
  2. 获取 API 密钥: 在控制台获取你的 API 密钥
  3. 确认服务: 确保开通了 Gemini 2.5 Flash Image 服务

故障排除

常见问题

Q: 提示 "APICore API密钥无效" A: 请检查 APICORE_API_KEY 环境变量是否正确设置。

Q: 图片生成失败 A:

  1. 检查网络连接
  2. 确认 API 配额是否充足
  3. 启用调试模式查看详细错误信息

Q: Claude Desktop 无法识别服务 A:

  1. 确认配置文件路径正确
  2. 检查 JSON 格式是否有效
  3. 重启 Claude Desktop 应用

日志查看

服务器会输出详细的运行日志,包括:

  • API 请求和响应
  • 图片保存路径
  • 错误信息和堆栈

技术架构

src/
├── index.ts          # 主入口点
├── server.ts         # MCP 服务器实现
├── apicore-client.ts # APICore API 客户端
└── types.ts          # TypeScript 类型定义

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

相关链接


注意:使用本项目需要有效的 APICore API 密钥。