| Crates.io | mcp-diesel-proto-generator |
| lib.rs | mcp-diesel-proto-generator |
| version | 1.0.1 |
| created_at | 2025-07-13 01:30:40.267477+00 |
| updated_at | 2025-07-16 16:04:26.953324+00 |
| description | A Model Context Protocol (MCP) server that generates Protocol Buffer definitions from Diesel schemas |
| homepage | |
| repository | https://github.com/kashanalikhalid/mcp-diesel-proto-generator |
| max_upload_size | |
| id | 1749881 |
| size | 42,781 |
A standalone Model Context Protocol (MCP) server that generates Protocol Buffer (.proto) files from Diesel schema content. This allows Claude to generate protobuf definitions directly from Diesel table! macro definitions.
Install from Crates.io (Recommended):
cargo install mcp-diesel-proto-generator
The binary will be installed to ~/.cargo/bin/mcp-diesel-proto-generator.
Build from Source:
git clone <repository-url>
cd mcp-diesel-proto-generator
cargo build --release
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"proto-generator": {
"command": "/Users/yourusername/.cargo/bin/mcp-diesel-proto-generator",
"args": []
}
}
}
Important: Replace /Users/yourusername with your actual home directory path, or use the full path where the binary is installed.
Once configured, you can use the following commands in Claude:
Generate a proto file from this Diesel schema:
table! {
users (id) {
id -> Integer,
email -> Text,
name -> Nullable<Text>,
created_at -> Timestamp,
is_active -> Bool,
}
}
table! {
posts (id) {
id -> Integer,
user_id -> Integer,
title -> Text,
content -> Nullable<Text>,
published_at -> Nullable<Timestamp>,
}
}
Generate a proto file with package name "blog" from this schema:
[your schema here]
The MCP server maps Diesel types to protobuf types as follows:
| Diesel Type | Protobuf Type |
|---|---|
| Integer | int32 |
| BigInt | int64 |
| SmallInt | int32 |
| Float | float |
| Double, Numeric | double |
| Bool | bool |
| Text, VarChar, Char | string |
| Uuid | string |
| Timestamp, Timestamptz | Timestamp |
| Date, Time, Timetz | string |
| Json, Jsonb | string |
| Binary, Bytea | bytes |
| Nullable |
optional Type |
| Array |
repeated Type |
The generated proto files include:
For a users table, the generator creates:
Users message (entity)CreateUsersRequest/ResponseGetUsersRequest/ResponseUpdateUsersRequest/ResponseDeleteUsersRequest/Responseclaude_desktop_config.json is absolute and correctcargo install, the binary should be at ~/.cargo/bin/mcp-diesel-proto-generatortable! macro definitionscolumn_name -> Type,chmod +x target/release/mcp-proto-generatorYou can test the MCP server with the provided example schema:
cat example_schema.rs | ./target/release/mcp-proto-generator
To modify or extend the MCP server:
src/main.rscargo build --releaseThis project is provided as-is for educational and development purposes.