README.mdโข18.3 kB
# ๐ MCP & Copilot Studio Learning Project
**Learn Model Context Protocol (MCP) development from absolute zero to production!**
Welcome to your comprehensive learning journey with **Model Context Protocol (MCP)** and **Copilot Studio**! This project assumes you're starting completely from scratch - no prior knowledge, no tools installed. We'll get you up and running in under 30 minutes! ๐ฏ
## ๐ Prerequisites (Install Everything from Scratch)
### 1. Install Visual Studio Code
**Everyone starts here - even if you have another editor!**
1. **Download VS Code**: Go to [https://code.visualstudio.com/](https://code.visualstudio.com/)
2. **Install**: Run the installer with default settings
3. **Verify**: Open VS Code and you should see the welcome screen
### 2. Install Node.js (Required for MCP Development)
**MCP servers run on Node.js - this is essential!**
1. **Download Node.js**: Go to [https://nodejs.org/](https://nodejs.org/)
2. **Choose LTS Version**: Download the "LTS" (Long Term Support) version
3. **Install**: Run installer with default settings
4. **Verify Installation**:
- Open Command Prompt (Windows) or Terminal (Mac/Linux)
- Type: `node --version` (should show v16.0.0 or higher)
- Type: `npm --version` (should show 8.0.0 or higher)
### 3. Install Git (For Project Management)
**You'll need this to clone projects and manage code**
1. **Download Git**: Go to [https://git-scm.com/downloads](https://git-scm.com/downloads)
2. **Install**: Use default settings during installation
3. **Verify**: Type `git --version` in your terminal
### 4. Install Claude Desktop (For Testing Your MCP Server)
**This is where you'll test your MCP tools!**
1. **Download Claude Desktop**: Go to [https://claude.ai/download](https://claude.ai/download)
2. **Install**: Follow platform-specific instructions
3. **Create Account**: Sign up for Claude if you don't have an account
4. **Verify**: Open Claude Desktop and ensure it launches
### 5. Install PowerShell 7+ (Windows Users)
**Modern PowerShell for better development experience**
1. **Download**: Go to [https://github.com/PowerShell/PowerShell/releases](https://github.com/PowerShell/PowerShell/releases)
2. **Install**: Choose the .msi installer for Windows
3. **Verify**: Type `pwsh --version` in Command Prompt
## ๐๏ธ Project Structure (What You're About to Build)
```
๐ MCP Learning Project
โโโ ๐ README.md โ You are here! Main project guide
โโโ ๐ src/
โ โโโ ๐ index.ts โ Your working file (copy day files here)
โโโ ๐ days/ โ Day-by-day learning files
โ โโโ ๐ day-1/ โ Greeting tool (basics)
โ โ โโโ ๐ index-starter.ts โ Starting template
โ โ โโโ ๐ index-complete.ts โ Finished example
โ โ โโโ ๐ README.md โ Day overview
โ โโโ ๐ day-2/ โ Multi-tool development
โ โ โโโ ๐ index-starter.ts โ Advanced template
โ โ โโโ ๐ index-complete.ts โ Finished example
โ โ โโโ ๐ README.md โ Day overview
โ โโโ ๐ day-3/ โ Resources and data management
โ โ โโโ ๐ index-starter.ts โ Resources template
โ โ โโโ ๐ index-complete.ts โ Full implementation
โ โ โโโ ๐ README.md โ Day overview
โ โโโ ๐ day-4/ โ Smart prompts and templates
โ โโโ ๐ index-starter.ts โ Prompts template
โ โโโ ๐ index-complete.ts โ Full implementation
โ โโโ ๐ README.md โ Day overview
โโโ ๐ exercises/ โ Step-by-step instructions
โ โโโ ๐ day-1-basics.md โ Complete Day 1 guide
โ โโโ ๐ day-2-advanced-tools.md โ Complete Day 2 guide
โ โโโ ๐ day-3-resources.md โ Complete Day 3 guide
โ โโโ ๐ day-4-prompts.md โ Complete Day 4 guide
โโโ ๐ docs/ โ Additional learning resources
โโโ ๐ examples/ โ Code examples and templates
โโโ ๐ package.json โ Project configuration
โโโ ๐ tsconfig.json โ TypeScript settings
```
## โก Complete Setup Process (Start Here!)
### Step 1: Get This Project
```powershell
# 1. Open VS Code
# 2. Open Terminal in VS Code (Terminal > New Terminal)
# 3. Navigate to where you want this project
cd "C:\Users\YourName\Documents"
# 4. Clone or download this project
# (If you downloaded a ZIP, extract it and open the folder in VS Code)
```
### Step 2: Install Project Dependencies
```powershell
# 1. Open this project folder in VS Code
# 2. Open Terminal in VS Code
# 3. Install required packages
npm install
# This installs:
# - @modelcontextprotocol/sdk (MCP development framework)
# - zod (input validation)
# - typescript (TypeScript compiler)
```
### Step 3: Verify Everything Works
```powershell
# 1. Build the project
npm run build
# 2. Test the basic server
npm start
# You should see: "MCP Server running on stdio"
# Press Ctrl+C to stop
```
## ๐ฏ Your First 30 Minutes (Complete Beginner Path)
### Minutes 0-10: Understanding the Structure
1. **Open the project** in VS Code (File > Open Folder)
2. **Explore the folders** using the VS Code sidebar:
- Look at `days/day-1/` - this is your Day 1 lesson
- Look at `exercises/day-1-basics.md` - this is your step-by-step guide
- Notice `src/` is empty - you'll copy files here to work on them
- See `days/day-2/`, `days/day-3/`, and `days/day-4/` for upcoming lessons
### Minutes 10-20: Your First MCP Tool
1. **Copy the starter file**:
```powershell
Copy-Item days/day-1/index-starter.ts src/index.ts
```
2. **Open** `exercises/day-1-basics.md` and follow Step 2B
3. **Build and test**:
```powershell
npm run build
npm start
```
### Minutes 20-30: Connect to Claude Desktop
1. **Configure Claude Desktop** following Step 3 in `exercises/day-1-basics.md`
2. **Test your greeting tool** in Claude Desktop
3. **See the magic happen** - you just built your first MCP tool! ๐
## ๐ง Connect to Claude Desktop (Essential Step)
### Windows Configuration
1. **Find the config file**: `%APPDATA%\Claude\claude_desktop_config.json`
- If the file doesn't exist, create it
- If the folder doesn't exist, run Claude Desktop once first
2. **Add your server configuration**:
```json
{
"mcpServers": {
"mcp-learning-server": {
"command": "node",
"args": ["D:\\OneDrive\\OneDrive - Microsoft\\Documents\\Learning Projects\\MCP\\build\\index.js"]
}
}
}
```
**Important**: Change the path to match where YOU put this project!
3. **Restart Claude Desktop completely**
4. **Look for the tools icon** ๐ง in Claude Desktop
### Mac Configuration
1. **Find the config file**: `~/Library/Application Support/Claude/claude_desktop_config.json`
2. **Follow the same JSON structure** but with Mac paths
3. **Use forward slashes** in paths: `/Users/YourName/Projects/MCP/build/index.js`
### Test Prompts for Claude Desktop
Once connected, try these:
- "Use the greeting tool to greet me formally as John"
- "Use the calculator tool to multiply 15 by 8"
- "Generate 3 random passwords with length 12"
- "What resources are available?"
- "Read the project information resource"
- "Use the code-review prompt for TypeScript code focusing on performance"
- "Generate a writing-helper prompt for professional email to executives"
## ๐ Learning Path (Your 7-Day Journey)
> ๐ก **Pro Tip**: Each day builds on the previous day. Don't skip ahead!
### Day 1: Basics (Start Here!) โญ
- [ ] **Follow** `exercises/day-1-basics.md` step-by-step
- [ ] **Build your first greeting tool** - Simple but functional
- [ ] **Connect to Claude Desktop** - See your tool in action
- [ ] **Try bonus challenges** - Time-based greetings, multi-language support
**What You'll Learn**: MCP server structure, basic tool creation, Claude Desktop integration
### Day 2: Advanced Tools
- [ ] **Follow** `exercises/day-2-advanced-tools.md` for complete guide
- [ ] **Create 3 custom tools** - Calculator, text analyzer, random generator
- [ ] **Master input validation** - Learn advanced Zod patterns
- [ ] **Implement error handling** - Graceful failures and user feedback
**What You'll Learn**: Complex tools, input validation, professional error handling
### Day 3: Resources โญ
- [ ] **Follow** `exercises/day-3-resources.md` for complete guide
- [ ] **Create dynamic resources** - File-like data for Claude
- [ ] **Add static documentation** - Help content and guides
- [ ] **Test resource access** - Interactive resource testing
**What You'll Learn**: Resource architecture, URI schemes, content types, Claude integration
### Day 4: Prompts โญ
- [ ] **Follow** `exercises/day-4-prompts.md` for complete guide
- [ ] **Create 5 smart prompt templates** - Code review, writing helper, meeting summary, learning tutor, project planner
- [ ] **Master dynamic content generation** - Context-aware prompt customization
- [ ] **Implement management tools** - Prompt organization and preview systems
**What You'll Learn**: Prompt architecture, template design, context-aware assistance, structured AI frameworks
### Day 5: Integration (Coming Soon)
- [ ] **Connect to external APIs** - Real-world data integration
- [ ] **Add environment configuration** - Secure API key management
- [ ] **Implement caching** - Performance optimization
### Day 6: Best Practices (Coming Soon)
- [ ] **Add comprehensive logging** - Production-ready logging
- [ ] **Implement rate limiting** - Prevent abuse
- [ ] **Write unit tests** - Quality assurance
### Day 7: Advanced Features (Coming Soon)
- [ ] **Create complex workflows** - Multi-step tool interactions
- [ ] **Add performance monitoring** - Health checks and metrics
- [ ] **Deploy and test** - Production deployment
## ๐ Daily Quick Start Routine
**Each morning, run these commands:**
```powershell
# 1. Open the day's exercise file
code exercises/day-X-[topic].md
# 2. Copy the day's starter file (replace X with day number)
Copy-Item days/day-X/index-starter.ts src/index.ts
# 3. Build and test
npm run build && npm start
# 4. Follow the step-by-step instructions!
```
## ๐ Key Files to Know (Your Learning Roadmap)
> ๐ฏ **New to MCP?** Read `docs/learning-journey-guide.md` first to understand how all these files work together!
| File/Folder | Purpose | When to Use |
|-------------|---------|-------------|
| `days/day-X/` | **Day-by-day lesson files** | Copy starter files, reference complete solutions |
| `src/index.ts` | **Your working file** | Edit this TypeScript file daily |
| `build/index.js` | **Compiled output** | Generated automatically, Node.js runs this |
| `exercises/day-X-[topic].md` | **Step-by-step learning** | Daily hands-on practice guides |
| `docs/best-practices.md` | **Professional reference** | Understanding WHY & production patterns |
| `docs/typescript-javascript-guide.md` | **TypeScript vs JavaScript** | Understanding the build process |
| `docs/learning-journey-guide.md` | **How everything fits together** | When confused about what to use when |
| `package.json` | **Project configuration** | Adding dependencies, scripts |
## ๐ ๏ธ What You'll Build (Your MCP Tools Portfolio)
### Day 1: Greeting Tool โญ
**Your first MCP tool - simple but powerful!**
- Personalized greetings with different styles (formal, casual, enthusiastic)
- Input validation for names and greeting types
- **Bonus**: Time-aware greetings, multi-language support, mood detection
### Day 2: Professional Tool Suite ๐ผ
**Three production-ready tools working together!**
- **Calculator Tool**: All arithmetic operations with advanced math functions
- **Text Analyzer Tool**: Word count, sentiment analysis, text transformations
- **Random Generator Tool**: Passwords, UUIDs, numbers with custom ranges
- **Bonus**: Tool chaining, batch operations, export capabilities
### Day 3: Dynamic Resources ๐
**File-like data that Claude can read and process**
- Project documentation that updates automatically
- Configuration files that tools can reference
- Dynamic content generation based on user preferences
- User progress tracking and analytics
- **Bonus**: Resource analytics, configuration management, code examples library
### Day 4: Smart Prompts ๐ง
**Pre-written templates that make Claude more effective**
- Code review frameworks with language-specific analysis
- Context-aware writing assistance for different audiences
- Meeting summary templates for various meeting types
- Adaptive learning prompts based on skill level and style
- Project planning frameworks for different contexts
- **Bonus**: Template systems, prompt history, smart suggestions
### Day 5: API Integration ๐
**Connect to real-world data sources**
- Weather information tools
- News and content aggregation
- Database connections and queries
## ๐ Troubleshooting (When Things Go Wrong)
### โ "Node is not recognized as a command"
**Problem**: Node.js isn't installed or not in PATH
**Solution**:
1. Download Node.js from [nodejs.org](https://nodejs.org/)
2. Install with default settings
3. Restart your terminal/VS Code
4. Test with `node --version`
### โ "Cannot find module 'build/index.js'"
**Problem**: Project hasn't been built yet
**Solution**:
```powershell
npm run build
```
### โ Claude Desktop doesn't show tools
**Problem**: Configuration file issues
**Solution**:
1. Check the file path in `claude_desktop_config.json` is correct
2. Ensure the path uses YOUR actual project location
3. Restart Claude Desktop completely
4. Verify no JSON syntax errors (use a JSON validator)
### โ TypeScript errors in VS Code
**Problem**: TypeScript configuration or dependencies
**Solution**:
```powershell
# Reinstall dependencies
npm install
# Check TypeScript compilation
npm run build
# Verify tsconfig.json exists and is valid
```
### โ Permission denied errors
**Problem**: File permissions on Windows/Mac
**Solution**:
- Run VS Code as administrator (Windows)
- Use `sudo` for install commands (Mac/Linux)
- Check folder permissions
## ๏ฟฝ Essential Resources & Documentation
### Official MCP Documentation
- [MCP Specification](https://modelcontextprotocol.io/) - The official protocol docs
- [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) - Code examples and API
- [Python SDK](https://github.com/modelcontextprotocol/python-sdk) - If you prefer Python
### This Project's Learning Materials
- `docs/best-practices.md` - Production guidelines and patterns
- `docs/typescript-javascript-guide.md` - Understanding the build process
- `docs/learning-journey-guide.md` - How all the files work together
- `examples/weather-server.md` - Real API integration example
### VS Code Extensions (Recommended)
Install these for better development experience:
- **TypeScript and JavaScript Language Features** (built-in)
- **MCP Tools** (if available in marketplace)
- **Error Lens** - Shows errors inline
- **Prettier** - Code formatting
- **GitLens** - Git integration
## ๏ฟฝ What's Next After This Project?
### Immediate Next Steps
1. **Build something for your workflow** - Create tools you'll actually use
2. **Explore Copilot Studio integration** - Check `docs/copilot-studio-integration.md`
3. **Join the MCP community** - Share your tools and learn from others
### Advanced Learning Paths
- **Production Deployment**: Learn to deploy MCP servers to cloud platforms
- **Advanced Integrations**: Connect to databases, APIs, and enterprise systems
- **Custom Protocols**: Extend MCP for specialized use cases
- **Performance Optimization**: Scale your MCP servers for high-volume usage
### Real-World Applications
- **Development Tools**: Code analysis, testing automation, deployment helpers
- **Business Automation**: Report generation, data analysis, workflow optimization
- **Content Creation**: Writing assistance, research tools, content management
- **Personal Productivity**: Task management, note organization, learning aids
## ๐ก Learning Tips for Success
### Before You Start Each Day
- โ
Read the day's README file first (`days/day-X/README.md`)
- โ
Have the step-by-step guide open (`exercises/day-X-[topic].md`)
- โ
Start with a fresh coffee โ (optional but recommended!)
### During Development
- ๐ **Build often**: Run `npm run build` after each change
- ๐งช **Test immediately**: Use `npm start` to verify your server works
- ๐ **Read error messages**: They usually tell you exactly what's wrong
- ๐ค **Experiment freely**: Copy code, modify it, see what happens
### When Stuck
- ๐ Check the complete example file (`days/day-X/index-complete.ts`)
- ๐ Read the troubleshooting section above
- ๐ฏ Start with the simplest version, then add complexity
- ๐ฌ Ask questions in MCP community forums
### Building Good Habits
- ๐ **Organize your code**: Use clear variable names and comments
- โก **Version control**: Commit your work frequently with Git
- ๐ **Document as you go**: Write notes about what you learn
- ๐ **Review and refactor**: Make your code better over time
## ๐ Welcome to MCP Development!
You're about to embark on an exciting journey into the world of Model Context Protocol development. This isn't just about learning a new technology - you're gaining skills that will help you build AI-powered tools that can transform how you and others work.
### What Makes This Special
- **Hands-on Learning**: You'll build real tools, not just read about them
- **Progressive Complexity**: Each day builds naturally on the previous day
- **Practical Focus**: Everything you build has real-world applications
- **Community Driven**: Join a growing ecosystem of MCP developers
### Your Success Metrics
By the end of this project, you'll be able to:
- โ
Build MCP servers from scratch
- โ
Create tools that Claude Desktop can use
- โ
Handle complex input validation and error scenarios
- โ
Integrate with external APIs and data sources
- โ
Deploy and maintain production MCP servers
- โ
Understand when and why to use different MCP patterns
**Ready to begin?** Open `exercises/day-1-basics.md` and start your Day 1 journey! ๐
---
*Happy learning! The future of AI-assisted development starts with understanding how to build the bridges between humans, AI, and the tools we use every day.*