techne

Crates.iotechne
lib.rstechne
version0.1.0-dev.2
created_at2025-06-30 16:29:44.192651+00
updated_at2025-08-02 00:12:05.283201+00
descriptionA simple MCP implementation for Rust
homepage
repositoryhttps://github.com/hecrj/techne
max_upload_size
id1732073
size56,087
Héctor (hecrj)

documentation

README

Techne

Documentation Crates.io License Downloads Test Status

An MCP implementation for Rust focused on simplicity and type-safety.

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(())
}
Commit count: 0

cargo fmt