Back to MCP directory
publicPublicdnsLocal runtime

Freepik

一个用于访问Freepik素材资源和AI图像生成功能的MCP服务实现

article

README

🚀 Freepik MCP 服务器

Freepik MCP 服务器可与 Freepik 的 API 进行交互,让你能够访问库存照片,还具备 Mystic AI 图像生成功能。

🚀 快速开始

本服务器能与 Freepik 的 API 交互,让你可搜索、获取、下载 Freepik 资源,还能使用 Mystic AI 生成图像。

✨ 主要特性

  • 搜索 Freepik 资源(照片、向量、PSD)
  • 获取资源详细信息
  • 下载资源
  • 使用 Mystic AI 生成图像
  • 检查图像生成状态

📦 安装指南

安装环境要求

安装步骤

# 创建一个新的 MCP 服务器目录
mkdir mcp-servers
cd mcp-servers

# 克隆仓库
git clone https://github.com/MCERQUA/freepik-mcp.git
cd freepik-mcp

# 安装依赖项
npm install

# 构建服务器
npm run build

📚 详细文档

配置

  1. 首先,按照 API_SETUP.md 中的说明获取你的 Freepik API 密钥。
  2. 将服务器添加到你的 MCP 设置文件中:
{
  "mcpServers": {
    "freepik": {
      "command": "node",
      "args": ["path/to/freepik-mcp/build/index.js"],
      "env": {
        "FREEPIK_API_KEY": "your-api-key-here"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

可用工具

search_resources

使用各种过滤器搜索 Freepik 资源:

{
  term?: string;          // 搜索词
  limit?: number;         // 每页结果数
  order?: 'relevance' | 'recent';
  filters?: {
    orientation?: {
      landscape?: boolean;
      portrait?: boolean;
      square?: boolean;
      panoramic?: boolean;
    };
    content_type?: {
      photo?: boolean;
      psd?: boolean;
      vector?: boolean;
    };
    license?: {
      freemium?: boolean;
      premium?: boolean;
    };
  };
}

get_resource

获取特定资源的详细信息:

{
  id: number;  // 要获取详细信息的资源 ID
}

download_resource

获取特定资源的下载 URL:

{
  id: number;  // 要下载的资源 ID
}

generate_image

使用 Freepik Mystic AI 生成图像:

{
  prompt: string;         // 图像描述的文字
  resolution?: '2k' | '4k';
  aspect_ratio?: 'square_1_1' | 'classic_4_3' | 'traditional_3_4' | 
                 'widescreen_16_9' | 'social_story_9_16';
  realism?: boolean;      // 启用现实风格
  engine?: 'automatic' | 'magnific_illusio' | 'magnific_sharpy' | 'magnific_sparkle';
  creative_detailing?: number;  // 0 - 100
}

check_status

检查 Mystic 图像生成任务的状态:

{
  task_id: string;  // 要检查的生成任务 ID
}

开发

# 安装依赖项
npm install

# 构建服务器
npm run build

# 在开发模式下运行
npm run dev

错误处理

该服务器实现了全面的错误处理:

  • 记录 API 错误的详细信息
  • 使用 Zod 模式的输入验证
  • 具有上下文的正确错误响应
  • 关注限流意识

贡献

  1. 叉仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交你的更改 (git commit -m "your-message")
  4. 推送到分支机构 (git push origin feature/amazing-feature)
  5. 打开拉取请求

更多文档

有关如何使用此项目的更多信息,请参阅 项目文档

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client