返回 MCP 目录
public公开dns本地运行

agentai-mcp-server

一个集成Agent.ai API的MCP服务器,提供网页文本提取、网页截图和YouTube字幕获取功能,支持动态加载函数和缓存机制。

article

README

🚀 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 <token>', '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 <token>', '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 <token>', '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 文件路径]。

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端