Freepik MCP 服务器是一个用于与 Freepik API 交互的实现方案。它提供了对库存照片和 Mystic AI 图像生成功能的访问,能帮助用户更便捷地使用 Freepik 的各类资源。
在使用 Freepik MCP 服务器之前,你需要完成一些先决条件的准备,然后进行安装和配置。
# 创建一个新的 MCP 服务器目录
mkdir mcp-servers
cd mcp-servers
# 克隆仓库
git clone https://github.com/MCERQUA/freepik-mcp.git
cd freepik-mcp
# 安装依赖项
npm install
# 构建服务器
npm run build
{
"mcpServers": {
"freepik": {
"command": "node",
"args": ["path/to/freepik-mcp/build/index.js"],
"env": {
"FREEPIK_API_KEY": "your-api-key-here"
},
"disabled": false,
"autoApprove": []
}
}
}
使用各种过滤器搜索 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;
};
};
}
获取特定资源的详细信息:
{
id: number; // 要获取详细信息的资源 ID
}
获取特定资源的下载链接:
{
id: number; // 要下载的资源 ID
}
使用 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
}
检查 Mystic 图像生成任务的状态:
{
task_id: string; // 要检查的生成任务 ID
}
该服务器实现了全面的错误处理:
# 安装依赖项
npm install
# 构建服务器
npm run build
# 在开发模式下运行
npm run dev
git checkout -b feature/amazing-feature)git commit -m '添加一些很棒的功能')git push origin feature/amazing-feature)MIT