| Crates.io | bakkie |
| lib.rs | bakkie |
| version | 0.1.1 |
| created_at | 2025-08-12 13:02:28.149381+00 |
| updated_at | 2025-08-12 13:25:52.777411+00 |
| description | Simple MCP server framework for Rust |
| homepage | https://github.com/daniel-levin/bakkie |
| repository | https://github.com/daniel-levin/bakkie |
| max_upload_size | |
| id | 1791969 |
| size | 83,655 |
Bakkie is a framework for building Model Context Protocol (MCP) servers in Rust. MCP is a protocol that enables AI assistants to access external resources and tools through standardized server implementations. It is probably not necessary, but it has become pervasive.
use bakkie::{
App, McpServer, Provisions,
provisions::tools::{Result, ToolError},
};
use std::collections::HashMap;
#[derive(Debug, Default)]
pub struct MyApp {
invocations: usize,
}
/// Tabulates the characters that appear in the input for accurate counting.
#[bakkie::tool(title = "__count_letters")]
async fn count_letters(input: String) -> Result<HashMap<char, usize>> {
let mut res = HashMap::new();
for ch in input.chars() {
*res.entry(ch).or_insert(0) += 1;
}
Ok(res)
}
#[bakkie::structured]
#[derive(PartialEq, Eq)]
enum Progress {
Forward,
Backward,
}
/// Inform the user of some progress
#[bakkie::tool(title = "__inform_progress")]
async fn inform_progress(#[app] app: App<MyApp>, progress: Progress) -> Result<usize> {
let mut c = app.write().await;
if progress == Progress::Forward {
c.invocations += 1;
}
Ok(c.invocations)
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let provisions = Provisions::default();
provisions.insert_tool(count_letters).await;
provisions.insert_tool(inform_progress).await;
let server = McpServer::new_with_provisions_and_application(
bakkie::stdio(),
provisions,
MyApp::default(),
);
server.run().await?;
Ok(())
}
#[bakkie::tool] to define MCP tools with automatic JSON schema generation#[app] parameter#[bakkie::structured] for complex parametersLicense: Unlicense/MIT