Courses/Introduction to Model Context Protocol (MCP)/Using MCP in Claude Desktop and Claude Code
Advanced and ProductionLesson 19 of 21

Using MCP in Claude Desktop and Claude Code

The Host Side of the Story

We've built servers and clients from scratch. But most people first meet MCP as users of an existing host — Claude Desktop, Claude Code, VS Code, Cursor. These hosts already contain the MCP client machinery; you just point them at servers. Understanding this side makes the whole protocol tangible: those servers you write plug straight into Claude.

ℹ️

You usually configure, not code

As a user of a host, adding a server is a configuration task, not a programming one. You tell the host how to launch (or reach) the server, and it instantiates a client for it automatically — performing the initialize handshake and discovering tools, resources, and prompts.

Configuring a Local Server in Claude Desktop

Claude Desktop launches local stdio servers from a JSON config file. You give each server a name and the command to run it. On the next launch, Claude Desktop starts the server as a subprocess, creates a client, and the server's tools become available to Claude in the conversation (often gated behind a user-approval prompt the first time a tool runs).

jsonA Claude Desktop config registering two local stdio servers — your document server and the official filesystem server.
{
  "mcpServers": {
    "documents": {
      "command": "uv",
      "args": ["run", "mcp_server.py"]
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
    }
  }
}

MCP in Claude Code

Claude Code (the agentic coding tool) is also an MCP host, configured at project or user scope. Project-scoped servers live in a checked-in config so a whole team shares them; user-scoped servers are personal. Either way, once configured, the server's tools, resources, and prompts become available to Claude Code — its slash commands can even surface server prompts.

ScopeWhere it livesUse for
ProjectChecked into the repo (shared)Servers the whole team needs (Jira, GitHub, internal APIs)
UserPersonal config (not shared)Experimental or personal servers

Like other Claude Code configuration, MCP servers can be project-scoped (shared) or user-scoped (personal).

⚠️

Keep secrets out of shared config

When a shared/project config references a server that needs credentials, use environment-variable expansion rather than hard-coding tokens. Committing a token to a shared config leaks it to everyone with repo access — a recurring real-world mistake.

Where Each Primitive Shows Up

This ties the whole course back to Claude's actual UI. The three primitives you built map to three things you can see and use as a user:

  • Tools → Claude autonomously calling your server's functions mid-conversation (with approval for sensitive ones).
  • Resources → app features like attaching documents/data as context (e.g. an 'add from…' picker).
  • Prompts → user-triggered workflows, surfaced as slash commands or buttons.

Next

You can build, secure, and plug in MCP servers. The penultimate lesson covers taking them to production reliably — deployment, debugging, and operational good practice.

Key Takeaways

  • Most people meet MCP as users of an existing host (Claude Desktop, Claude Code, VS Code, Cursor) that already contains the client machinery.
  • Adding a server to a host is usually configuration, not coding: you specify how to launch/reach it and the host instantiates a client automatically.
  • Claude Desktop launches local stdio servers from a JSON config (mcpServers with command + args); tools then become available, often behind first-use approval.
  • Claude Code is also an MCP host with project-scoped (shared, checked-in) and user-scoped (personal) server configuration.
  • Keep credentials out of shared configs — use environment-variable expansion rather than hard-coding tokens.
  • The primitives map to visible UI: tools = autonomous function calls, resources = attach-as-context features, prompts = slash commands / workflow buttons.

Check Your Understanding

Test what you learned in this lesson.

Q1.From a user's perspective, what is involved in adding an MCP server to a host like Claude Desktop?

Q2.How does Claude Desktop start a local stdio server?

Q3.What is the difference between project-scoped and user-scoped MCP servers in Claude Code?

Q4.Why should shared/project MCP config use environment-variable expansion for credentials?

Practice This Lesson