What is MCP in Plain Language?
MCP (Model Context Protocol) is an open protocol that allows Claude (and other AIs) to access tools and data you define. Imagine Claude being able to read your files, query your database, or send Slack messages โ all securely and under your control.
Without MCP, Claude is limited to its context: it can only respond based on what you type in the conversation. With MCP, you give it "superpowers": read a config file, execute a SQL query, search technical documentation.
An MCP server that exposes a /workspace folder to Claude. Claude will be able to list files, read their content, and create new files โ only within this secure folder. Perfect for generating code, writing documentation, or analyzing text files.
How it works: 3 key concepts
MCP relies on three roles:
- Host โ the application that orchestrates everything (e.g., Claude Desktop)
- Client โ the component in the Host that connects to an MCP server
- Server โ your program that exposes capabilities (read files, query database, etc.)
Communication happens via JSON-RPC 2.0 over stdio (local process) or HTTP (remote server). The LLM never directly calls your APIs โ the MCP server acts as a secure intermediary.
Prerequisites
Before starting, make sure you have:
- Node.js 18+ installed (
node --versionshould show v18.0.0 or higher) - A code editor (VS Code, Cursor, or any editor)
- Claude Desktop installed (download here)
- Basic JavaScript/TypeScript knowledge (know what a function, variable, async/await are)
Installing the MCP SDK
Step 1: Create the project
Step 2: Configure TypeScript
Step 3: Add npm scripts
Open package.json and add these scripts:
Create the Filesystem MCP Server
Create the file src/index.ts with the following code. Each section is commented to explain what's happening.
Build the server
Connect the Server to Claude Desktop
Now that your MCP server is ready, you need to declare it in Claude Desktop's configuration.
Locate the config file
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Add your MCP server
Replace /absolute/path/to/mcp-filesystem-server/dist/index.js with the full path on your machine. Example macOS: /Users/alice/mcp-filesystem-server/dist/index.js
Restart Claude Desktop
- macOS: Cmd+Q to quit completely, then relaunch
- Windows/Linux: Close all windows and relaunch
After restarting, open Claude Desktop. You should see a tool icon (๐จ) at the bottom of the conversation window, indicating that MCP servers are connected.
Testing the Server with Real Conversations
Test 1: List files
In Claude Desktop, type:
Claude should automatically call the list_files tool and respond:
Test 2: Create a file
hello.txt containing "Hello from MCP!"Claude calls write_file and responds:
Test 3: Read the created file
Hello from MCP!
Test 4: Real use case โ Generate code
fibonacci.py containing a recursive function to calculate the nth Fibonacci number, with unit tests.Claude will generate the Python code and write it to workspace/fibonacci.py. You can then verify the file on your machine:
Troubleshooting: Common Issues
| Symptom | Cause | Solution |
|---|---|---|
| Server doesn't appear in Claude Desktop | Relative path in config or Claude not restarted | Use an absolute path. Quit Claude completely (Cmd+Q) and relaunch |
| Error "Cannot find module" | The dist/index.js file doesn't exist | Run npm run build to compile TypeScript |
| Claude says "I don't have access to that tool" | Server crashed or didn't start | Check logs: View โ Developer โ Developer Console in Claude Desktop |
| Error "Access denied outside workspace" | Attempted read/write outside secure folder | Normal โ security working as intended. Claude can only access workspace folder |
| Server starts then stops immediately | Error in code or missing dependencies | Run npm run dev in a terminal to see the exact error |
Debug with logs
Next Steps
Congratulations! You've created your first MCP server. Here's how to go further:
1. Add more tools
Examples of useful tools to add:
- search_file โ search for a keyword in all workspace files
- delete_file โ delete a file
- create_folder โ create subfolders in the workspace
- run_command โ execute shell commands (caution: security risk!)
2. Connect a database
Create an MCP server that lets Claude query PostgreSQL, MongoDB, or SQLite. Example: a query_db tool that executes SQL queries and returns results.
3. Expose an external API
Create an MCP server that calls third-party APIs (GitHub, Slack, Notion). Example: a create_github_issue tool that opens a ticket on GitHub directly from Claude.
4. Deploy to production
To share your MCP server with your team, deploy it on a remote server and configure HTTP/SSE transport instead of stdio. Consult the official MCP documentation for details.
5. Explore the MCP registry
There are over 2,000 open-source MCP servers ready to use (GitHub, Slack, PostgreSQL, Brave Search, etc.). Check the official MCP registry for inspiration.
6. Get in-depth training
This tutorial covers the basics (Resources, Tools). To master MCP in production (Prompts, Sampling, error handling, security), check our Claude API for Developers training. We cover the Claude API thoroughly, then introduce MCP with hands-on server creation exercises. 3-day training, available worldwide.
Frequently Asked Questions
Can I create an MCP server without TypeScript experience?
Yes, with basic JavaScript knowledge. This tutorial is designed for beginners and explains every line of code. If you know what a function and a variable are, you can follow along. Python is also supported via the official SDK, but TypeScript is recommended for getting started (better documentation, more examples).
Do I need to pay to use Claude Desktop with my MCP server?
No for local testing. Claude Desktop is free for personal use. You can use your MCP server with the free Claude plan (limited to ~45 messages/day). For intensive or professional use, Claude Pro (USD 20/month) or Claude API are required. The MCP server itself costs nothing.
Can my MCP server work with tools other than Claude Desktop?
Yes! MCP is an open standard. Your server works with all MCP clients: VS Code (MCP extension), Cursor, Windsurf, JetBrains IDEs, Zed, and many no-code tools. Once created, your server is reusable everywhere.
What if my MCP server doesn't show up in Claude Desktop?
Check 3 things: (1) The path in claude_desktop_config.json is absolute, not relative. (2) The index.js file exists in dist/ (run `npm run build`). (3) Fully restart Claude Desktop (Cmd+Q on Mac, not just close the window). See the Troubleshooting section for more diagnostics.
How long to master MCP after this tutorial?
This tutorial: 20-30 minutes to create your first server. Mastering MCP at production level: 2-3 days of practice. This guide covers fundamentals (Resources, Tools), but not advanced concepts (Prompts, Sampling, SSE remote servers). To go further, see our Claude API training which includes a complete MCP module.