Agentai Mcp Server

Agentai Mcp Server

🚀 Agent.ai MCP 服务器

Agent.ai MCP 服务器集成于 Agent.ai API,借助动态函数加载系统,提供网页文本提取、网页截图以及 YouTube 字幕获取等实用功能,为用户带来高效便捷的服务体验。

✨ 主要特性

  • 动态函数加载:自动从 Agent.ai API 获取可用函数,确保功能的实时更新与扩展。
  • 网页文本提取:可灵活抓取或爬取网页,精准获取所需文本内容。
  • 网页截图:能快速捕获网页页面的视觉截图,满足多样化的需求。
  • YouTube 字幕:轻松从 YouTube 视频中提取字幕,方便信息整理与利用。
  • 缓存机制:高效缓存函数定义,有效减少 API 调用,提升系统性能。

📦 安装指南

获取 API 令牌

使用此 MCP 服务器,您需要一个 Agent.ai API 令牌。请联系 Agent.ai 获取您的专属令牌。

与 Claude Desktop 结合使用

Docker 配置

claude_desktop_config.json 中添加以下内容:

{
"mcpServers": {
"agentai": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"API_TOKEN",
"mcp/agentai"
],
"env": {
"API_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}

NPX 配置

{
"mcpServers": {
"agentai": {
"command": "npx",
"args": [
"-y",
"@agentai/mcp-server"
],
"env": {
"API_TOKEN": "YOUR_API_TOKEN_HERE"
}
}
}
}

📚 详细文档

工具说明

该服务器可动态加载来自 Agent.ai API 的工具,当前可用工具如下:

工具名称 功能 输入参数
grab_web_text 提取网页文本内容 url (字符串,必需):要提取的网页 URL;mode (字符串,可选):"抓取" 单个页面,"爬取" 最多 100 页
grab_web_screenshot 捕获网页页面的视觉截图 url (字符串,必需):要捕获的网页 URL;ttl_for_screenshot (整数,可选):截图缓存过期时间(秒)
get_youtube_transcript 获取 YouTube 视频的字幕 url (字符串,必需):YouTube 视频 URL

更多工具请访问 API 参考文档

💻 使用示例

基础用法

提取网页文本

const options = {
method: 'POST',
headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'},
body: '{"url":"https://agent.ai","mode":"抓取"}'
};

fetch('https://api-lr.agent.ai/api/v1/grab_web_text', options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

捕获网页截图

const options = {
method: 'POST',
headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'},
body: '{"url":"https://agent.ai","mode":"爬取"}'
};

fetch('https://api-lr.agent.ai/api/v1/grab_web_screenshot', options)
.then(response => response.blob())
.then(blob => {
const img = document.createElement('img');
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
})
.catch(error => console.error('Error:', error));

获取 YouTube 字幕

const options = {
method: 'POST',
headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'},
body: '{"url":"https://www.youtube.com/watch?v=VIDEO_ID"}'
};

fetch('https://api-lr.agent.ai/api/v1/get_youtube_transcript', options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

🔧 技术细节

构建命令

docker build -t mcp/agentai .

📄 许可证

本软件根据 [许可证名称] 许可,具体内容请参阅 [LICENSE 文件路径]。

  • 0 关注
  • 0 收藏,36 浏览
  • system 提出于 2025-09-21 14:00

相似服务问题

相关AI产品