This repository includes a simple usage example
of ChatGoogleEx.
This example targets @h1deya/langchain-google-ex v0.1.0 or later and uses
LangChain's newer @langchain/google package.
The example follows the current LangChain.js agent and MCP client pattern:
MultiServerMCPClient loads tools from an MCP server, createAgent() binds those
tools to ChatGoogleEx, and messages are passed as plain role/content objects.
The sample passes process.env.GOOGLE_API_KEY explicitly to ChatGoogleEx so the
request uses the Gemini Developer API and does not accidentally fall back to
Vertex AI / Google Cloud authentication.
The following shows the usage:
npm install
cp .env.example .env
code .env # set GOOGLE_API_KEY
npm startThe sample uses mcp-server-fetch==2025.4.7 through uvx, so make sure uv is
available in your environment before running it. It also pins the Python MCP SDK
to mcp<2 because older mcp-server-fetch releases fail to start with the MCP
SDK 2.x exception class rename.
To compare with the original model, switch the model creation in
src/index.ts from ChatGoogleEx back to ChatGoogle.