MCP ExplorerExplorer

Vertex Ai Mcp Samples

@wadaveon a year ago
8 MIT
FreeCommunity
AI Systems
Vertex AI MCP Samples demonstrate tool calls using MCP Server.

Overview

What is Vertex Ai Mcp Samples

vertex_ai_mcp_samples is a sample project that demonstrates the use of the MCP (Model Control Plane) for managing tool calls in AI applications, specifically comparing MCP tool calls to traditional vanilla tool calls.

Use cases

Use cases for vertex_ai_mcp_samples include building AI-driven applications that require dynamic tool management, automating workflows that involve multiple tools, and enhancing user interaction through efficient query handling.

How to use

To use vertex_ai_mcp_samples, users need to create a client instance of MCP_Client, which interacts with the MCP Server to retrieve available tools and execute tool calls based on user prompts.

Key features

Key features of vertex_ai_mcp_samples include the ability to manage tool calls efficiently, integration with Gemini for query processing, and a structured approach to handling responses from the MCP Server.

Where to use

vertex_ai_mcp_samples can be used in fields such as artificial intelligence, machine learning, and software development, where managing tool interactions is crucial for application performance.

Content

MCP Samples

Overview

The Model Context Protocol (MCP) is an open standard that streamlines the integration of AI assistants with external data sources, tools, and systems. MCP standardizes how applications provide context to LLMs. MCP establishes the essential standardized interface allowing AI models to connect directly with diverse external systems and services.

Developers have the option to use third-party MCP servers or create custom ones when building applications.

The below shows the comparison between MCP workflow vs native tool call.

MCP Sequence Diagram

%%{
  init: {
    'theme': 'default',
    'themeVariables': {
        'fontSize':'18px',
        'fontFamily':'arial',
    }
  }
}%%

sequenceDiagram
    participant User
    participant App
    participant Gemini
    participant MCP_Client
    participant MCP Server

    App->>MCP_Client: Create Client Instance
    MCP_Client->>MCP Server: get_available_tools()
    MCP Server-->>MCP_Client: Return Tool List
    MCP_Client-->>App: Return Tool List
    App->>Gemini:Tool Definition

    loop Agentic Loop
        User->>App: Enter Prompt
        App->>Gemini: Send Query


        Gemini-->>App: Return Tool and Args
        App->>MCP_Client: Execute Tool Call
        MCP_Client->>MCP Server: Call Tool
        MCP Server-->>MCP_Client: Tool Response
        MCP_Client-->>App: Tool Result
        App->>Gemini: Send Tool Result
        Gemini-->>App: Final Response


        App-->>User: Display Response
    end

Traditional tool calling

%%{
  init: {
    'theme': 'default',
    'themeVariables': {
        'fontSize':'18px',
        'fontFamily':'arial',
    }
  }
}%%

sequenceDiagram
    participant User
    participant App
    participant Gemini
    participant Functions





    loop Agentic Loop
        User->>App: Enter Prompt
        App->>Gemini: Send Query


        Gemini-->>App: Return Tool and Args

        App->>Functions: Call Tool
        Functions-->>App: Return Tool Result
        App->>Gemini: Send Query and Tool Result
        Gemini-->>App: Final Response

        App-->>User: Display Response
    end

Folder

├── create_mcp_server_by_gemini.ipynb
├── intro_to_MCP_with_vertexai.ipynb
├── README.md
├── server
├── adk_mcp_app

Notebooks

  1. intro_to_MCP_with_vertexai.ipynb shows two ways to use MCP with Vertex AI
  • Build a custom MCP server, and use it with Gemini on Vertex AI
  • Use pre-built MCP server with Vertex AI
  1. create_mcp_server_by_gemini.ipynb shows how to use Gemini 2.5 Pro to create a custom MCP server
  2. adk_mcp_app contains a FastAPI based app which uses ADK agent with MCP client.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers