Development · MODEL CONTEXT PROTOCOL

neva

MCP server SDK for Rust

WHAT IT CONNECTS

What neva gives an AI Agent

The source catalog does not include a structured feature list. Review the repository documentation before use.

SECURITY

An MCP listing is not a security review

An MCP server may receive model context, credentials, local files, or permission to call external systems. Review its code, requested environment variables, network behavior, package provenance, and maintenance status before connecting it to an agent.

README

Repository documentation

Neva

Blazingly fast and easily configurable Model Context Protocol (MCP) server and client SDK for Rust. With simple configuration and ergonomic APIs, it provides everything you need to quickly build MCP clients and servers, fully aligned with the latest MCP specification.

latest latest License: MIT CI Release

💡 Note: This project is currently in preview. Breaking changes can be introduced without prior notice.

Tutorial | API Docs | Examples

Key Features

  • Client & Server SDK - one library to build both MCP clients and servers with the powers of Rust.
  • Performance - asynchronous and Tokio-powered.
  • Transports - stdio for local integrations and Streamable HTTP for remote, bidirectional communication.
  • Tools, Resources & Prompts - full-house support for defining and consuming the main MCP entities.
  • Async or sync handlers - write async fn when you await something, a plain fn when you don't. Add blocking when the body blocks, and it runs on Tokio's blocking pool instead of a runtime worker.
  • Authentication & Authorization - bearer token authentication, role-based access control, and more to fit high security standards.
  • Structured Data - output validation, embedded resources, and resource links out of the box.
  • Safe Multi Round-Trip Requests - a handler that asks the client for input mid-call re-runs from the top on every round, so neva owns the idempotency: ctx.memo computes once, ctx.once runs an effect once, ctx.on_commit defers it to the final result, and a lost response replays the committed answer instead of charging the card twice.
  • Confidential request state - the requestState blob that carries progress between rounds is sealed with ChaCha20-Poly1305, not merely signed, so what ctx.memo caches stays unreadable to the client that echoes it back.
  • Handing tools to a model - with the svir feature, an MCP server's tools become a svir Toolbox: a remote server's through RemoteTools, or a function written once with #[tool] called in the same process through the server's own pipeline. Prompts and resources become svir messages, and a server's sampling request is answered with a model.
  • Registry publishing - server.json for the MCP Registry is generated from what the server already knows: its version, its transport and the crate Cargo is building. The registry's limits are checked before the upload rather than by it.
  • Spec Alignment - designed to track the latest MCP specification and cover its core functionality.

Quick Start

MCP Client

Dependencies
[dependencies]
neva = { version = "0.7.1", features = ["client-full"] }
tokio = { version = "1", features = ["full"] }
Code
use neva::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Error> {
    let mut client = Client::new()
        .with_options(|opt| opt
            .with_stdio("npx", ["-y", "@modelcontextprotocol/server-everything"])
            .with_timeout(Duration::from_secs(5)));
    
    client.connect().await?;

    // List tools
    for tool in client.tools().list_all().await? {
        println!("- {}", tool.name);
    }

    // Call a tool
    let args = [
        ("message", "Hello MCP!")
    ];
    let result = client.tools().call("echo", args).await?;
    println!("{:?}", result.content);

    client.disconnect().await
}

MCP Server

Dependencies
[dependencies]
neva = { version = "0.7.1", features = ["server-full"] }
tokio = { version = "1", features = ["full"] }
Code
use neva::prelude::*;

#[tool(descr = "A say hello tool")]
async fn hello(name: String) -> String {
    format!("Hello, {name}!")
}

#[resource(uri = "res://{name}", descr = "Some details about resource")]
async fn get_res(name: String) -> ResourceContents {
    ResourceContents::new(format!("res://{name}"))
        .with_mime("plain/text")
        .with_text(format!("Some details about resource: {name}"))
}

// Nothing to await here, so a plain `fn` will do.
#[prompt(descr = "Analyze code for potential improvements")]
fn analyze_code(lang: String) -> PromptMessage {
    PromptMessage::user()
        .with(format!("Language: {lang}"))
}

#[tokio::main]
async fn main() {
    App::new()
        .with_options(|opt| opt
            .with_stdio()
            .with_name("Sample MCP server")
            .with_version("1.0.0"))
        .run()
        .await;
}
View README on GitHub

COMMUNITY

Save, rate, and discuss

Loading community data…