| Crates.io | techne |
| lib.rs | techne |
| version | 0.1.0-dev.2 |
| created_at | 2025-06-30 16:29:44.192651+00 |
| updated_at | 2025-08-02 00:12:05.283201+00 |
| description | A simple MCP implementation for Rust |
| homepage | |
| repository | https://github.com/hecrj/techne |
| max_upload_size | |
| id | 1732073 |
| size | 56,087 |
2025-06-18)Very experimental! Only the tools capability is currently supported.
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}!")
}
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(())
}