DataForSEO MCP服务器
用于DataForSEO API的基于stdio的模型上下文协议(MCP)服务器。
注册徐的数据
https://dataforseo.com/?aff=200885
安装
您可以直接使用npx运行:
npx @skobyn/mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'或全局安装:
npm install -g @skobyn/mcp-dataforseo
mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'用法
向stdin发送JSON请求并从stdout接收JSON响应:
echo '{"type":"dataforseo_serp","keyword":"artificial intelligence"}' | npx @skobyn/mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'支持的请求类型
SERP API
{
"type": "dataforseo_serp",
"keyword": "artificial intelligence",
"location_code": 2840,
"language_code": "en",
"device": "desktop",
"os": "windows"
}关键词数据API
{
"type": "dataforseo_keywords_data",
"keywords": ["seo", "search engine optimization"],
"location_code": 2840,
"language_code": "en"
}反向链接API
{
"type": "dataforseo_backlinks",
"target": "example.com",
"limit": 100
}第页API
{
"type": "dataforseo_onpage",
"url": "https://example.com",
"check_spell": true,
"enable_javascript": true
}域分析API
{
"type": "dataforseo_domain_analytics",
"domain": "example.com"
}应用程序数据API
{
"type": "dataforseo_app_data",
"app_id": "com.example.app"
}商户API
{
"type": "dataforseo_merchant",
"keyword": "bluetooth speakers",
"location_code": 2840,
"language_code": "en"
}业务数据API
{
"type": "dataforseo_business_data",
"keyword": "pizza delivery",
"location_code": 2840,
"language_code": "en"
}集成示例
以下是如何在Node.js代码中使用此MCP服务器:
const { spawn } = require('child_process');
// Start the MCP server
const server = spawn('npx', ['@skobyn/mcp-dataforseo', '--config', '{"username":"your_username","password":"your_password"}']);
// Define the request
const request = {
type: 'dataforseo_serp',
keyword: 'artificial intelligence'
};
// Send the request
server.stdin.write(JSON.stringify(request) + '\n');
server.stdin.end();
// Process the response
server.stdout.on('data', (data) => {
const response = JSON.parse(data.toString());
console.log(response);
});
// Handle errors
server.stderr.on('data', (data) => {
console.error(`Error: ${data}`);
});环境变量
您还可以使用环境变量而不是配置:
export DATAFORSEO_USERNAME=your_username
export DATAFORSEO_PASSWORD=your_password
npx @skobyn/mcp-dataforseo出版
要将此包发布到npm:
- 如果尚未登录,请登录npm:
npm login- 发布包:
npm publish --access public- 要稍后更新软件包,请执行以下操作:
npm version patch
npm publish