Gyazo MCP服务器
与Gyazo API集成的模型上下文协议(MCP)服务器,使人工智能助手能够上传、列出、检索和管理Gyazo上的图像。
特性
工具
- upload_image -上传图片到Gyazo
- Base64编码图像数据 - 可选的标题、描述、集合ID和引用者URL
- list_images -列出您上传的图片
- 分页支持(页,每页)
- 获取图像 -获取特定图像的详细信息
- 返回图像元数据、OCR数据(如果可用)
- 删除图像 -从Gyazo删除图像
- get_embed -获取Gyazo图像URL的嵌入信息
资源
- gyazo://images -将您的完整图像列表作为资源访问
- gyazo://images/{image_id} -将特定图像详细信息作为资源访问
安装
来自npm(推荐)
npm install -g @mercy34mercy/gyazo-mcp来源
git clone https://github.com/mercy34mercy/gyazo-remote-mcp.git
cd gyazo-remote-mcp
npm install
npm run build配置
获取您的Gyazo访问令牌
- 访问 Gyazo OAuth应用程序
- 创建新应用程序或使用现有应用程序
- 复制您的访问令牌
用法
选项1:本地MCP(stdio)
此模式在本地运行MCP服务器,并通过stdio进行通信。
使用克劳德桌面
添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%/Claude/claude_desktop_config.json
使用npx(推荐)
{
"mcpServers": {
"gyazo": {
"command": "npx",
"args": ["-y", "@mercy34mercy/gyazo-mcp"],
"env": {
"GYAZO_ACCESS_TOKEN": "your_token_here"
}
}
}
}使用全局安装
{
"mcpServers": {
"gyazo": {
"command": "gyazo-mcp",
"env": {
"GYAZO_ACCESS_TOKEN": "your_token_here"
}
}
}
}使用源代码
{
"mcpServers": {
"gyazo": {
"command": "node",
"args": ["/absolute/path/to/gyazo-remote-mcp/build/index.js"],
"env": {
"GYAZO_ACCESS_TOKEN": "your_token_here"
}
}
}
}独立
GYAZO_ACCESS_TOKEN=your_token npm start选项2:远程MCP(HTTP/SSE)
此模式将MCP服务器作为HTTP服务运行,适用于部署到Cloud Run、Railway、Render等。
地方发展
启动HTTP服务器:
npm run start:http服务器将于启动 http://localhost:3000 (或PORT环境变量(如果已设置)。
然后配置Claude Desktop以连接到本地服务器:
{
"mcpServers": {
"gyazo": {
"type": "http",
"url": "http://localhost:3000",
"headers": {
"Authorization": "Bearer your_gyazo_token_here"
}
}
}
}部署到Google Cloud Run
- 建立谷歌云项目
gcloud config set project YOUR_PROJECT_ID- 构建并推送Docker镜像
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/gyazo-mcp- 部署到云端运行
gcloud run deploy gyazo-mcp \
--image gcr.io/YOUR_PROJECT_ID/gyazo-mcp \
--platform managed \
--region us-central1 \
--allow-unauthenticated- 为远程MCP配置Claude桌面
部署后,您将获得一个URL,如下所示 https://gyazo-mcp-xxxxx.run.app.添加到您的Claude Desktop配置中:
选项A:使用授权标头(推荐)
{
"mcpServers": {
"gyazo": {
"type": "http",
"url": "https://gyazo-mcp-xxxxx.run.app",
"headers": {
"Authorization": "Bearer your_gyazo_token_here"
}
}
}
}选项B:使用自定义标题
{
"mcpServers": {
"gyazo": {
"type": "http",
"url": "https://gyazo-mcp-xxxxx.run.app",
"headers": {
"X-Gyazo-Token": "your_gyazo_token_here"
}
}
}
}选项C:使用查询参数
{
"mcpServers": {
"gyazo": {
"type": "http",
"url": "https://gyazo-mcp-xxxxx.run.app?token=your_gyazo_token_here"
}
}
}部署到其他平台
铁路
# Railway will automatically detect the Dockerfile
# No environment variables needed - token is passed from client渲染
# Create a new Web Service from the Render dashboard
# No environment variables needed - token is passed from client环境变量
对于远程MCP部署:
PORT(可选):HTTP服务器端口(默认值:3000,Cloud Run使用8080)GYAZO_ACCESS_TOKEN: 不需要的 -访问令牌在请求中从MCP客户端(Claude Desktop)发送
对于本地开发(HTTP模式):
GYAZO_ACCESS_TOKEN(可选):可以设置用于测试,但如果提供,将被客户端请求覆盖
交互示例
上传图片
User: "Upload this screenshot to Gyazo"
Assistant: [Uses upload_image tool with base64 image data]列出最近的图像
User: "Show me my recent Gyazo uploads"
Assistant: [Uses list_images tool]获取图像详细信息
User: "Get details for image ID abc123"
Assistant: [Uses get_image tool with image_id: "abc123"]删除图像
User: "Delete the image with ID abc123"
Assistant: [Uses delete_image tool]API 参考
upload_image
输入:
{
imagedata: string; // Base64 encoded image (required)
title?: string; // Image title
desc?: string; // Image description
collection_id?: string; // Collection ID
referer_url?: string; // Referer URL
}输出:
{
"image_id": "xxxxx",
"permalink_url": "https://gyazo.com/xxxxx",
"url": "https://i.gyazo.com/xxxxx.png",
"thumb_url": "https://thumb.gyazo.com/thumb/xxxxx.png",
"type": "png"
}list_images
输入:
{
page?: number; // Page number (default: 1)
per_page?: number; // Items per page (default: 20, max: 100)
}输出:
[
{
"image_id": "xxxxx",
"permalink_url": "https://gyazo.com/xxxxx",
"url": "https://i.gyazo.com/xxxxx.png",
"created_at": "2025-01-01T00:00:00+0000",
"metadata": { ... }
}
]获取图像
输入:
{
image_id: string; // Image ID (required)
}输出:
{
"image_id": "xxxxx",
"permalink_url": "https://gyazo.com/xxxxx",
"url": "https://i.gyazo.com/xxxxx.png",
"thumb_url": "https://thumb.gyazo.com/thumb/xxxxx.png",
"type": "png",
"created_at": "2025-01-01T00:00:00+0000",
"metadata": { ... },
"ocr": { ... }
}删除图像
输入:
{
image_id: string; // Image ID to delete (required)
}输出:
{
"success": true,
"image_id": "xxxxx",
"type": "png",
"message": "Image deleted successfully"
}get_embed
输入:
{
url: string; // Gyazo image URL (required)
}输出:
{
"type": "photo",
"version": "1.0",
"provider_name": "Gyazo",
"provider_url": "https://gyazo.com",
...
}发展
构建
npm run build观看模式
npm run watch项目结构
gyazo-mcp/
├── src/
│ ├── index.ts # Entry point for stdio mode
│ ├── http-server.ts # Entry point for HTTP/SSE mode
│ ├── server.ts # MCP server implementation
│ └── gyazo-client.ts # Gyazo API client
├── build/ # Compiled JavaScript
├── Dockerfile # Docker image for Cloud Run deployment
├── .dockerignore
├── package.json
├── tsconfig.json
├── .env.example
└── README.md安全
- 永远不要承诺你的
.env归档或公开您的访问令牌 - 将您的访问令牌安全地存储在环境变量中
- 使用
.gitignore排除敏感文件
错误处理
所有错误都以一致的格式返回:
{
"error": "ErrorName",
"message": "Error description",
"statusCode": 400
}常见错误类型:
- 认证错误 -访问令牌无效或丢失
- 未找到错误 -未找到图像或资源
- 验证错误 -无效参数
- 速率限制错误 -超过API费率限制
许可证
麻省理工学院
相关链接
贡献
欢迎投稿!请随时提交拉取请求。
