GEMINI LABJP
3.8LIVE — Two audio-to-audio models reached GA for the Live API: gemini-3.8-live as the low-latency default, and -extended-thinking for background reasoning mid-conversation09/30 — Thirteen days until gemini-omni-flash-preview shuts down. The replacement is gemini-omni-1.1-flash, so count your call sites before you swapMCP — A timeout written as ten minutes on the extension side is reportedly cutting out at one. Anyone handing long work to an MCP server runs straight into itNEW — When an AI function in Sheets refuses to generate, suspect where the file lives before you blame the 24-hour capGEM — When a Gem built for your team will not share, walk the admin settings and the Drive sharing settings in a set order10/16 — Twenty-nine days until Gemini 2.5 Pro, Flash and Flash-Lite shut down together. The path forward is the 3.5 Flash line3.8LIVE — Two audio-to-audio models reached GA for the Live API: gemini-3.8-live as the low-latency default, and -extended-thinking for background reasoning mid-conversation09/30 — Thirteen days until gemini-omni-flash-preview shuts down. The replacement is gemini-omni-1.1-flash, so count your call sites before you swapMCP — A timeout written as ten minutes on the extension side is reportedly cutting out at one. Anyone handing long work to an MCP server runs straight into itNEW — When an AI function in Sheets refuses to generate, suspect where the file lives before you blame the 24-hour capGEM — When a Gem built for your team will not share, walk the admin settings and the Drive sharing settings in a set order10/16 — Twenty-nine days until Gemini 2.5 Pro, Flash and Flash-Lite shut down together. The path forward is the 3.5 Flash line
Articles/Dev Tools
Dev Tools/2026-03-31Advanced

Building Custom MCP Servers for Gemini API — Extending AI Agents with TypeScript

Learn how to build custom Model Context Protocol (MCP) servers in TypeScript and integrate them with Gemini API. Covers architecture, authentication, error handling, and production deployment patterns.

gemini115mcp3typescript16ai-agent2tool-serverfunction-calling20model-context-protocol

Premium Article

Back When Every Tool Needed Its Own Adapter

Model Context Protocol (MCP) is a standard protocol for connecting LLM applications with external tools and data sources. Originally proposed by Anthropic, it has gained rapid adoption across the AI ecosystem — including Google's Gemini CLI and numerous developer tools.

Before MCP, giving an AI agent the ability to interact with external tools required building custom adapters for each integration. MCP solves this by establishing a universal contract: if a tool provider publishes an MCP server, any MCP-compatible AI client can use it immediately.

What follows builds a custom MCP server from scratch in TypeScript and wires it to the Gemini API. It goes past the hello-world stage into authentication, rate limiting, error handling, and the deployment patterns real applications end up needing.

MCP Architecture Overview

MCP is built on JSON-RPC 2.0 and consists of three primary components:

  • MCP Host: The AI application itself (Gemini CLI, Claude Code, etc.)
  • MCP Client: The component within the host that communicates with servers
  • MCP Server: The service that provides tools, resources, and prompts

Communication happens over stdio (standard I/O) or SSE (Server-Sent Events) / Streamable HTTP. Stdio works well for local execution, while SSE and HTTP are suited for remote servers.

The Three MCP Primitives

Tools      — Functions the LLM can invoke (API calls, DB queries, etc.)
Resources  — Data sources the LLM can read (files, DB records, etc.)
Prompts    — Reusable prompt templates

Tools are the most frequently used primitive for AI agents. They're conceptually similar to Gemini API's Function Calling — MCP tool definitions map directly to Gemini's functionDeclarations. If you're new to Function Calling, we recommend reading our Gemini API Function Calling Practical Guide first.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Fully understand MCP server internals and the communication protocol architecture
Build production-quality custom MCP servers from scratch using TypeScript
Master agent design patterns that integrate Gemini API Function Calling with MCP tools
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

Dev Tools2026-04-30
Ship a Production Gemini Agent in 30 Minutes with Mastra and TypeScript
Mastra keeps the lightness of Vercel AI SDK while adding the agent primitives you actually need in production. This guide walks through building, debugging, and deploying a Gemini-powered Mastra agent end-to-end, including the Cloudflare Workers gotchas that bit me first.
Dev Tools2026-09-03
When Gemini Let Me Upload Several Code Files at Once, I Stopped Selecting by Folder
Once you can hand Gemini a slice of a repository, the hard part moves from pasting to choosing. I measured the dependency graph of my own Next.js repo, found that folder-based selection caught zero callers, and wrote down the selection routine I use now.
Dev Tools2026-04-29
Testing Gemini API with Vitest — Mock Patterns and Function Calling Verification for TypeScript Projects
Vitest patterns for TypeScript code that calls Gemini — SDK mocks, Function Calling and streaming tests, dropping to MSW, and a one-call nightly smoke test.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links