AI代理与MCP服务器

Mastra AI代理与Apify MCP服务器结合,通过Model Context Protocol(MCP)连接AI驱动的工作流与Apify的Actor库,实现数据提取、网络爬取和任务自动化。

  • by apify
  • TypeScript
  • 本地部署
  • 16 星标
  • 更新于
在 GitHub 查看 apify/actor-mastra-mcp-agent

使用说明

配备Apify MCP服务器的Mastra AI代理

这 配备Apify MCP服务器的Mastra AI代理 是一种通用的人工智能代理,旨在展示 大师.ai 与框架配对时 指定MCP服务器该Actor利用模型上下文协议(MCP)将AI驱动的工作流与Apify的广泛Actor库连接起来,实现无缝数据提取、网络抓取和任务自动化。

该Actor使用TypeScript和Apify SDK构建,为希望创建利用实时web数据和工具的自定义AI代理的开发人员提供了一个灵活的起点。

🛠️ 用例

TikTok趋势分析

从特定帐户中删除TikTok帖子,并总结主要趋势。

示例输入:

{
  "prompt": "Scrape the latest 10 posts from @techcrunch on TikTok and summarize key tech topics.",
  "agentName": "TikTok Tech Analyzer",
  "agentInstructions": "You are a tech analyst scraping TikTok posts to identify trends.",
  "modelName": "gpt-4o-mini",
  "actors": ["clockworks/free-tiktok-scraper"]
}

输出示例:

{
  "prompt": "Scrape the latest 10 posts from @techcrunch on TikTok and summarize key tech topics.",
  "response": "Here are the latest 10 posts from TechCrunch on TikTok, along with key tech topics summarized..."
}

网络研究综合

在网上搜索一个主题,并提炼出最热门的发现。

示例输入:

{
  "prompt": "Search the web for recent advances in quantum computing and explain the top 3 breakthroughs.",
  "agentName": "Quantum Research Bot",
  "agentInstructions": "You are a research assistant that scours the web for technical info.",
  "modelName": "gpt-4o",
  "actors": ["apify/rag-web-browser"]
}

输出示例:

{
  "prompt": "Search the web for recent advances in quantum computing and explain the top 3 breakthroughs.",
  "response": "Here are the top three recent advances in quantum computing as of 2025..."
}

您的用例💡

调整输入并创建自己的AI代理来处理您的用例! 🚀

🎯 特性

  • 🤖 人工智能辅助:使用 大师.ai 使用OpenAI模型处理提示的框架(例如。, gpt-4o, gpt-4o-mini).
  • 🌐 优化MCP集成:连接到Apify MCP服务器以访问以下工具 clockworks/free-tiktok-scraper 以及更多。
  • 💰 按活动付费定价:对Actor运行和任务完成进行灵活的、基于使用量的计费。

🔄 运作原理

  1. 📥 输入

    • 提示(例如,“分析来自@openai的帖子并总结AI趋势”)
    • 代理名称(例如,“有用的助理代理”)-代理的名称
    • 代理说明(例如,“你是一个乐于助人的助理……”)-描述代理的角色、代理是谁以及它做什么
    • 型号选择(gpt-4o 或 gpt-4o-mini)
    • 演员(例如。, ["clockworks/free-tiktok-scraper"])-MCP服务器为代理提供的Apify Actor列表
  2. 🤖 Mastra加工

    • 使用mastra.ai框架初始化代理。
    • 通过服务器发送事件(SSE)连接到Apify MCP服务器。
    • 动态获取可用工具(例如TikTok抓取器、网络浏览器)。
    • 根据需要使用MCP工具执行提示。
  3. 📤 输出

    • 以文本形式返回代理的响应。
    • 将结果存储在具有提示和响应的Apify数据集中。

💰 定价

此演员使用 按活动付费 (PPE)模型,用于成本效益高、基于使用的定价。

活动 价格(美元)
演员起薪 0.10美元
任务完成 0.40美元

输入示例

{
  "prompt": "Analyze the posts of @openai and summarize current trends in AI.",
  "agentName": "Social Media Analyst",
  "agentInstructions": "You are a social media analyst who specializes in analyzing posts from various social media platforms.",
  "modelName": "gpt-4o-mini",
  "actors": ["clockworks/free-tiktok-scraper"]
}

输出示例

数据集条目:

{
  "prompt": "Analyze the posts of @openai and summarize current trends in AI.",
  "response": "Here’s a summary of the recent posts from OpenAI's account, highlighting current trends in AI..."
}

🔧 技术亮点

  • Mastra.ai框架:为AI代理提供动力。
  • 指定MCP服务器:通过模型上下文协议将Apify Actor作为工具公开。
  • Apify SDK:确保与Apify平台无缝集成。
  • TypeScript:提供类型安全和现代JavaScript功能。

🤖 引擎盖下 大师.ai

此Actor使用mastra.ai框架创建一个与Apify生态系统交互的通用ai代理:

🛠️ 工具

可扩展到任何Apify Actor Apify商店 通过MCP服务器配置。

⚙️ 用法

在Apify上运行

  1. 克隆存储库。
  2. 将Actor推送到Apify平台:
    apify push
    
  3. 设置演员 OPENAI_API_KEY 环境变量.
  4. 通过Apify控制台或API使用您的输入运行Actor。

地方发展

  1. 安装依赖项:
    npm install
    
  2. 在本地运行:
    OPENAI_API_KEY=<your-openai-api-key> apify run -i '{"prompt": "Show me latest post from @openai TikTok profile", "actors": ["clockworks/free-tiktok-scraper"]}'
    

📖 了解更多

🚀 开始

准备好构建自己的AI代理了吗?在Apify上部署此Actor,调整输入,探索mastra.ai和MCP的可能性! 🤖✨

🌐 开源

此Actor是开源的,托管在 GitHub。要添加功能吗?打开问题或提交拉取请求!