Skip to main content

Neva MCP SDK

Blazingly fast, easily configurable and extremely powerful Model Context Protocol (MCP) server and client SDK for Rust.

Easy to Use

Easily configurable ergonomic APIs - one library to build both MCP clients and servers.

Feature Full-House

Neva provides a rich feature list out of the box. Streamable HTTP, TLS, tracing, OAuth and many more.

Powered by Rust

Blazingly fast, type safe and asynchronous by design.

Hello from MCP Tool

Create an MCP server and add your first tool in just a few lines.

use neva::prelude::*;

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

#[tokio::main]
async fn main() {
App::new()
.with_options(|opt| opt.with_stdio())
.run()
.await;
}

Power of Prompts

Define rich, flexible prompts with ease.

#[prompt(descr = "Analyze code for potential improvements")]
async fn analyze_code(lang: String) -> PromptMessage {
// Do the analysis ...
PromptMessage::user()
.with(format!("Language: {lang}"))
}

Resources Made Simple

Expose resources with intuitive APIs. Design reusable resource templates for ultimate flexibility.

#[resources]
async fn list_resources(_: ListResourcesRequestParams) -> Vec<Resource> {
// Read a list of resources from some source
let resources = vec![
Resource::new("res://res1", "resource 1")
.with_descr("A test resource 1")
.with_mime("text/plain"),
Resource::new("res://res2", "resource 2")
.with_descr("A test resource 2")
.with_mime("text/plain"),
];
resources
}

#[resource(
uri = "res://{name}",
mime = "text/plain"
)]
async fn get_res(name: String) -> TextResourceContents {
// Read resource from from some source

TextResourceContents::new(
format!("res://{name}"),
format!("Some details about resource: {name}"))
}

Flexible MCP Client

An intuitive API with effortless configuration and smooth interaction with MCP servers.

let mut client = Client::new()
.with_options(|opt| opt
.with_stdio("cargo", ["run", "greeting-server"]));

client.connect().await?;

let args = ("name", "John");
let result = client.call_tool("hello", args).await?;

// Prints: "Hello John!"
println!("{:?}", result.content);
client.disconnect().await