Skip to main content
Your progress
0 of 6 complete0%
T6 / M6.2 / L3 OF 5 / Architect LEVEL / 9 min

Connecting Claude Code (terminal)

Outcome

By the end of this lesson, you will be able to install Claude Code, connect ZopNight MCP, and combine MCP with Claude Code’s skills feature for reusable team workflows.


PrerequisitesM6.2.L1 · M6.2.L2
Time9 minutes

1. Concept

Claude Code runs in a terminal. It reads and writes files on your machine, runs shell commands when you allow it, and talks to MCP servers.

If you already live in a terminal, this is the one to use. SREs, platform engineers and anybody who writes scripts will find it fits what they already do.

Terminal window
WHEN CLAUDE CODE WINS:
You live in the terminal
You want agent + git + cost in one session
You run automation scripts that need cost data
You write internal tools that benefit from cost context
You want skills (reusable commands) as a team

Different from Claude Desktop (chat-only) and Cursor (IDE-embedded). Same MCP server; different invocation surface.

Installation

Terminal window
INSTALL (one-time): follow Anthropic's Claude Code setup guide.
At the time of writing the native installer is:
$ curl -fsSL https://claude.ai/install.sh | bash
VERIFY:
$ claude --version
→ prints the installed version number
AUTH (one-time, opens browser):
$ claude
> /login
→ sign in to your Anthropic account in the browser
→ returns to the terminal signed in

Adding ZopNight MCP

Register the server from the terminal. Claude Code connects to an HTTP MCP server directly, and OAuth sign-in is the default:

Terminal window
claude mcp add --transport http zopnight https://api.zop.dev/mcp-server

Then start Claude Code, run /mcp, select zopnight and sign in to ZopNight in the browser it opens. Use the Server URL from Settings → API & MCP exactly as shown.

The --transport http flag (short form -t http) is required: without it, Claude Code treats the URL as a command to run rather than a server to call.

PAT instead of OAuth (CI, headless machines): add a bearer header.

Terminal window
claude mcp add --transport http zopnight https://api.zop.dev/mcp-server \
--header "Authorization: Bearer $ZOPNIGHT_PAT"

Your shell expands $ZOPNIGHT_PAT when you run the command, so the token value is stored in Claude Code’s config file (~/.claude.json). Keep that file private.

Verifying connection

Terminal window
$ claude
> /mcp
zopnight · connected
> "List my top 5 idle-resource recommendations"
Claude calls: get_recommendations
Returns formatted output (5 recommendations with details)

If /mcp doesn’t show zopnight as connected, check:

  • claude mcp list shows the server with the right URL
  • You finished the browser sign-in (OAuth), or the PAT is valid and unexpired
  • Network connectivity to the Server URL

Where the config lives (scopes)

Terminal window
--scope local (default) this project only, private to you
stored in ~/.claude.json
--scope user every project on your machine
stored in ~/.claude.json
--scope project shared with the repo
stored in .mcp.json at the repo root

When a specific repo needs cost data (e.g., a prod-monitoring repo that wants cost info during incidents), add it at project scope:

Terminal window
claude mcp add --transport http zopnight https://api.zop.dev/mcp-server --scope project
This writes .mcp.json in the repo root:
{
"mcpServers": {
"zopnight": {
"type": "http",
"url": "https://api.zop.dev/mcp-server"
}
}
}
COMMIT .mcp.json: it holds no secret; each engineer signs in
with their own ZopNight account.
PAT variant: .mcp.json expands environment variables, so a header
can reference one without committing the value:
"headers": { "Authorization": "Bearer ${ZOPNIGHT_PAT}" }

Claude Code asks each engineer to approve a project-scoped server the first time it starts in that repo.

Skills + MCP: the team multiplier

Claude Code supports skills: a folder containing a SKILL.md file of instructions, with a short frontmatter naming the skill and saying when to use it. Combined with MCP, skills become reusable cost workflows.

Terminal window
CREATE: ~/.claude/skills/cost-summary/SKILL.md
---
name: cost-summary
description: Generate this week's cost summary from ZopNight
---
Use the zopnight MCP server to:
1. Call get_costs filtered to last 7 days (by team)
2. Call get_cost_trends for week-over-week comparison
3. Call get_recommendation_summary for open recs
4. Call list_audit_logs for material changes
Synthesize into a markdown summary with these sections:
Total spend (and WoW delta)
Top changes (resource-level)
Open recommendations (top 3 by impact)
Material changes (audit log highlights)
Action items (specific to this week)
Output to stdout. Don't write files unless asked.
Terminal window
USE the skill:
$ claude
> /cost-summary
→ Claude runs the skill, calls MCP tools, returns summary
(Claude can also pick the skill up on its own when a request
matches its description)
SHARE with team:
Commit the skill folder to the repo under .claude/skills/
(project skills), or each engineer copies it to ~/.claude/skills/

Skills make MCP workflows reusable and shareable. M6.4 covers building team-shared skills in depth.

Multi-account workflow

Claude Code suits consultants and MSPs working with several ZopNight orgs, and one server entry is enough:

Terminal window
SETUP: one zopnight entry; grant the orgs you need at OAuth
consent (or bind them to the PAT when you create it)
USE:
> "Compare customer-a and customer-b spend last month"
Claude queries each org in turn, merges results, presents
a comparison
> "Show idle-resource recommendations in customer-a only"
Claude queries only customer-a

The org rides in each tool call, so the agent reasons about which org to query.

Permissions and safety

Terminal window
WHEN CLAUDE CODE RUNS in your terminal:
Can read/write local files (with permission prompt)
Can run shell commands (with permission prompt)
Asks before each MCP tool call, unless you allow it
(answer "don't ask again", or add a permission rule such as
mcp__zopnight__get_costs, or mcp__zopnight for the whole server)
RECOMMENDED setup:
Allow-list read tools you use often; leave writes on prompt
Don't auto-allow shell commands by default
Review each shell command before approving
Audit MCP calls via ZopNight audit log (M6.3.L3)
The MCP tool calls are reads on a default-tier org, but shell commands
and file writes deserve case-by-case approval.

Common issues

Terminal window
PROBLEM: "zopnight: failed" or "needs authentication" in /mcp
Check: you finished the browser sign-in; run /mcp and choose
Authenticate again
Check: claude mcp list shows the exact Server URL
PROBLEM: "PAT unauthorized"
Check: the token has not expired or been rotated
Fix: create or rotate the token in Settings → API & MCP,
then claude mcp remove zopnight and add it again
PROBLEM: "Tool timeout"
Cause: very broad query against a large org
Fix: scope queries with filters (by team, date range)
PROBLEM: "Skill not found"
Check: ~/.claude/skills/<name>/SKILL.md (or .claude/skills/ in
the repo) exists
Verify: the frontmatter has name and description; start a new
session so Claude Code picks it up

Skills for ad-hoc workflows

The skill pattern works for any recurring cost workflow. Examples worth building:

Terminal window
~/.claude/skills/
cost-summary/SKILL.md Weekly team cost summary
anomaly-triage/SKILL.md 15-min triage helper (M5.5.L1)
postmortem-skeleton/SKILL.md Postmortem template + data (M5.5.L4)
forecast-prep/SKILL.md Bottom-up forecast helper (M5.6.L2)
reco-review/SKILL.md Recommendation triage

Build one skill per recurring workflow; share via team repo. M6.4 covers the workflow + sharing patterns.


2. Demo

A typical engineer’s terminal session:

Terminal window
$ claude
> /mcp
Connected servers:
zopnight (connected)
> "What's my biggest unrealized recommendation?"
Claude calls: get_recommendation_summary
Returns: "i-0xyz123 right-sizing recommendation worth $400/mo,
no action since 30 days. Owner via tag: bob@platform."
> "Draft a Slack message to the owner explaining the recommendation
and asking when we can apply it."
Claude drafts message tailored to engineer audience:
"@bob: i-0xyz123 has a right-sizing rec open for 30 days
($400/mo savings). Anything blocking us from applying? Let me
know if you want me to walk through it."
> "Save the draft to ~/cost-summary.md"
Claude writes file (prompts for permission first)
> "Now generate this week's cost summary using the cost-summary skill"
Claude invokes /cost-summary skill
Skill chains 4 MCP calls
Returns formatted summary to stdout
Engineer reviews, sends Slack, commits the cost-summary.md to a
weekly archive directory.
ELAPSED: 3 minutes of terminal time.

The terminal is the surface; ZopNight is the data; the agent is the assistant.


3. Hands-on (5 min)

Set up Claude Code with ZopNight MCP:

Terminal window
□ STEP 1: Install Claude Code
Method: native installer (curl) / already installed
Verified version: __________
□ STEP 2: Authenticate
$ claude
> /login
Verified: __________
□ STEP 3: Configure MCP
Ran claude mcp add --transport http zopnight <Server URL>
Signed in to ZopNight via /mcp (or added a PAT header)
□ STEP 4: Test
$ claude
> /mcp
Sees zopnight? Yes / No
□ STEP 5: First skill
Create ~/.claude/skills/cost-summary/SKILL.md (use the template above)
$ claude
> /cost-summary
Runs? Yes / No
CHALLENGE for the week:
Build a second skill for a recurring workflow you have
Skill name: __________
What it does: __________

4. Knowledge check

Q1

Claude Code vs Claude Desktop:

A. The same product, different name
B. Different. Both can use MCP
C. Different products, and only Claude Code can use MCP
D. Identical functionality

Show answer

Correct: B. Claude Code is a CLI agent with file/shell access; Claude Desktop is chat-only. Pick Claude Code if you live in the terminal; Claude Desktop if you live in chat. Different surfaces with overlapping MCP capability.

Q2

MCP config in Claude Code lives at:

A. Hardcoded into the client binary itself, with no file
B. In a system-wide path under /etc/claude/, shared by every user on the machine
C. ~/.claude.json (user or local scope) or .mcp.json at the repo root (project)
D. Only via CLI flags supplied at launch time

Show answer

Correct: C. claude mcp add writes user- and local-scope servers to ~/.claude.json, and project-scope servers to .mcp.json at the repo root, which is meant to be committed. Keep secrets out of .mcp.json by using OAuth or an environment-variable reference.

Q3

Skills + MCP: the relationship:

A. Skills wrap MCP calls into reusable named commands
B. Skills replace MCP entirely, once written
C. Skills and MCP are entirely unrelated mechanisms
D. Skills are a paid add-on that MCP requires

Show answer

Correct: A. A skill is a folder with a SKILL.md file of instructions (“call these MCP tools; synthesize this output”); invoking /skill-name runs it. Skills make MCP workflows shareable across the team, which is the multiplier.


5. Apply

Claude Code for terminal workflows. Build skills for recurring tasks (M6.4 covers patterns). Share skills via a team repo so workflows scale across engineers.


Glossary terms touched

Skill (Claude Code)


Start with the bill.

Foundations takes about five hours. The first lesson is nine minutes.

Free curriculum. No paywall. 290 lessons across 7 courses, plus an optional 24-lesson beginner course. Browse every course without an account; a free account opens the lessons, saves your progress and opens the exams for three publicly verifiable credentials. Read it on the train, take the exam on a Saturday, list the credential on your résumé Monday.

5h median time to finish Foundations
free account, every course, no paywall
3 certifications, each with a public verifier
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·