Простота использования
Удобные эргономичные API — одна библиотека для создания MCP-клиентов и серверов.
Полный набор возможностей
Neva предоставляет богатый набор функций из коробки: потоковый HTTP, TLS, трассировка, OAuth и многое другое.
На базе Rust
Молниеносная скорость, типобезопасность и асинхронность по умолчанию.
Привет от MCP-инструмента
Создайте MCP-сервер и добавьте свой первый инструмент всего за несколько строк.
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;
}
Мощь промптов
Создавайте гибкие промпты с лёгкостью.
#[prompt(descr = "Generates a user message requesting a code generation.")]
async fn hello_world_code(lang: String) -> PromptMessage {
PromptMessage::user()
.with(format!("Write a hello-world function on {lang}"))
}
Простота ресурсов
Предоставляйте ресурсы через интуитивные API. Создавайте переиспользуемые шаблоны ресурсов для максимальной гибкости.
#[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}"))
}
Гибкий MCP-клиент
Интуитивный API с простой настройкой и удобным взаимодействием с MCP-серверами.
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