mcp_rust_examples 0.1.0

Complete educational resource for learning MCP (Model Context Protocol) development with Rust - 20 comprehensive examples from beginner to enterprise level
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# Learn MCP Development with Rust: Complete Learning Resource

```
██████╗ ███████╗███╗   ███╗ ██████╗ ██╗      █████╗ ██████╗ 
██╔══██╗██╔════╝████╗ ████║██╔═══██╗██║     ██╔══██╗██╔══██╗
██████╔╝█████╗  ██╔████╔██║██║   ██║██║     ███████║██████╔╝
██╔══██╗██╔══╝  ██║╚██╔╝██║██║   ██║██║     ██╔══██║██╔══██╗
██║  ██║███████╗██║ ╚═╝ ██║╚██████╔╝███████╗██║  ██║██████╔╝
╚═╝  ╚═╝╚══════╝╚═╝     ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═╝╚═════╝ 
                                                              
             Advanced Technology Solutions Worldwide
```

---

## 📚 **About This Learning Resource**

This comprehensive learning resource provides **two complete tutorials** for mastering Model Context Protocol (MCP) development with Rust. From beginner-friendly introductions to production-ready enterprise applications, these tutorials guide you through every aspect of building robust MCP servers.

**Published by:** [Remolab](https://remolab.ai) - Advanced Technology Solutions  
**Author:** **Hamze Ghalebi**, CTO at Remolab  
**Experience:** 20+ years in Rust programming and international software education

---

## 🎯 **Why Two Tutorial Versions?**

We've created two distinct learning paths to serve different audiences and learning preferences:

### 📖 **Version 1: Technical Reference Guide**
**File:** `mcp_rust_tutorial.md`

**Perfect for:**
- Experienced developers seeking comprehensive technical documentation
- Teams implementing MCP in production environments
- Developers who prefer detailed code examples and API references

**Key Features:**
- **20 Complete Working Examples** - From Hello World to Enterprise Systems
-**3,000+ Lines of Production Code** - Real, tested implementations
-**Comprehensive Rust Concepts** - Advanced patterns and best practices
-**External Learning Resources** - 130+ curated links and references
-**Production Deployment** - CI/CD, Docker, monitoring, and scaling
-**Industry Best Practices** - Security, performance, and maintainability

**Example Projects Include:**
- Basic MCP servers (Hello World, Calculator, Text Processor)
- Real-world applications (Database integration, File operations, WebSocket servers)
- Advanced systems (Task queues, Authentication, Notification services)
- Enterprise solutions (Search engines, Blockchain integration, ML model servers)

### 🌍 **Version 2: International Teaching Guide**
**File:** `mcp_rust_tutorial_international.md`

**Perfect for:**
- International learners and non-native English speakers
- Beginners new to Rust or MCP development
- Students seeking structured, step-by-step learning
- Educators teaching Rust and MCP concepts

**Key Features:**
- **Clear International English** - Accessible to global learners
-**Structured Learning Path** - Organized by skill level and time commitment
-**Teaching Methodology** - 20 years of educational experience applied
-**Step-by-Step Instructions** - Detailed explanations for every concept
-**Cultural Sensitivity** - Examples and language suitable for global audiences
-**Visual Learning Aids** - Emojis, diagrams, and progress tracking

**Learning Journey:**
```
📚 Foundation (30 minutes)    → Core concepts and setup
🏗️  Basic Practice (2 hours)   → First working MCP server
⚙️  Intermediate (3 hours)     → Real-world applications
🚀 Advanced (4 hours)         → Production-grade systems
🌍 Deployment (1 hour)        → Global deployment strategies
```

---

## 🚀 **Getting Started**

### Prerequisites
- **Rust 1.70+** installed ([Installation Guide]https://rustup.rs/)
- **Basic terminal/command line** knowledge
- **Text editor or IDE** (VS Code recommended with rust-analyzer)

### Quick Start (Choose Your Path)

**Option 1: Install from crates.io (Recommended)**
```bash
# Add as dependency in your Cargo.toml
[dependencies]
mcp_rust_examples = "0.1.0"

# Or install binaries globally
cargo install mcp_rust_examples

# Run examples directly
example_01_hello_world
example_02_calculator
```

**Option 2: Clone and Build (Development)**
```bash
# Clone the repository
git clone https://github.com/RustSandbox/MCP-Development-with-Rust
cd MCP-Development-with-Rust

# Run any of the 20 working examples
cargo run --bin example_01_hello_world
cargo run --bin example_13_auth_service
cargo run --bin example_20_enterprise_server

# Follow the technical reference guide
open mcp_rust_tutorial.md
```

**Option 3: Learning-Oriented Approach**
```bash
# Start with the international teaching guide
open mcp_rust_tutorial_international.md

# Follow the structured learning path
cargo new mcp_learning_project
cd mcp_learning_project
# Continue with Chapter 2 of the international guide
```

---

## 📁 **Project Structure**

```
mcp-rust-tutorial/
├── 📚 Learning Materials
│   ├── mcp_rust_tutorial.md              # Technical Reference Version
│   ├── mcp_rust_tutorial_international.md # International Teaching Version
│   └── README.md                          # This overview
│
├── 🛠️ Working Examples (20 Complete Projects)
│   ├── src/examples/
│   │   ├── example_01_hello_world.rs     # Basic MCP server
│   │   ├── example_02_calculator.rs      # Error handling patterns
│   │   ├── example_05_resource_provider.rs # MCP resources
│   │   ├── example_09_database.rs        # Database integration
│   │   ├── example_12_task_queue.rs      # Async programming
│   │   ├── example_13_auth_service.rs    # Authentication systems
│   │   └── example_20_enterprise_server.rs # Complete enterprise app
│   │
├── ⚙️ Development Tools
│   ├── justfile                          # 50+ development commands
│   ├── .github/workflows/                # Complete CI/CD pipeline
│   ├── Cargo.toml                        # Dependencies and configuration
│   └── Cargo.lock                        # Locked dependency versions
│
└── 📖 Documentation
    ├── docs/                             # Additional documentation
    └── examples/                         # Usage examples
```

---

## 🌟 **Key Features & Learning Outcomes**

### What You'll Master

**🔧 MCP Protocol Fundamentals**
- Understanding Tools, Resources, Prompts, and Sampling
- JSON-RPC communication patterns
- Client-server architecture design
- Protocol specification compliance

**🦀 Advanced Rust Programming**
- Ownership, borrowing, and lifetimes
- Error handling with Result types
- Async programming with Tokio
- Generic programming and trait bounds
- Memory safety and performance optimization

**🏭 Production-Ready Development**
- Database integration (SQLx, migrations, transactions)
- Authentication and security patterns
- Monitoring and observability
- Testing strategies and CI/CD
- Docker deployment and scaling

**🌍 International Best Practices**
- Code that works globally (UTC timestamps, i18n considerations)
- Clear error messages and documentation
- Cultural sensitivity in development
- Accessible learning methodologies

---

## 📊 **Tutorial Comparison**

| Feature | Technical Reference | International Teaching |
|---------|-------------------|----------------------|
| **Target Audience** | Experienced Developers | Global Learners |
| **Language Style** | Technical, Precise | Clear, Accessible |
| **Code Examples** | 20 Complete Projects | Step-by-Step Builds |
| **External Resources** | 130+ Links | Curated Global Resources |
| **Learning Structure** | Reference-Based | Structured Progression |
| **Time Investment** | Self-Paced | 11 Hours Total |
| **Prerequisites** | Rust Knowledge | Beginner-Friendly |
| **Use Case** | Production Implementation | Learning & Education |

---

## 🔧 **Installation Options**

This crate provides educational Rust examples for MCP development:

**Simple Installation:**
```toml
[dependencies]
mcp_rust_examples = "0.1.0"  # Educational examples with all dependencies
```

**Global Binary Installation:**
```bash
# Install all example binaries globally
cargo install mcp_rust_examples

# Run any example
example_01_hello_world
example_13_auth_service
example_20_enterprise_server
```

**Development Setup:**
```bash
# For development and extending examples
git clone https://github.com/RustSandbox/MCP-Development-with-Rust
cd MCP-Development-with-Rust
cargo build --all

# Run examples locally
cargo run --bin example_01_hello_world
```

**Note:** For full MCP SDK integration in your own projects, see the [official rmcp documentation](https://hackmd.io/@Hamze/S1tlKZP0kx).

## 🛠️ **Development Commands**

We provide a comprehensive development environment with 50+ commands via [just](https://github.com/casey/just):

```bash
# Quick development
just run example_01              # Run specific example
just test                        # Run all tests
just quality                     # Code formatting and linting

# Learning and exploration
just demo                        # Run all demos
just docs                        # Generate documentation
just examples                    # List all available examples

# Production readiness
just build-release               # Optimized builds
just security-audit              # Security vulnerability scan
just benchmark                   # Performance benchmarking
```

---

## 🎓 **Educational Philosophy**

**Hamze Ghalebi's Teaching Approach:**

With over 20 years of experience teaching Rust to international audiences, this resource embodies proven educational principles:

- **Progressive Complexity**: Start simple, build systematically
- **Practical Application**: Every concept demonstrated with real code
- **Cultural Sensitivity**: Examples and language accessible globally
- **Industry Relevance**: Patterns used in production environments
- **Community Focus**: Connecting learners with the broader ecosystem

**International Accessibility:**
- Clear, concise English suitable for non-native speakers
- Universal examples that translate across cultures
- Global deployment and timezone considerations
- Links to multilingual resources and communities

---

## 🏢 **About Remolab**

**Remolab** is a leading technology company specializing in advanced software solutions and international developer education. Our mission is to make cutting-edge technology accessible to developers worldwide.

**Our Focus Areas:**
- 🤖 **AI and Machine Learning Integration**
- 🌐 **Distributed Systems Architecture**
- 🔐 **Security and Blockchain Technologies**
- 📚 **Developer Education and Training**
- 🌍 **International Technology Adoption**

**Global Reach:** Serving clients and students across 40+ countries with culturally-sensitive, technically excellent solutions.

---

## 👨‍💻 **About the Author**

**Hamze Ghalebi**  
*Chief Technology Officer, Remolab*



**Connect:**
- GitHub: [hghalebi]https://github.com/hghalebi
- LinkedIn: [Hamze Ghalebi]https://www.linkedin.com/in/hamze/
- X (Twitter): [@hamzeml]https://x.com/Hamzeml
- Email: hamze@remolab.ai

---

## 📦 **Publishing & Releases**

This project uses automated publishing to crates.io via GitHub Actions:

**Automated Release Process:**
1. **Tag a Release**: `git tag v0.1.0 && git push origin v0.1.0`
2. **GitHub Actions Triggers**: Automatically builds and tests
3. **Multi-Platform Binaries**: Creates binaries for Linux, macOS, Windows
4. **Crates.io Publishing**: Publishes to crates.io with `examples-only` feature
5. **GitHub Release**: Creates release with binaries and checksums

**Release Workflow:**
- **CI/CD Pipeline**: Full testing and building
-**Cross-Platform Builds**: Linux x64, macOS x64/ARM64, Windows x64
-**Automatic Publishing**: Publishes to crates.io on tag
-**Binary Distribution**: Ready-to-use binaries for all platforms
-**Checksums**: SHA256 verification for security

**Version Management:**
```bash
# Create a new release
git tag v0.2.0
git push origin v0.2.0

# The workflow automatically:
# 1. Builds binaries for all platforms
# 2. Publishes to crates.io
# 3. Creates GitHub release with assets
# 4. Generates checksums for verification
```

**Crates.io Badge:** [![Crates.io](https://img.shields.io/crates/v/mcp_rust_examples)](https://crates.io/crates/mcp_rust_examples)

## 🤝 **Contributing**

We welcome contributions from the global community! This project thrives on diverse perspectives and experiences.

### How to Contribute

**For Technical Improvements:**
- 🐛 Bug fixes and performance optimizations
- 📚 Additional examples and use cases
- 🔧 Development tooling enhancements
- 🧪 Testing and validation improvements

**For Educational Content:**
- 🌍 Translation and localization support
- 📖 Additional learning resources and links
- 🎯 Beginner-friendly explanations
- 💡 Real-world use case examples

**For International Accessibility:**
- 🗣️ Language clarity improvements
- 🌐 Cultural sensitivity enhancements
- 📱 Accessibility features
- 🎨 Visual learning aids

### Contribution Process

1. **Fork** the repository
2. **Create** a feature branch with a descriptive name
3. **Follow** our coding standards and documentation style
4. **Test** your changes thoroughly
5. **Submit** a pull request with clear description
6. **Engage** with review feedback constructively

### Code of Conduct

We maintain a welcoming, inclusive environment for all contributors, regardless of:
- Geographic location or nationality
- Native language or English proficiency
- Technical experience level
- Cultural background

---

## 📄 **License**

This educational resource is released under the **MIT License**, promoting global accessibility and educational use.

**You are free to:**
- ✅ Use in educational institutions worldwide
- ✅ Adapt for local learning contexts
- ✅ Translate into other languages
- ✅ Use in commercial training programs
- ✅ Distribute and share freely

**We ask that you:**
- 📝 Maintain attribution to the original authors
- 🔄 Contribute improvements back to the community
- 🌍 Respect the international accessibility focus
- 📚 Support the global learning mission

---

## 🔗 **External Resources**

### Official Documentation
- [MCP Specification]https://spec.modelcontextprotocol.io/ - Official protocol specification
- [Rust Programming Language]https://doc.rust-lang.org/book/ - Available in multiple languages
- [Tokio Documentation]https://tokio.rs/ - Async runtime guide

### Community and Learning
- [A Coder's Guide to rmcp]https://hackmd.io/@Hamze/S1tlKZP0kx - Comprehensive rmcp toolkit guide
- [Rust Learning Resources]https://github.com/ctjhoa/rust-learning - Curated international resources
- [This Week in Rust]https://this-week-in-rust.org/ - Weekly community updates

### Development Tools
- [Rust Playground]https://play.rust-lang.org/ - Online Rust environment
- [Rustlings]https://github.com/rust-lang/rustlings - Interactive exercises
- [Exercism Rust Track]https://exercism.org/tracks/rust - Practice with mentorship

---

## 📞 **Support & Contact**

**For Learning Support:**
- 💬 **Community Discussion**: [GitHub Discussions]../../discussions
- 📖 **Documentation Issues**: [GitHub Issues]../../issues

---

## 🌟 **Acknowledgments**

Special thanks to the global Rust and MCP communities whose feedback, contributions, and diverse perspectives have shaped this learning resource. This tutorial exists because of the collaborative spirit of developers worldwide who believe in accessible, high-quality education.

**International Contributors:**
- Reviewers from 15+ countries who provided cultural and linguistic feedback
- Beta testers who validated examples across different environments
- Translators and localization specialists
- Educators who tested the curriculum in real classroom settings

**Technical Contributors:**
- Rust core team for their excellent documentation and tools
- MCP specification authors for creating a robust protocol
- Open source library maintainers whose work enables these examples
- CI/CD and deployment specialists who enhanced our development workflow

---

**Ready to start learning?** Choose your path and begin building amazing MCP applications with Rust! 🚀

**[Start with Technical Reference →](mcp_rust_tutorial.md)**  
**[Start with International Guide →](mcp_rust_tutorial_international.md)**