GeminiMcpServer 是一个支持 Model Context Protocol (MCP) 的服务器,可以与 LM Studio(或其他支持的客户端)以及 Google Gemini API 实现无缝连接,用于图像生成和多模态任务处理。

git clone git@github.com:bowwowxx/GeminiMcpServer.git
cd GeminiMcpServer
npm install
建立 Google API密钥:
设置环境变量:
在项目的根目录创建.env文件并添加:
GEMINI_API_KEY="your_api_key_here"
启动服务器:
npm start
进行测试:
npx tsx testapi.js
此测试将使用Gemini 2实验图像生成API创建图像。
{
"tool": "generateImage",
"params": {
"prompt": "一只站在阳光田野中的逼真3D渲染猪",
"outputFormat": "png",
"aspectRatio": "16:9"
}
}
{
"mcpServers": {
"GeminiMcpServer": {
"command": "npm",
"args": [
"run",
"start"
],
"cwd": "/Users/bowwow/github/GeminiMcpServer"
}
}
}
