Mentioned as part of the example file operations tool that allows basic file system operations including listing, reading, and writing files.
Supports serving documentation resources with the text/markdown MIME type for AI to read.
Provides package management for the MCP server, with instructions for installing and managing dependencies.
Includes a task management tool example with CRUD operations for creating, listing, updating and managing tasks with priorities.
Provides example TypeScript implementation for MCP servers and clients, with type definitions for MCP protocol messages and handlers.
MCP Learning Project - Complete Guide
This is a comprehensive tutorial project that teaches Model Context Protocol (MCP) development from beginner to advanced levels. You'll learn both server-side (backend) and client-side (frontend) development.
🎯 What You'll Learn
Beginner Level:
✅ Basic MCP server structure and concepts
✅ Simple tool creation and registration
✅ Parameter handling and validation
✅ Basic client connection and tool calling
Intermediate Level:
✅ State management between tool calls
✅ Resource management (serving data to AI)
✅ Data processing and complex operations
✅ Client-server communication patterns
Advanced Level:
✅ CRUD operations with persistent state
✅ Comprehensive error handling
✅ Prompt templates for AI interactions
✅ Best practices and production considerations
📁 Project Structure
🚀 Quick Start
1. Setup Project
2. Create Package.json
3. Create TypeScript Config
Create tsconfig.json
:
4. Save the Code Files
Save the MCP Learning Server code as
src/server.ts
Save the MCP Learning Client code as
src/client.ts
5. Build and Run
🎓 Learning Path
Phase 1: Understanding the Basics
Start the interactive client:
npm run demoTry basic commands:
mcp-learning> help mcp-learning> tools mcp-learning> call hello_world {"name": "Alice"}Learn about resources:
mcp-learning> resources mcp-learning> read mcp-concepts
Phase 2: Hands-on Practice
Run the beginner demo:
mcp-learning> demo beginnerPractice tool calls:
mcp-learning> call calculator {"operation": "add", "a": 5, "b": 3} mcp-learning> call calculator {"operation": "divide", "a": 10, "b": 0}Understand state management:
mcp-learning> call counter {"action": "get"} mcp-learning> call counter {"action": "increment", "amount": 5} mcp-learning> call counter {"action": "get"}
Phase 3: Advanced Concepts
Run intermediate demo:
mcp-learning> demo intermediateWork with complex data:
mcp-learning> call data_processor {"data": [5, 2, 8, 1, 9], "operation": "sort"} mcp-learning> call data_processor {"data": [5, 2, 8, 1, 9], "operation": "average"}CRUD operations:
mcp-learning> call task_manager {"action": "create", "task": {"title": "Learn MCP", "priority": "high"}} mcp-learning> call task_manager {"action": "list"}
Phase 4: Production Ready
Run advanced demo:
mcp-learning> demo advancedLearn error handling:
mcp-learning> call error_demo {"error_type": "none"} mcp-learning> call error_demo {"error_type": "validation"}Study best practices:
mcp-learning> read best-practices
🔧 Key Concepts Explained
1. MCP Server (Backend)
The server provides capabilities to AI models:
2. MCP Client (Frontend)
The client connects to servers and uses their capabilities:
3. Communication Flow
🧪 Experimentation Ideas
Create Your Own Tools:
Weather Tool:
{ name: 'weather', description: 'Get weather information', inputSchema: { type: 'object', properties: { city: { type: 'string', description: 'City name' }, units: { type: 'string', enum: ['celsius', 'fahrenheit'], default: 'celsius' } }, required: ['city'] } }File System Tool:
{ name: 'file_operations', description: 'Basic file system operations', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['list', 'read', 'write'] }, path: { type: 'string', description: 'File or directory path' }, content: { type: 'string', description: 'Content to write' } }, required: ['action', 'path'] } }Database Tool:
{ name: 'database', description: 'Simple in-memory database operations', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['create', 'read', 'update', 'delete'] }, table: { type: 'string', description: 'Table name' }, data: { type: 'object', description: 'Data to store/update' }, id: { type: 'string', description: 'Record ID' } }, required: ['action', 'table'] } }
Create Custom Resources:
Configuration Resource:
{ uri: 'config://app-settings', name: 'Application Settings', description: 'Current application configuration', mimeType: 'application/json' }Documentation Resource:
{ uri: 'docs://api-reference', name: 'API Reference', description: 'Complete API documentation', mimeType: 'text/markdown' }
Create Interactive Prompts:
Code Review Prompt:
{ name: 'code-review', description: 'Start a code review session', arguments: [ { name: 'language', description: 'Programming language', required: true }, { name: 'focus', description: 'Review focus (security, performance, style)', required: false } ] }
🐛 Debugging and Troubleshooting
Common Issues:
Server Won't Start:
# Check if TypeScript compiled correctly npm run build # Look for compilation errors npx tsc --noEmit # Check for missing dependencies npm installClient Can't Connect:
# Make sure server path is correct node dist/client.js dist/server.js # Check if server process starts node dist/server.jsTool Calls Fail:
// Add debugging to your server console.error(`[DEBUG] Tool called: ${name}`, JSON.stringify(args)); // Validate input parameters carefully if (typeof args.requiredParam === 'undefined') { throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter'); }
Debug Mode:
Enable verbose logging in both server and client:
🚀 Next Steps: Building Production Servers
1. Add Real Functionality:
Replace demo tools with actual useful functionality:
2. Add External Integrations:
3. Add Persistence:
4. Add Authentication:
📚 Additional Resources
Official Documentation:
Community Examples:
Advanced Topics:
HTTP transport for web services
WebSocket transport for real-time communication
Custom transport implementations
Performance optimization techniques
Security best practices
🎯 Learning Exercises
Exercise 1: Extend the Calculator
Add more operations: power
, sqrt
, factorial
, sin
, cos
Exercise 2: Build a Note-Taking System
Create tools for creating, editing, searching, and organizing notes with tags.
Exercise 3: Add External API Integration
Integrate with a real API (weather, news, stock prices) and create corresponding tools.
Exercise 4: Build a Project Manager
Create a comprehensive project management system with tasks, deadlines, priorities, and progress tracking.
Exercise 5: Add Real-Time Features
Implement tools that can send notifications or updates back to the client.
🏆 Mastery Checklist
Beginner Level ✅
Understand MCP architecture (client, server, transport)
Create basic tools with input validation
Handle simple tool calls and responses
Read and understand error messages
Intermediate Level ✅
Implement stateful tools with persistence
Create and serve resources to AI
Handle complex data processing
Implement proper error handling patterns
Advanced Level ✅
Build CRUD operations with complex state
Create interactive prompt templates
Implement production-ready error handling
Understand security and authentication concepts
Optimize performance for production use
Expert Level 🚀
Build custom transport layers
Create MCP server frameworks
Implement advanced security measures
Build distributed MCP architectures
Contribute to the MCP ecosystem
🎉 Congratulations!
You now have a complete understanding of MCP development from both frontend and backend perspectives. You can:
Build MCP servers that provide tools, resources, and prompts
Create MCP clients that interact with servers effectively
Handle errors gracefully and implement proper validation
Manage state between tool calls and across sessions
Follow best practices for production-ready implementations
The interactive learning environment in this project gives you hands-on experience with all MCP concepts. Use this as a foundation to build your own specialized MCP servers for any domain or use case!
Happy coding! 🚀
This server cannot be installed
A comprehensive tutorial project that teaches Model Context Protocol (MCP) development from beginner to advanced levels, covering both server-side and client-side development.
Related MCP Servers
- AsecurityAlicenseAqualityA beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.Last updated -3863Apache 2.0
- -securityAlicense-qualityAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server integrating with various LLM clients.Last updated -2MIT License
- -securityFlicense-qualityA comprehensive Model Context Protocol (MCP) server that provides 37+ intelligent development tools across JavaScript/TypeScript, Rust, and Python with security-first design and high-performance features.Last updated -111
- -securityFlicense-qualityA tutorial MCP server for learning the Model Context Protocol by building file and system tools. Provides hands-on experience creating custom tools that enable AI models to interact with files and execute system commands.Last updated -