与Agent.ai API集成的MCP服务器实现,通过动态函数加载系统提供网页文本提取、网页截图和YouTube字幕提取功能。
该服务器从Agent.ai API动态加载工具。当前可用的工具有:
grab_web_text
url (字符串,必需):要提取的网页URLmode (字符串,可选): "scrape"用于单个页面,"crawl"用于最多100个页面grab_web_screenshot
url (字符串,必需):要捕获的网页URLttl_for_screenshot (整数,可选):截图缓存过期时间(秒)get_youtube_transcript
url (字符串,必需):YouTube视频的URL以及数十种其他工具。要查看所有可用工具,请访问 https://docs.agent.ai/api-reference。
要使用此MCP服务器,您需要一个Agent.ai API令牌。请联系Agent.ai以获取您的令牌。
在您的claude_desktop_config.json中添加以下内容:
{
"mcpServers": {
"agentai": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"API_TOKEN",
"mcp/agentai"
],
"env": {
"API_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}
{
"mcpServers": {
"agentai": {
"command": "npx",
"args": [
"-y",
"@agentai/mcp-server"
],
"env": {
"API_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"url":"https://agent.ai","mode":"scrape"}'
};
fetch('https://api-lr.agent.ai/v1/action/grab_web_text', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"url":"https://agent.ai","ttl_for_screenshot":86400}'
};
fetch('https://api-lr.agent.ai/v1/action/grab_web_screenshot', options)
.then(response => response.json())
. then(response => console.log(response))
.catch(err => console.error(err));
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: '{"url":"https://youtube.com/watch?v=example"}'
};
fetch('https://api-lr.agent.ai/v1/action/get_youtube_transcript', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Docker构建:
docker build -t mcp/agentai:latest .
此MCP服务器根据MIT许可证发布。这意味着您可以自由地使用、修改和分发软件,但需遵守MIT许可证中的条款和条件。更多详情,请参见项目存储库中的LICENSE文件。