nemilya/mcp-with-claude-code-getting-started
If you are the rightful owner of mcp-with-claude-code-getting-started and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This document provides a structured overview of setting up and using a Model Context Protocol (MCP) server with Claude Code.
MCP Getting Started Demo

This is a comprehensive demo project that demonstrates how to create and use MCP (Model Context Protocol) servers with Claude Code. The project shows the complete workflow from server implementation to integration with Claude Code.
Quick Start
- Clone and setup the MCP server
- Navigate to the app directory and start Claude Code
- Use your custom MCP tools directly in Claude Code
# 1. Setup the server
cd my-library-mcp
uv sync
uv pip install -e .
# 2. Go to app directory and start Claude Code
cd ../app-dir
claude-code
# 3. Test your MCP server in Claude Code
> /mcp list # Should show "my-library" server
> Please process the text "Hello MCP World"
Project Structure
mcp-with-claude-code-getting-started/
├── README.md # This file - main project documentation
├── my-library-mcp/ # MCP Server implementation
│ ├── my_library/
│ │ └── server.py # Main MCP server code
│ ├── pyproject.toml # Python project configuration
│ └── README.md # Server-specific documentation
└── app-dir/ # Application directory for Claude Code
├── .mcp.json # MCP server configuration for Claude Code
└── .gitignore
How It Works
1. The MCP Server (my-library-mcp/)
This directory contains a fully functional MCP server built with FastMCP that provides text processing capabilities:
- Server Name:
my-library-server - Available Tool:
process_text(text: str)- Processes text and returns original, uppercase version, and length - Framework: FastMCP (Python)
- Transport: STDIO
2. The Application Directory (app-dir/)
This is where you'll run Claude Code. The key file is .mcp.json which tells Claude Code which MCP servers to connect to:
{
"mcpServers": {
"my-library": {
"command": "uv",
"args": [
"run",
"--project", "../my-library-mcp",
"my-library-mcp"
],
"type": "stdio",
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}
Key Points:
- The path
../my-library-mcpis relative to theapp-dir/ - Claude Code automatically detects and starts MCP servers defined in
.mcp.json - The server runs via
uv runfor proper dependency management
Step-by-Step Setup Guide
Prerequisites
- Python 3.10+
- uv (Python package manager) - Install uv
- Claude Code - Install Claude Code
Step 1: Setup the MCP Server
# Navigate to the server directory
cd my-library-mcp
# Install dependencies
uv sync
# Install the package in development mode (required!)
uv pip install -e .
Step 2: Verify Server Installation
# Test that the server runs correctly
uv run my-library-mcp
You should see the FastMCP banner indicating the server is running.
Step 3: Start Using with Claude Code
# Navigate to the app directory
cd ../app-dir
# Start Claude Code
claude-code
Using Your MCP Server in Claude Code
Once Claude Code is running in the app-dir/, you can:
Check Connected MCP Servers
> /mcp list
You should see:
Connected MCP Servers:
- my-library (my-library-server)
Use Your Custom Tool
Simply ask Claude to use your tool:
> Please process the text "Hello World" using the process_text tool
Claude will respond with something like:
I'll process that text for you using the process_text tool.
Result:
- Original text: "Hello World"
- Uppercase: "HELLO WORLD"
- Length: 11 characters
Understanding the Configuration
The .mcp.json File Explained
{
"mcpServers": {
"my-library": { // Server name for reference
"command": "uv", // Command to run the server
"args": [ // Arguments for the command
"run",
"--project", "../my-library-mcp", // Path to server project
"my-library-mcp" // Package name to run
],
"type": "stdio", // Communication type
"env": { // Environment variables
"PYTHONUNBUFFERED": "1" // Ensures proper Python output buffering
}
}
}
}
How Claude Code Uses This Configuration
- Auto-detection: Claude Code automatically reads
.mcp.jsonwhen starting - Server Startup: Claude Code launches each configured server as a subprocess
- Tool Registration: The MCP server's tools become available to Claude
- Communication: Claude communicates with servers using the MCP protocol via STDIO
Extending This Demo
Adding New Tools
- Edit
my-library-mcp/my_library/server.py - Add new functions with the
@mcp.tool()decorator - Restart Claude Code to pick up the new tools
Example: Adding a New Tool
@mcp.tool()
def reverse_text(text: str) -> dict:
"""Reverse the input text and return statistics."""
reversed_text = text[::-1]
return {
"original": text,
"reversed": reversed_text,
"length": len(text)
}
Adding Multiple Servers
You can add multiple MCP servers to your .mcp.json:
{
"mcpServers": {
"my-library": {
"command": "uv",
"args": ["run", "--project", "../my-library-mcp", "my-library-mcp"],
"type": "stdio"
},
"another-server": {
"command": "node",
"args": ["../another-server/index.js"],
"type": "stdio"
}
}
}
Troubleshooting
Common Issues
-
"No such file or directory" error
- Make sure you ran
uv pip install -e .in the server directory - Verify the path in
.mcp.jsonis correct
- Make sure you ran
-
Server not showing up in
/mcp list- Check that
.mcp.jsonis in the same directory where you runclaude-code - Verify JSON syntax is correct
- Check server logs for startup errors
- Check that
-
Python environment issues
- Ensure you're using the correct Python version (3.10+)
- Make sure uv is installed and working
Verification Commands
# Check if server package is installed
cd my-library-mcp
uv pip list | grep my-library-mcp
# Test server directly
uv run my-library-mcp
# Check Claude Code MCP connection
cd ../app-dir
claude-code
> /mcp list
Learning Resources
Contributing
This is a demo project. Feel to experiment with:
- Adding new tools to the MCP server
- Trying different server configurations
- Exploring advanced MCP features
License
MIT License - feel free to use this as a foundation for your own MCP projects.