Model Context Protocol (MCP) Rust Schema
A Rust implementation of the Model Context Protocol (MCP) schema, providing type definitions and validation for MCP messages.
Features
- 🔍 Complete type definitions for MCP messages and data structures
- 🚀 JSON-RPC 2.0 message schema support
- ✅ Schema validation against the MCP specification
- 📦 Serialization/deserialization support via serde
Installation
Add this to your Cargo.toml:
[]
= "0.1.4"
Usage
Basic Message Creation
use ;
use RequestMeta;
use json;
// Create a new request
let request = new;
Schema Validation
use Resource;
use json;
use Validator;
// Create a resource
let resource = Resource ;
// Validate against schema
let resource_json = to_value?;
let validator = validator_for?;
assert!;
Error Handling
The library provides comprehensive error handling:
use Error;
match result
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request