Token导航 LogoToken导航TokenDH.com
kuri (Itsaphel) logo
开发工具stdio官方级别未说明来源级核验

kuri (Itsaphel)

MCP Server

kuri是一个专注于开发者体验和清晰性的框架,用于构建Model Context Protocol (MCP)服务器,使LLM能够执行预定义的功能。

工具数

1

提示词数

0

GitHub Stars

12

资源数

0
Rust开发工具LLM工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

itsaphel

提供方

itsaphel

最后核验

2026/5/17 20:34

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

kuri (板栗or 栗子)

kuri 是一个需要构建的框架 模型上下文协议 (MCP)服务器,专注于开发人员人体工程学和清晰度。

![Build status](https://github.com/itsaphel/kuri/actions/workflows/ci.yml) ![Crates.io](https://crates.io/crates/kuri) ![Documentation](https://docs.rs/kuri)

MCP允许LLM执行预定义的功能(称为“工具”),这允许它获取数据并产生副作用(即:与外界交互)。LLM只需要提供函数的输入参数,然后执行函数并将响应返回给模型。这些工具由“MCP服务器”提供,可以在本地运行,单个服务器可以提供多个工具。

设计理念

Rust是一种编写可靠MCP服务器的优秀语言,具有强大的类型系统和正确性保证。 kuri 旨在使在Rust中进行MCP服务器编程变得非常愉快,以方便使用Rust构建MCP服务器。我们的设计目标是:

  • 符合人体工程学的开发人员体验: MCP服务器编程应该感觉像正常的Rust编程。工具和提示只是普通的异步Rust函数。
  • 尽量减少宏的使用 (#[tool], #[prompt]):仅用于附加工具和参数描述,不用于复杂的代码生成。
  • 最低样板: 专注于应用程序逻辑,而不是串行化或MCP协议路由。

以上是我们与其他MCP服务器机箱的区别。我们专注于做一件事,而且做得很好。而且没有神奇的复杂宏,你的应用程序代码仍然不言自明 kuri的内部结构清晰易读。 kuri 也建立在 tower,允许您重用丰富的中间件和层生态系统。

示例

use kuri::{MCPServiceBuilder, ServiceExt, ToolError, prompt, serve, tool, transport::StdioTransport};
use schemars::JsonSchema;
use serde::Deserialize;

#[derive(Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub enum Operation {
    Add,
    Subtract,
    Multiply,
    Divide,
}

// A pure function that takes three inputs and returns an integer. Descriptions
// for the tool and its parameters help the model decide which tool to use, and
// correctly supply the tool's parameters.
#[tool(
    description = "Perform basic arithmetic operations",
    params(
        x = "First number in the calculation",
        y = "Second number in the calculation",
        operation = "The operation to perform (add, subtract, multiply, divide)"
    )
)]
async fn calculator(x: i32, y: i32, operation: Operation) -> Result {
    match operation {
        Operation::Add => Ok(x + y),
        Operation::Subtract => Ok(x - y),
        Operation::Multiply => Ok(x * y),
        Operation::Divide => {
            if y == 0 {
                Err(ToolError::ExecutionError("Division by zero".to_string()))
            } else {
                Ok(x / y)
            }
        }
    }
}

// Creates a prompt template for text summarisation. The application provides
// the text to summarise, and an optional format parameter (denoted using Rust's
// `Option` type). kuri tells the model that `format` may be omitted.
#[prompt(
    description = "Generates a prompt for summarising text",
    params(
        text = "The text to summarise",
        format = "Optional format for the summary (eg: 'bullet points' or 'Shakespeare')"
    )
)]
async fn summarise_text(text: String, format: Option) -> String {
    let format_instruction = match format {
        Some(f) => format!(" in the format of {}", f),
        None => String::new(),
    };

    format!(
        "Please summarize the following text{}:\n\n{}",
        format_instruction, text
    )
}

#[tokio::main]
async fn main() -> Result {
    // Create the MCP service with the server's name
    let service = MCPServiceBuilder::new("kuri's test server".to_string())
        // Register the tool and prompt
        .with_tool(Calculator)
        .with_prompt(SummariseText)
        .build();

    // Serve over the stdio transport
    serve(service.into_request_service(), StdioTransport::new()).await
}

更多内容 示例

要开始,请添加 kuri 以及一些必要的依赖关系 Cargo.toml:

[dependencies]
kuri = "0.1"
async-trait = "0.1"
schemars = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }

MCP规范支持

  • \[x\] 核心生命周期:连接初始化、能力协商和会话控制
  • \[x\] 工具:功能完整,带有测试
  • \[x\] 提示:基本完成测试
  • \[\]资源
  • 运输

- \[x\] stdin/stdout - \[\]流式HTTP(2025-03-26 协议)

  • 额外(可选)功能

- \[ \] 补全 - \[ \] 分页

我们目前的优先事项是增加HTTP传输支持,稳定API,并确保对核心规范的全面支持。

贡献

这个项目的目标是为构建MCP服务器构建一个令人愉快、符合人体工程学、符合习惯的Rust库。它还处于早期阶段,因此结构仍有可能发生变化。如果你喜欢Rust、MCP、构建板条箱或网络协议中的任何一种(也许你喜欢 原黑客!),我们很想有你!参与回购,或 通过电子邮件联系 如果你想聊天!

如果你在项目中使用过这个框架:谢谢你尝试!我很想听听你的经历!

目录标签

目录标签

Rust开发工具LLM工具MCP服务器本地部署Rust框架开发者工具函数执行

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP