AVA MCP Server

Integrations

  • Provides access to Gmail API, allowing the AI assistant (AVA) to read and manage emails through the Gmail service.

  • Integrates with Google services through OAuth authentication, enabling secure access to Google-based features for the virtual assistant.

  • Utilizes Google Cloud Platform for API access and authentication, supporting the virtual assistant's functionality through Google Cloud services.

模型上下文协议(MCP)

所有版权归于: https://github.com/ShawhinT/YouTube-Blog/

这是 AI 代理系列的第四个示例。在这里,我构建了一个客户端 MCP 服务器,以便任何 AI 应用都可以访问人工智能虚拟助手 (AVA) 的工具集。

链接

如何运行此示例

  1. 克隆此 repo
  2. 如果还没有安装uv,请先安装
# Mac/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  1. 在开发模式下测试服务器
uv run mcp dev mcp-server-example.py
  1. 将服务器配置添加到 AI 应用程序(例如 Claude Desktop 或 Cursor)。
{ "mcpServers": { "AVA": { "command": "/Users/shawhin/.local/bin/uv", # replace with global path to your uv installation "args": [ "--directory", "/Users/shawhin/Documents/_code/_stv/sandbox/ava-mcp/", # replace with global path to repo "run", "mcp-server-example.py" ] } } }

自定义 AVA 的行为

更新个人信息和偏好

  1. 在项目目录中找到prompts/ava.md文件
  2. 使用以下方式自定义文件:
    • 沟通偏好
    • 处理任务的具体说明
    • AVA 的任何其他相关指南

环境设置(.env)

  1. 在项目根目录中创建一个.env文件,其中包含以下变量:
USER_EMAIL=your_email_address # Google OAuth Credentials GOOGLE_CREDENTIALS_PATH=.config/ava-agent/credentials.json GOOGLE_TOKEN_PATH=.config/ava-agent/token.json

所需的环境变量:

  • USER_EMAIL :您要用于此应用程序的 Gmail 地址
  • GOOGLE_CREDENTIALS_PATH :您的 Google OAuth 凭据文件的路径
  • GOOGLE_TOKEN_PATH :存储 Google OAuth 令牌的路径

Google OAuth 设置

1.创建项目目录结构

首先,创建所需的目录结构:

mkdir -p .config/ava-agent

2. 设置 Google Cloud 项目

  1. 前往Google Cloud Console
  2. 创建新项目或选择现有项目
  3. 启用 Gmail API:
    • 在导航菜单中,转到“API 和服务”>“库”
    • 搜索“Gmail API”
    • 点击“启用”

3.创建OAuth凭证

  1. 在 Google Cloud Console 中:
    • 前往“API 和服务”>“凭证”
    • 点击“创建凭证”>“OAuth 客户端 ID”
    • 选择“桌面应用程序”作为应用程序类型
    • 给它起一个名字(例如,“AVA Gmail 客户端”)
    • 点击“创建”
  2. 下载凭证:
    • 创建完成后,点击“下载JSON”
    • 将下载的文件保存为.config/ava-agent/中的credentials.json
    • 该文件应包含您的客户端 ID 和客户端密钥

4. 配置 OAuth 同意屏幕

  1. 在 Google Cloud Console 中:
    • 前往“API 和服务”>“OAuth 同意屏幕”
    • 选择“外部”用户类型
    • 填写所需信息:
      • 应用程序名称
      • 用户支持电子邮件
      • 开发者联系信息
    • 添加 Gmail API 范围: https://www.googleapis.com/auth/gmail.modify
    • 将您的电子邮件添加为测试用户
    • 完成配置

登录 Google

在服务器访问你的 Gmail 账户之前,你需要先授权。你可以运行uv run oauth.py来执行此操作,它会执行以下操作。

  1. 检查token.json是否存在
  2. 如果未找到,它将启动 Google OAuth 身份验证流程
  3. 指导您完成浏览器中的身份验证过程:
    • 系统会要求您登录 Google 帐户
    • 授予请求的权限
    • 应用程序将自动保存令牌
  4. 自动生成并存储令牌

安全说明

文件保护

  • 切勿将.env文件或token.json提交到版本控制
  • 确保您的 Google 凭据安全
  • 将以下内容添加到您的.gitignore中:
    .env .config/ava-agent/token.json .config/ava-agent/credentials.json

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

自定义 MCP 服务器,为 AI 应用程序提供对人工智能虚拟助手 (AVA) 工具集的访问权限,从而实现 Gmail 集成并通过自然语言进行任务管理。

  1. 如何运行此示例
    1. 自定义 AVA 的行为
      1. 更新个人信息和偏好
    2. 环境设置(.env)
      1. 所需的环境变量:
    3. Google OAuth 设置
      1. 1.创建项目目录结构
      2. 2. 设置 Google Cloud 项目
      3. 3.创建OAuth凭证
      4. 4. 配置 OAuth 同意屏幕
    4. 登录 Google
      1. 安全说明
        1. 文件保护

      Related MCP Servers

      • -
        security
        F
        license
        -
        quality
        Enables users to manage Gmail accounts using AI agent-assisted operations via an MCP protocol, supporting email search, reading, deletion, and sending with a voice-powered interface.
        Last updated -
        2
        5
        TypeScript
      • A
        security
        A
        license
        A
        quality
        An MCP server that lets AI assistants interact with your Lunchmoney data, enabling natural language queries about transactions, budgets, and spending patterns.
        Last updated -
        4
        3
        8
        TypeScript
        MIT License
      • -
        security
        F
        license
        -
        quality
        An MCP server that enables AI assistants to access and interact with Google Classroom data, allowing users to view courses, course details, and assignments through natural language commands.
        Last updated -
        508
        1
        JavaScript
      • -
        security
        F
        license
        -
        quality
        An MCP server that connects AI assistants to SearchAgora, enabling users to search for, discover, and purchase products across the web through natural language conversations.
        Last updated -
        Python
        • Apple

      View all related MCP servers

      ID: 3o1svf6vxd