Module 7 of 10 · CLI Comparison Track
70%
AI CLI Tools Compared  ·  M07

MCP Integrations

All three tools support the Model Context Protocol — but they configure, discover, and expose it in completely different ways. This module maps the config syntax, extension ecosystems, and the surprising portability story: a server built for Claude Code works in Gemini CLI with zero changes.

Claude Code
Gemini CLI
GitHub Copilot CLI
Section 1

What is MCP?

MCP explained

BEFORE: Every AI tool had its own proprietary plugin system. To give Claude access to your database, you wrote Anthropic-specific tool definitions. The same work, done again in a different format, for Gemini. Every integration was siloed.

PAIN: The result was the same integration work multiplied by the number of AI tools your team uses. Three AI tools meant three separate database connectors, three separate GitHub integrations, three separate Slack bots — all doing the same thing.

MAPPING: MCP (Model Context Protocol) is Anthropic's open standard that creates a universal interface. An MCP server exposes capabilities once, in a standard format. Any MCP client — Claude Code, Gemini CLI, Cursor — can connect to it without changes to the server. Write once, use everywhere.

MCP: one server, multiple clients — write the server once
Section 2

Claude Code MCP Configuration

Claude Code's MCP configuration lives in .claude/settings.json under the mcpServers key. It supports two transport types: stdio (local process) and HTTP/SSE (remote server).

.claude/settings.json — MCP server config
{
  "mcpServers": {
    "postgres-reader": {
      "command": "node",
      "args": ["./mcp-servers/postgres-reader/index.js"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-github"],
      "env": {
        "GITHUB_TOKEN": "${env:GITHUB_TOKEN}"
      }
    },
    "remote-stripe": {
      "type": "http",
      "url": "https://mcp.stripe.com/v1",
      "headers": {
        "Authorization": "Bearer ${env:STRIPE_KEY}"
      }
    }
  },
  "permissions": {
    "allow": ["mcp__postgres-reader__query", "mcp__github__list_prs"]
  }
}

Claude Code also supports hooks that can intercept MCP tool calls, enabling patterns like logging all database queries or blocking writes to production tables:

.claude/settings.json — hooks for MCP oversight
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__postgres-reader__*",
        "hooks": [
          {
            "type": "command",
            "command": "node ./scripts/log-db-query.js"
          }
        ]
      }
    ]
  }
}
Section 3

Gemini CLI MCP Configuration

Gemini CLI defines MCP servers in the ## MCP Servers section of your GEMINI.md file. It also has a native extension system with gemini extensions install for Google partner integrations, and uses OAuth 2.0 for remote servers that require user authentication.

GEMINI.md — MCP Servers section
## MCP Servers

### postgres-reader (local stdio)
command: node ./mcp-servers/postgres-reader/index.js
env:
  DATABASE_URL: $DATABASE_URL

### stripe (remote OAuth)
url: https://mcp.stripe.com/v1
auth: oauth2
scopes: [read:charges, read:customers]

## Extensions

Installed extensions (via gemini extensions install):
- @google/mcp-figma         (Figma design token access)
- @google/mcp-postman       (API testing via Postman collections)
- @google/mcp-workspace     (Google Docs, Sheets, Gmail)
bash — Gemini CLI extension management
# Install a Google partner extension
gemini extensions install @google/mcp-figma

# List installed extensions
gemini extensions list

# Remove an extension
gemini extensions remove @google/mcp-figma

# Install a custom MCP server as an extension
gemini extensions install --path ./mcp-servers/my-server/

# Extensions show up automatically as tools in your Gemini session
# No restart needed
Google partner extensions

Gemini CLI has first-party integrations with Google Workspace (Docs, Sheets, Gmail, Drive), Figma, Postman, and other enterprise tools. These are available via gemini extensions install @google/mcp-* and are maintained by Google. Claude Code can access many of the same services via MCP servers, but they are not bundled — you install them separately (e.g., npx -y @anthropic/mcp-server-github).

Section 4

GitHub Copilot MCP — IDE vs CLI

This is where the distinction between GitHub Copilot in VS Code and GitHub Copilot CLI is sharpest. GitHub Copilot MCP support exists — but only in the IDE, not in the CLI.

Surface MCP Support Configuration
VS Code Copilot Chat Yes — full MCP client github.copilot.chat.mcp.servers in VS Code settings.json
JetBrains Copilot Yes — MCP client IDE settings under Copilot MCP configuration
gh copilot suggest No — CLI has no MCP support N/A — CLI does not connect to MCP servers
gh copilot explain No — CLI has no MCP support N/A
VS Code settings.json — Copilot MCP (IDE only)
// ~/.vscode/settings.json (VS Code only — NOT available in gh copilot CLI)
{
  "github.copilot.chat.mcp.servers": {
    "postgres-reader": {
      "command": "node",
      "args": ["./mcp-servers/postgres-reader/index.js"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    }
  }
}

// In the terminal (gh copilot):
// gh copilot suggest "query the users table for inactive accounts"
// → MCP is NOT available — Copilot CLI has no database context
// → Suggested command: psql $DATABASE_URL -c "SELECT ..."
// → You run it manually
MCP in Copilot = VS Code, not terminal

If you need MCP-powered Copilot in your workflow, use VS Code's Copilot Chat panel — not gh copilot. The gh copilot CLI is a separate product that predates Copilot's MCP support and has not been updated to include it. For terminal-based MCP usage, Claude Code and Gemini CLI are the correct tools.

Section 5

Same MCP Server: Two Configs Side-by-Side

Here is the exact same Postgres reader MCP server configured for both Claude Code and Gemini CLI. Notice how similar the underlying concepts are — the differences are purely syntactic (JSON vs YAML-in-markdown).

Config similarity score — Claude Code vs Gemini CLI MCP configs
.claude/settings.json
{
  "mcpServers": {
    "postgres-reader": {
      "command": "node",
      "args": [
        "./mcp-servers/postgres-reader/index.js"
      ],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}",
        "MAX_ROWS": "1000"
      }
    }
  }
}
GEMINI.md — ## MCP Servers
## MCP Servers

### postgres-reader
command: node
args:
  - ./mcp-servers/postgres-reader/index.js
env:
  DATABASE_URL: $DATABASE_URL
  MAX_ROWS: "1000"

Both configs reference the same command, args, and env fields. The MCP server code itself is completely unchanged. This means your investment in writing and testing an MCP server is reusable across both tools — and across any other MCP-compatible client (Cursor, Continue, etc.).

Section 6

Extension Ecosystems Compared

Beyond MCP, each tool has its own extension mechanism. These differ significantly in what they enable beyond the basic MCP protocol.

Claude Code — Hooks
  • PreToolUse: intercept before any tool call
  • PostToolUse: react to tool results
  • Notification: custom terminal messages
  • Stop: trigger when Claude stops
  • Configured in .claude/settings.json
  • Run any shell command or script
Gemini CLI — Extensions
  • gemini extensions install @pkg
  • Google Workspace (Docs, Sheets, Gmail)
  • Figma, Postman, Stripe (partner)
  • Custom via local MCP server path
  • OAuth 2.0 for remote auth
  • npm-style package registry
Copilot CLI — Limited
  • No hook system in CLI
  • No extension manager in CLI
  • gh CLI extensions (non-AI) supported
  • IDE plugins available (VS Code)
  • GitHub Actions automation
  • MCP: VS Code only, not CLI
Claude Code hooks are uniquely powerful for CI/CD

Because hooks can run any shell script before or after a tool call, you can use them to: automatically run tests after every file write, post a Slack message when Claude completes a task, validate that database queries only target read replicas, or log all tool calls to an audit trail. This makes Claude Code hooks a lightweight automation framework — more powerful than Gemini CLI's extension system for custom enterprise workflows.

Section 7

MCP Portability: Write Once, Use Everywhere

The most practically important property of MCP: a custom server you write for Claude Code works with Gemini CLI, Cursor, Continue, and any other MCP client — with zero changes to the server code. Only the config file changes.

TypeScript — custom MCP server (works everywhere)
// WHAT: A custom MCP server that reads Postgres tables
// WHY:  Write once — works with Claude Code, Gemini CLI, Cursor, VS Code Copilot
// GOTCHA: Run 'npm install @modelcontextprotocol/sdk pg' first

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
import pg from 'pg';

// WHAT: Create the MCP server — tools are registered below
const server = new McpServer({ name: 'postgres-reader', version: '1.0.0' });
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });

// WHAT: Register a tool — AI clients call this tool by its name
// WHY:  Any MCP-compatible client (Claude Code, Gemini, Cursor) discovers
//       this tool automatically when connected to this server
server.tool(
  'query_table',
  'Read rows from a Postgres table (read-only)',
  {
    table_name: z.string().describe('Table name to query'),
    limit: z.number().max(1000).default(50).describe('Max rows to return'),
    where: z.string().optional().describe('Optional WHERE clause (no semicolons)'),
  },
  async ({ table_name, limit, where }) => {
    // GOTCHA: Never allow raw SQL injection — only allow table name + WHERE
    const allowedTables = process.env.ALLOWED_TABLES?.split(',') ?? [];
    if (!allowedTables.includes(table_name)) {
      return { content: [{ type: 'text', text: `Table '${table_name}' not in allowlist` }] };
    }

    const whereClause = where ? `WHERE ${where.replace(/;/g, '')}` : '';
    const result = await pool.query(
      `SELECT * FROM ${table_name} ${whereClause} LIMIT $1`,
      [limit],
    );

    return {
      content: [{
        type: 'text',
        text: JSON.stringify(result.rows, null, 2),
      }],
    };
  },
);

// WHAT: Start listening on stdio transport
// This is the same transport that both Claude Code and Gemini CLI use
const transport = new StdioServerTransport();
await server.connect(transport);
Field Claude Code (.claude/settings.json) Gemini CLI (GEMINI.md)
Server name "postgres-reader": { ... } (JSON key) ### postgres-reader (markdown heading)
Command "command": "node" command: node
Arguments "args": ["./index.js"] args:\n - ./index.js
Env vars "env": { "KEY": "${env:KEY}" } env:\n KEY: $KEY
Server code Unchanged ★ Unchanged ★
What Just Happened?

You now understand MCP's portability story and how each tool implements it:

  • Claude Code: JSON config in .claude/settings.json, hooks for pre/post tool interception, stdio and HTTP transports.
  • Gemini CLI: YAML-in-markdown in GEMINI.md, npm-style extension registry, OAuth 2.0 for remote servers, Google partner extensions.
  • Copilot CLI: No MCP in the CLI — MCP lives in VS Code. The terminal gh copilot does not connect to MCP servers.
  • Portability: the MCP server code is identical for both tools — only the 6-line config block changes.

Next: M08 covers CI/CD automation — how each tool integrates with GitHub Actions, deployment pipelines, and automated workflows.

Knowledge Check

Five questions on MCP configuration, portability, and tool ecosystems.

Question 1 of 5
What is the core value proposition of MCP (Model Context Protocol) for teams using multiple AI tools?
Correct. The fundamental promise of MCP is the "write once, use everywhere" property. Before MCP, every AI tool required a separate, proprietary integration — the same Postgres connector written in Anthropic's format, then again in Google's format, then again for Cursor. MCP standardizes the interface so the server code is identical regardless of which client connects. Your team writes the Postgres MCP server once, then configures it in .claude/settings.json for Claude Code and in GEMINI.md for Gemini CLI — the server process is the same.
Question 2 of 5
A developer wants to use gh copilot suggest to query their Postgres database via an MCP server they've already built. What will happen?
Correct. The gh copilot CLI does not have MCP support. MCP integration for GitHub Copilot exists only in the IDE (VS Code, JetBrains) via the github.copilot.chat.mcp.servers setting. The terminal gh copilot suggest/explain commands are a separate, simpler product. For terminal-based MCP usage, Claude Code (configure in .claude/settings.json) or Gemini CLI (configure in GEMINI.md) are the right tools. There is no --mcp flag.
Question 3 of 5
What is the difference between the stdio and http MCP transport types in Claude Code?
Correct. The transport type determines where the MCP server process runs. stdio (standard input/output) means Claude Code starts the server as a child process on your machine and communicates with it via the process's stdin/stdout — this is ideal for local tools like a custom database reader or file processor. http/SSE means the server is already running at a URL — this is used for cloud-hosted MCP servers like the official Stripe MCP server at mcp.stripe.com/v1. The key practical difference: stdio servers require the server code to be installed locally; http servers are remotely hosted and shared.
Question 4 of 5
What makes Claude Code hooks more powerful than Gemini CLI's extension system for custom enterprise workflows?
Correct. Claude Code hooks are a general-purpose execution engine, not just an MCP add-on. A PreToolUse hook runs before every tool call matching a pattern — you can write a shell script that logs to CloudWatch, calls a compliance API, blocks writes to production config files, or triggers a Slack notification. PostToolUse hooks can automatically run tests after every file write, ensuring Claude Code never writes code without immediately checking it compiles. Gemini CLI's extension system is focused on adding new tools via MCP; Claude Code's hook system is focused on controlling and observing all tool usage.
Question 5 of 5
Your team has built a custom MCP server for reading Jira tickets. You currently use it with Claude Code. A new teammate uses Gemini CLI. What needs to change?
Correct. This is MCP's portability promise in action. The MCP server is a standard process that listens on stdio (or HTTP) and speaks the MCP protocol — it has no knowledge of which client is connecting. Whether Claude Code or Gemini CLI starts it, the server behaves identically. The only change needed is the config block: in Gemini CLI's GEMINI.md, add a ## MCP Servers section with the same command and args. The server process, the tool definitions, and all the Jira integration code are untouched. This is exactly why MCP's open standard design matters for teams that use multiple AI tools.