Skip to main content
Glama

Vertex AI MCP Server

Vertex AI MCP 服务器

该项目实现了一个模型上下文协议 (MCP) 服务器,它提供了一套全面的工具用于与 Google Cloud 的 Vertex AI Gemini 模型进行交互,专注于编码辅助和一般查询解答。

特征

  • 通过众多 MCP 工具提供对 Vertex AI Gemini 模型的访问。
  • 支持网页搜索基础( answer_query_websearch )和直接知识问答( answer_query_direct )。
  • 可通过环境变量配置模型 ID、温度、流行为、最大输出令牌和重试设置。
  • 默认使用流式 API,以获得更好的响应能力。
  • 包括针对瞬态 API 错误的基本重试逻辑。
  • 应用最少的安全过滤器( BLOCK_NONE )来减少潜在的阻塞(谨慎使用)。

提供的工具

查询与生成(以人工智能为重点)

  • answer_query_websearch :使用已配置的 Vertex AI 模型(通过 Google 搜索结果增强)回答自然语言查询。
  • answer_query_direct :仅使用配置的 Vertex AI 模型的内部知识来回答自然语言查询。
  • explain_topic_with_docs :通过综合主要来自网络搜索找到的官方文档的信息,为有关特定软件主题的查询提供详细的解释。
  • get_doc_snippets :通过搜索官方文档,提供精确、权威的代码片段或简洁的技术查询答案。
  • generate_project_guidelines :根据指定的技术列表(可选版本)生成结构化的项目指南文档(Markdown),使用网络搜索寻找最佳实践。

文件系统操作

  • read_file_content :读取单个文件的完整内容。
  • read_multiple_files_content :同时读取多个文件的内容。
  • write_file_content :创建一个新文件或用新内容完全覆盖现有文件。
  • edit_file_content :对文本文件进行基于行的编辑,返回差异预览或应用更改。
  • create_directory :创建一个新目录(包括嵌套目录)。
  • list_directory_contents :直接列出指定路径内的文件和目录(非递归)。
  • get_directory_tree :以 JSON 格式获取文件和目录的递归树状视图。
  • move_file_or_directory :移动或重命名文件和目录。
  • search_filesystem :递归搜索与名称模式匹配的文件/目录,并可选择排除。
  • get_filesystem_info :检索有关文件或目录的详细元数据(大小、日期、类型、权限)。

人工智能与文件系统操作相结合

  • save_generate_project_guidelines :根据技术栈生成项目指南,并将结果保存到指定的文件路径。
  • save_doc_snippet :从文档中查找代码片段并将结果保存到指定的文件路径。
  • save_topic_explanation :根据文档生成主题的详细解释,并将结果保存到指定的文件路径。
  • save_answer_query_direct :仅使用内部知识回答查询并将答案保存到指定的文件路径。
  • save_answer_query_websearch :使用网络搜索结果回答查询并将答案保存到指定的文件路径。

(注意:每个工具的输入/输出模式都在src/tools/中的各自文件中定义,并通过 MCP 服务器公开。)

先决条件

  • Node.js(v18+)
  • 包子( npm install -g bun
  • 已启用计费功能的 Google Cloud 项目。
  • GCP 项目中启用了 Vertex AI API。
  • 在您的环境中配置 Google Cloud 身份验证(建议通过gcloud auth application-default login使用应用程序默认凭据,或使用服务帐户密钥)。

设置和安装

  1. **克隆/放置项目:**确保项目文件位于您想要的位置。
  2. 安装依赖项:
    bun install
  3. 配置环境:
    • 在项目根目录中创建一个.env文件(复制.env.example )。
    • 按照.env.example中所述设置必需和可选的环境变量。
      • AI_PROVIDER设置为"vertex""gemini"
      • 如果AI_PROVIDER="vertex" ,则需要GOOGLE_CLOUD_PROJECT
      • 如果AI_PROVIDER="gemini" ,则需要GEMINI_API_KEY
  4. 构建服务器:
    bun run build
    这会将 TypeScript 代码编译为build/index.js

使用方法(独立/NPX)

一旦发布到 npm,您就可以使用npx直接运行此服务器:

# Ensure required environment variables are set (e.g., GOOGLE_CLOUD_PROJECT) bunx vertex-ai-mcp-server

或者,全局安装:

bun install -g vertex-ai-mcp-server # Then run: vertex-ai-mcp-server

**注意:**运行独立版本需要在执行命令之前在 shell 环境中设置必要的环境变量(如GOOGLE_CLOUD_PROJECTGOOGLE_CLOUD_LOCATION 、如果不使用 ADC 则需要设置身份验证凭据)。

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Vertex AI Server:

bunx -y @smithery/cli install @shariqriazz/vertex-ai-mcp-server --client claude

与克莱恩一起奔跑

  1. **配置 MCP 设置:**在您的 Cline MCP 设置文件(例如.roo/mcp.json )中添加/更新配置。您可以通过两种主要方式配置命令:选项 A:使用节点(直接路径 - 推荐用于开发)此方法使用node直接运行已编译的脚本。在开发过程中,当你将代码克隆到本地时,此方法非常有用。
    { "mcpServers": { "vertex-ai-mcp-server": { "command": "node", "args": [ "/full/path/to/your/vertex-ai-mcp-server/build/index.js" // Use absolute path or ensure it's relative to where Cline runs node ], "env": { // --- General AI Configuration --- "AI_PROVIDER": "vertex", // "vertex" or "gemini" // --- Required (Conditional) --- "GOOGLE_CLOUD_PROJECT": "YOUR_GCP_PROJECT_ID", // Required if AI_PROVIDER="vertex" // "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY", // Required if AI_PROVIDER="gemini" // --- Optional Model Selection --- "VERTEX_MODEL_ID": "gemini-2.5-pro-exp-03-25", // If AI_PROVIDER="vertex" (Example override) "GEMINI_MODEL_ID": "gemini-2.5-pro-exp-03-25", // If AI_PROVIDER="gemini" // --- Optional AI Parameters --- "GOOGLE_CLOUD_LOCATION": "us-central1", // Specific to Vertex AI "AI_TEMPERATURE": "0.0", "AI_USE_STREAMING": "true", "AI_MAX_OUTPUT_TOKENS": "65536", // Default from .env.example "AI_MAX_RETRIES": "3", "AI_RETRY_DELAY_MS": "1000", // --- Optional Vertex Authentication --- // "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json" // If using Service Account Key for Vertex }, "disabled": false, "alwaysAllow": [ // Add tool names here if you don't want confirmation prompts // e.g., "answer_query_websearch" ], "timeout": 3600 // Optional: Timeout in seconds } // Add other servers here... } }
    • **重要提示:**确保args路径正确指向build/index.js文件。使用绝对路径可能更可靠。

    选项 B:使用 NPX(需要将包发布到 npm)

    此方法使用npx自动从 npm 仓库下载并运行服务器包。如果您不想克隆仓库,这种方法非常方便。

    { "mcpServers": { "vertex-ai-mcp-server": { "command": "bunx", // Use bunx "args": [ "-y", // Auto-confirm installation "vertex-ai-mcp-server" // The npm package name ], "env": { // --- General AI Configuration --- "AI_PROVIDER": "vertex", // "vertex" or "gemini" // --- Required (Conditional) --- "GOOGLE_CLOUD_PROJECT": "YOUR_GCP_PROJECT_ID", // Required if AI_PROVIDER="vertex" // "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY", // Required if AI_PROVIDER="gemini" // --- Optional Model Selection --- "VERTEX_MODEL_ID": "gemini-2.5-pro-exp-03-25", // If AI_PROVIDER="vertex" (Example override) "GEMINI_MODEL_ID": "gemini-2.5-pro-exp-03-25", // If AI_PROVIDER="gemini" // --- Optional AI Parameters --- "GOOGLE_CLOUD_LOCATION": "us-central1", // Specific to Vertex AI "AI_TEMPERATURE": "0.0", "AI_USE_STREAMING": "true", "AI_MAX_OUTPUT_TOKENS": "65536", // Default from .env.example "AI_MAX_RETRIES": "3", "AI_RETRY_DELAY_MS": "1000", // --- Optional Vertex Authentication --- // "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json" // If using Service Account Key for Vertex }, "disabled": false, "alwaysAllow": [ // Add tool names here if you don't want confirmation prompts // e.g., "answer_query_websearch" ], "timeout": 3600 // Optional: Timeout in seconds } // Add other servers here... } }
    • 确保env块中的环境变量设置正确,要么与.env匹配,要么在此处明确定义。请从实际的 JSON 文件中删除注释。
  2. 重新启动/重新加载 Cline: Cline 应该检测配置更改并启动服务器。
  3. **使用工具:**您现在可以通过 Cline 使用大量工具列表。

发展

  • 观看模式: bun run watch
  • 绒毛: bun run lint
  • 格式: bun run format

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

模型上下文协议 (MCP) 服务器的实现,提供访问 Google Cloud 的 Vertex AI Gemini 模型的工具,支持网络搜索基础和直接知识解答等功能,以提供编码帮助和一般查询。

  1. 特征
    1. 提供的工具
      1. 查询与生成(以人工智能为重点)
      2. 文件系统操作
      3. 人工智能与文件系统操作相结合
    2. 先决条件
      1. 设置和安装
        1. 使用方法(独立/NPX)
          1. 通过 Smithery 安装
        2. 与克莱恩一起奔跑
          1. 发展
            1. 执照

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                Model Context Protocol (MCP) server implementation that enables Claude Desktop to interact with Google's Gemini AI models.
                Last updated -
                53
                TypeScript
                MIT License
                • Apple
                • Linux
              • A
                security
                A
                license
                A
                quality
                🔍 A Model Context Protocol (MCP) server providing unified access to multiple search engines (Tavily, Brave, Kagi), AI tools (Perplexity, FastGPT), and content processing services (Jina AI, Kagi). Combines search, AI responses, content processing, and enhancement features through a single interface.
                Last updated -
                15
                227
                102
                TypeScript
                MIT License
                • Linux
              • -
                security
                -
                license
                -
                quality
                An MCP server implementation that allows using Google's Gemini AI models (specifically Gemini 1.5 Pro) through Claude or other MCP clients via the Model Context Protocol.
                Last updated -
                1
                JavaScript
              • A
                security
                A
                license
                A
                quality
                A dedicated server that wraps Google's Gemini AI models in a Model Context Protocol (MCP) interface, allowing other LLMs and MCP-compatible systems to access Gemini's capabilities like content generation, function calling, chat, and file handling through standardized tools.
                Last updated -
                16
                20
                TypeScript
                MIT License
                • Linux
                • Apple

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/shariqriazz/vertex-ai-mcp-server'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server