Crates.io | neva |
lib.rs | neva |
version | |
source | src |
created_at | 2025-04-07 15:13:50.115375+00 |
updated_at | 2025-05-07 15:16:47.199501+00 |
description | MCP SDK for Rust |
homepage | |
repository | https://github.com/RomanEmreis/neva |
max_upload_size | |
id | 1624349 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Easy configurable MCP server and client SDK for Rust
💡 Note: This project is currently in preview. Breaking changes can be introduced without prior notice.
[dependencies]
neva = { version = "0.0.8", features = ["client-full"] }
tokio = { version = "1", features = ["full"] }
use std::time::Duration;
use neva::Client;
use neva::error::Error;
#[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
let tools = client.list_tools(None).await?;
for tool in tools.tools {
println!("- {}", tool.name);
}
// Call a tool
let args = [
("message", "Hello MCP!")
];
let result = client.call_tool("echo", Some(args)).await?;
println!("{:?}", result.content);
client.disconnect().await
}
[dependencies]
neva = { version = "0.0.8", features = ["server-full"] }
tokio = { version = "1", features = ["full"] }
use neva::{App, tool, resource, prompt};
#[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) -> (String, String) {
(
format!("res://{name}"),
format!("Some details about resource: {name}")
)
}
#[prompt(descr = "Analyze code for potential improvements")]
async fn analyze_code(lang: String) -> (String, String) {
(format!("Language: {lang}"), "user".into())
}
#[tokio::main]
async fn main() {
let mut app = App::new()
.with_options(|opt| opt
.with_stdio()
.with_name("Sample MCP server")
.with_version("1.0.0"));
map_hello(&mut app);
map_get_res(&mut app);
map_analyze_code(&mut app);
app.run().await;
}