Skip to content

ADK 的 Markifact MCP 工具

Supported in ADKPythonTypeScript

Markifact MCP 服务器 将你的 ADK 智能体连接到 Markifact,一个 AI 营销自动化平台,提供跨 20 多个平台(包括 Google Ads、Meta Ads、GA4、TikTok Ads 和 Shopify)的 300 多种操作。此集成为你的智能体提供了使用自然语言管理广告活动、分析性能和自动化营销工作流的能力,每次写入操作都带有审批提示。

使用场景

  • 支出优化:发现 Google Ads、Meta、TikTok 和 LinkedIn 上浪费的预算,并提供具体的暂停和重新分配建议。
  • 统一报告:一条提示即可生成跨所有连接渠道和 GA4 的综合支出、ROAS、CAC 和转化差异数据。
  • 从摘要到在线广告活动:从一行摘要到起草好的搜索、效果最大化、Meta Advantage+、TikTok 或 LinkedIn 广告活动,准备供人工审批。
  • 潜在客户交接:捕获 Meta 和 LinkedIn 的潜在客户表单,在 HubSpot 或 Klaviyo 中丰富数据,并触发 WhatsApp 或 Slack 跟进。

前提条件

  • 一个 Markifact 账户(提供免费层级)
  • 从 Markifact 仪表板连接至少一个平台(Google Ads、Meta、GA4、Shopify 等)
  • 参见 Markifact 文档 了解连接设置

与智能体一起使用

from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
from mcp import StdioServerParameters

root_agent = Agent(
    model="gemini-flash-latest",
    name="marketing_agent",
    instruction=(
        "You are a performance marketing agent that helps users manage "
        "ad campaigns, run analytics, sync e-commerce data, and "
        "execute marketing workflows across Google Ads, Meta Ads, GA4, "
        "TikTok Ads, LinkedIn Ads, Shopify, HubSpot, and more. "
        "Always confirm with the user before any write operation."
    ),
    tools=[
        McpToolset(
            connection_params=StdioConnectionParams(
                server_params=StdioServerParameters(
                    command="npx",
                    args=[
                        "-y",
                        "mcp-remote",
                        "https://api.markifact.com/mcp",
                    ],
                ),
                timeout=30,
            ),
        )
    ],
)

Note

首次运行此智能体时,浏览器窗口会自动打开以通过 OAuth 请求访问权限。在浏览器中批准请求,以授予智能体访问你已连接账户的权限。

from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset, StreamableHTTPConnectionParams

MARKIFACT_ACCESS_TOKEN = "YOUR_MARKIFACT_ACCESS_TOKEN"

root_agent = Agent(
    model="gemini-flash-latest",
    name="marketing_agent",
    instruction=(
        "You are a performance marketing agent that helps users manage "
        "ad campaigns, run analytics, sync e-commerce data, and "
        "execute marketing workflows across Google Ads, Meta Ads, GA4, "
        "TikTok Ads, LinkedIn Ads, Shopify, HubSpot, and more. "
        "Always confirm with the user before any write operation."
    ),
    tools=[
        McpToolset(
            connection_params=StreamableHTTPConnectionParams(
                url="https://api.markifact.com/mcp",
                headers={
                    "Authorization": f"Bearer {MARKIFACT_ACCESS_TOKEN}",
                },
            ),
        )
    ],
)

Note

如果你已有 Markifact 访问令牌,可以直接使用 Streamable HTTP 连接,无需 OAuth 浏览器流程。

import { LlmAgent, MCPToolset } from "@google/adk";

const rootAgent = new LlmAgent({
    model: "gemini-flash-latest",
    name: "marketing_agent",
    instruction:
        "You are a performance marketing agent that helps users manage " +
        "ad campaigns, run analytics, sync e-commerce data, and " +
        "execute marketing workflows across Google Ads, Meta Ads, GA4, " +
        "TikTok Ads, LinkedIn Ads, Shopify, HubSpot, and more. " +
        "Always confirm with the user before any write operation.",
    tools: [
        new MCPToolset({
            type: "StdioConnectionParams",
            serverParams: {
                command: "npx",
                args: [
                    "-y",
                    "mcp-remote",
                    "https://api.markifact.com/mcp",
                ],
            },
        }),
    ],
});

export { rootAgent };

Note

首次运行此智能体时,浏览器窗口会自动打开以通过 OAuth 请求访问权限。在浏览器中批准请求,以授予智能体访问你已连接账户的权限。

import { LlmAgent, MCPToolset } from "@google/adk";

const MARKIFACT_ACCESS_TOKEN = "YOUR_MARKIFACT_ACCESS_TOKEN";

const rootAgent = new LlmAgent({
    model: "gemini-flash-latest",
    name: "marketing_agent",
    instruction:
        "You are a performance marketing agent that helps users manage " +
        "ad campaigns, run analytics, sync e-commerce data, and " +
        "execute marketing workflows across Google Ads, Meta Ads, GA4, " +
        "TikTok Ads, LinkedIn Ads, Shopify, HubSpot, and more. " +
        "Always confirm with the user before any write operation.",
    tools: [
        new MCPToolset({
            type: "StreamableHTTPConnectionParams",
            url: "https://api.markifact.com/mcp",
            transportOptions: {
                requestInit: {
                    headers: {
                        Authorization: `Bearer ${MARKIFACT_ACCESS_TOKEN}`,
                    },
                },
            },
        }),
    ],
});

export { rootAgent };

Note

如果你已有 Markifact 访问令牌,可以直接使用 Streamable HTTP 连接,无需 OAuth 浏览器流程。

可用工具

工具 描述
find_operations 按平台和意图范围对操作注册表进行语义搜索
get_operation_inputs 返回特定操作输入的 JSON Schema
run_operation 执行读取操作
run_write_operation 执行带审批协议的写入操作
list_connections 列出工作空间中的 OAuth 连接
get_file_url 获取报告和导出的 URL
read_file 读取文件内容
upload_media 上传媒体资源

能力

能力 描述
发现 对 300 多种操作进行按读/写分类的语义搜索
审批门控写入 围绕 run_write_operation 的四步协议,用于任何支出或破坏性更改
广告活动管理 在所有付费渠道中创建、编辑、暂停和恢复广告活动、广告组和广告
报告与归因 跨平台支出、ROAS 和转化混合分析,以及 GA4 路径和渠道分析
受众 每个平台的自定义受众、类似受众、排除和行为定向
创意 资源上传、变体轮换、疲劳检测和审批门控发布
商务与 CRM Shopify、HubSpot 和 Klaviyo 与付费媒体的闭环报告同步
消息 用于审批、警报和潜在客户交接的 WhatsApp 和 Slack 通知
文件 I/O 通过 get_file_urlread_fileupload_media 进行报告、导出和上传

支持的平台

类别 平台
付费媒体 Google Ads、Meta Ads、TikTok Ads、LinkedIn Ads、Microsoft Ads、Reddit Ads、Pinterest Ads、Snapchat Ads、Amazon Ads、DV360
分析 GA4、BigQuery、Google Search Console、Google Merchant Center
电商、CRM、消息 Shopify、HubSpot、Klaviyo、WhatsApp、Slack
自然与社交 Facebook、Instagram、LinkedIn、Google Business Profile

其他资源