4 releases
Uses new Rust 2024
| 0.1.0-dev.2 | Aug 2, 2025 |
|---|---|
| 0.1.0-dev.1 | Aug 1, 2025 |
| 0.0.0 | Jun 30, 2025 |
#1559 in Database interfaces
142 downloads per month
43KB
797 lines
Features
- Completely handmade!
- No macros!
- Coherent schemas enforced at the type level
- Stdio and Streamable HTTP transports
- Custom transports
- Latest protocol version (
2025-06-18)
Very experimental! Only the tools capability is currently supported.
Server
Create a Server, choose your desired transport, list your tools, and run:
use techne::Server;
use techne::server::Stdio;
use techne::server::tool::{tool, string};
use std::io;
#[tokio::main]
pub async fn main() -> io::Result<()> {
let server = Server::new("techne-server-example", env!("CARGO_PKG_VERSION"));
let transport = Stdio::current();
let tools = [
tool(say_hello, string("name", "The name to say hello to"))
.name("say_hello")
.description("Say hello to someone"),
];
server.tools(tools).run(transport).await
}
async fn say_hello(name: String) -> String {
format!("Hello, {name}!")
}
Client
Create a Client with your desired transport and query the server:
use techne::Client;
use techne::client::Stdio;
use techne::mcp::json;
use std::io;
#[tokio::main]
pub async fn main() -> io::Result<()> {
let transport = Stdio::run("cargo", ["run", "--example", "server"])?;
let mut client = Client::new(
"techne-client-example",
env!("CARGO_PKG_VERSION"),
transport,
)
.await?;
let tools = client.list_tools().await?;
let hello = client
.call_tool("say_hello", json!({ "name": "World" }))
.await?;
dbg!(tools);
dbg!(hello);
Ok(())
}
Dependencies
~0.8–15MB
~135K SLoC