MCP Servers & CLI

When to Use Which

GenAI Skills Academy

Friday 20 March 2026

Recap from Last Week

  • MCP = Model Context Protocol. An open standard that lets AI apps connect to external services.
  • Last week: built an SAP server live in Claude Desktop
  • Today: go under the bonnet. Understand the architecture, build another server, and compare MCP with CLI.

Three MCP Terms You Need to Know

Host (the app you type into)

Claude Code, Claude Desktop, VS Code, Cursor. Whatever AI app you're using. You already have this.

Server (the program you build)

A few files of code that know how to talk to an external API. Sits on your machine as a folder of files. Does nothing until the host starts it.

Client (the connector)

You don't build this. You never see it. Created automatically by the host when it reads your config. One per server.

What Do We Mean by "Server"?

In everyday language, a "server" is a machine in a data centre. In MCP, it means something different.

An MCP server is a program that translates between your app and an external service. It's software on your computer, not hardware in a rack.
  • Local server = a program you build, running on your machine. The connector (client) talks to it via stdio (standard input/output — how local programs talk to each other).
  • Remote server = a program Anthropic hosts for you. The connector talks to it over HTTP. This powers Google Drive in Claude Desktop.

Building an MCP Server

The Sequence

1
You already have the host (app) — Claude Code
2
We build the server (program) — code that calls the Google Drive API
3
Add it to your config file — tells the host where the program is
4
Restart Claude Code — creates a client (connector), connects to server, discovers tools
5
Ask a question — model picks the tool, connector calls server, server calls API

Diagram 1: Claude Code — Local Server

YOUCLAUDE CODE ▶ Claude model decides to call a tool (host — the app) | | tool call to connector v MCP CLIENTMCP SERVERGOOGLE DRIVE (connector) (program — (external your machine) service) JSON-RPC HTTP request over stdio to API
MCP (client ↔ server) happens on your machine. Anthropic's servers are only involved for the model's thinking — not part of MCP.

Diagram 2: Claude Desktop — Remote Server

YOUCLAUDE DESKTOP ▶ Claude model decides to call a capability (host — the app) | | tool call to connector v MCP CLIENT ▶▶▶ REMOTE SERVERGOOGLE DRIVE (connector — (hosted by (external your machine) Anthropic) service) Streamable HTTP HTTP request (over internet) to API
The connector (client) is still on your machine. The server (program) is remote — on Anthropic's servers. This is what you used last week.

The Key Difference

Claude Code (local)Claude Desktop (remote)
Client (connector)On your machineOn your machine
Server (program)On your machineOn Anthropic's servers
How they talkstdio (local programs talking)Streamable HTTP (over internet)
You build it?YesNo — Anthropic builds it
The connector is always on your machine. The difference is where the program runs.

Component Definitions

MCP TermWhat It IsWhere It Runs
HostThe app you type intoYour computer
ClientConnector — one per server, automaticYour computer
Server (local)Program you build — calls an APIYour computer
Server (remote)Same job, Anthropic hosts itAnthropic's servers
External serviceGoogle Drive, Slack, Zoom etc.The internet
Claude modelDecides which tool to call. Not part of MCP.Anthropic's servers

Tools — The Part That Matters

  • MCP defines three primitives: Tools, Resources, and Prompts. Only Tools matter in practice.
  • Tools = actions the server can perform (search, create, update, delete)
  • Model-controlled: Claude decides which tool to call based on your question. You just ask in plain language.
  • Tool discovery is automatic — client calls tools/list on the server at startup

The Request-Response Flow

1
You type: "Search my Google Drive for Q4 reports"
2
Host (Claude Code) sends your message to the Claude model
3
Model decides to call search_files tool
4
Host hands the call to MCP client (connector)
5
Client sends call to MCP server (program) via JSON-RPC over stdio
6
Server calls Google Drive API → gets results → formats → returns
7
Client passes result to host → model writes your answer
Steps 4–7 are MCP. You just asked a question. MCP handled the plumbing.

What is CLI?

  • CLI = Command-Line Interface. Typing text commands instead of clicking buttons.
  • Terminal = the app where you type (Terminal on Mac, PowerShell on Windows). No buttons, no menus.
  • Common tools: curl (fetches data from URLs), git, ffmpeg, python
  • CLI tools run locally, but commands may send data over the internet (curl fetches from a URL, git push sends to GitHub)

How Claude Code Uses CLI

  • Claude Code has a Bash tool that sends commands to your terminal
  • The terminal executes the command — same as if you typed it yourself
  • Claude constructs the command programmatically, then reads the text output
  • No setup. No config. If the tool is installed on your machine, Claude can use it.
With CLI, you see the exact command and where data is going. With MCP, the server program handles it internally.

CLI vs MCP

AspectCLIMCP
SetupInstall the tool, doneBuild server, configure JSON, restart host
DiscoveryClaude knows common toolstools/list at startup — automatic
Data formatRaw text/JSONStructured, typed responses
StateStateless — each command independentPersistent connection
AuthPer command or env varsConfigured once
EcosystemThousands installed alreadyGrowing, still early

MCP vs CLI: When to Use Which

One-off task? (convert a file, check something) CLI
Repeated integration? (CRM, calendar, email) MCP
Simple utility? (git, ffmpeg, file ops) CLI
Complex API with auth? (Google, Slack, Notion) MCP
Need auto-discovery of capabilities? MCP
Just run and read the output? CLI
Claude decides which to use. MCP preferred when available. CLI is the fallback. You don't specify.

Real-World Examples

TaskApproachWhy
"Convert this video to MP3"CLI (ffmpeg)One command, done
"Search Google Drive for Q4 reports"MCPOAuth, pagination, structured
"Create a Jira ticket"MCPAuth, structured, repeatable
"Count lines in this file"CLI (wc -l)Trivial utility
"Pull my Slack messages"MCPOAuth, channels, threading
"Run my test suite"CLI (npm test)Direct command
"Log interaction in CRM"MCPStructured data, auth

Live Build: Weather MCP Server

OpenWeatherMap — free tier, API key auth, no OAuth

1
"I want Claude to check the weather whenever I ask"
2
Paste the build prompt into Claude Code
3
Watch it build — files, dependencies, tools
4
Configure — add to config JSON
5
Test with MCP Inspector, then test in Claude Code

Same Task via CLI

Ask Claude Code: "What's the weather in Dublin?"

curl "https://api.openweathermap.org/data/2.5/weather?q=Dublin&appid=KEY&units=metric"

Raw JSON back. Claude reads it, works out which fields matter, writes a response.

MCPCLI
Setup~5 min0
First useSlowerFaster
Tenth useInstant (auto-discovered)Same as first
Error handlingStructuredRaw HTTP

MCP Security Risks

1. Data Leaks & PII Exposure
Server passes data to external APIs. Sensitive data can leak without you knowing.
2. Prompt Injection
Malicious content from an API could manipulate what Claude does next.
3. Shadow MCP (Unapproved Servers)
Anyone could install a server connecting Claude to unsanctioned services.
4. No Visibility
Without logging, no audit trail of what data went where.
5. Tool Overload
Too many servers overwhelm Claude — wrong tool calls, confusion, errors.

Source: MCP Manager

Security Checklist

1
Review source code before installing any third-party server
2
Environment variables for credentials — never hardcode API keys
3
Minimum scope API keys — read-only if you only need read
4
Build your own when possible — you control every line
5
Test with non-sensitive data — don't connect production CRM on day one
6
Keep server count manageable — connect what you use, disconnect what you don't

Next Steps

  • Work through the setup checklist — build the server from today's demo
  • Identify one repeated task in your workflow → build an MCP server for it
  • CLI for everything else — they complement each other
  • Post questions in the community

GenAI Skills Academy

skool.com/genai-skills-academy-1964