poem-mcpserver 0.1.6

This commit is contained in:
Sunli
2025-03-20 08:15:36 +08:00
parent 661ac87db8
commit 1acf0c7541
5 changed files with 39 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ poem = { path = "poem", version = "3.1.7", default-features = false }
poem-derive = { path = "poem-derive", version = "3.1.4" }
poem-openapi-derive = { path = "poem-openapi-derive", version = "5.1.8" }
poem-grpc-build = { path = "poem-grpc-build", version = "0.5.2" }
poem-mcpserver-macros = { path = "poem-mcpserver-macros", version = "0.1.5" }
poem-mcpserver-macros = { path = "poem-mcpserver-macros", version = "0.1.6" }
proc-macro-crate = "3.0.0"
proc-macro2 = "1.0.29"

View File

@@ -1,6 +1,6 @@
[package]
name = "poem-mcpserver-macros"
version = "0.1.5"
version = "0.1.6"
authors.workspace = true
edition.workspace = true
license.workspace = true

View File

@@ -1,6 +1,6 @@
[package]
name = "poem-mcpserver"
version = "0.1.5"
version = "0.1.6"
authors.workspace = true
edition.workspace = true
license.workspace = true
@@ -10,7 +10,7 @@ repository.workspace = true
rust-version.workspace = true
readme = "README.md"
description = "MCP Server implementation for Poem"
keywords = ["framework", "async", "mcp", "ai", "Model-Context-Protocol"]
keywords = ["framework", "async", "mcp", "ai"]
categories = [
"network-programming",
"asynchronous",

View File

@@ -29,10 +29,19 @@ pub struct InitializeRequest {
pub client_info: ClientInfo,
}
/// A capability information.
/// Prompts capability.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Capability {
pub struct PromptsCapability {
/// Indicates whether the server will emit notifications when the list of
/// available prompts changes.
pub list_changed: bool,
}
/// Resources capability.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ResourcesCapability {
/// Indicates whether the server will emit notifications when the list of
/// available prompts changes.
pub list_changed: bool,
@@ -41,12 +50,25 @@ pub struct Capability {
pub subscribe: bool,
}
/// Tools capability.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ToolsCapability {
/// Indicates whether the server will emit notifications when the list of
/// available prompts changes.
pub list_changed: bool,
}
/// The server capabilities.
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerCapabilities {
/// The tools capability.
pub tools: Capability,
/// Prompts capability.
pub prompts: PromptsCapability,
/// Resources capability.
pub resources: ResourcesCapability,
/// Tools capability.
pub tools: ToolsCapability,
}
/// The server information.

View File

@@ -3,7 +3,8 @@ use serde_json::Value;
use crate::{
protocol::{
initialize::{
Capability, InitializeRequest, InitializeResponse, ServerCapabilities, ServerInfo,
InitializeRequest, InitializeResponse, PromptsCapability, ResourcesCapability,
ServerCapabilities, ServerInfo, ToolsCapability,
},
rpc::{Request, RequestId, Requests, Response},
tool::{ToolsCallRequest, ToolsListResponse},
@@ -58,10 +59,16 @@ where
result: Some(InitializeResponse {
protocol_version: MCP_PROTOCOL_VERSION,
capabilities: ServerCapabilities {
tools: Capability {
prompts: PromptsCapability {
list_changed: false,
},
resources: ResourcesCapability {
list_changed: false,
subscribe: false,
},
tools: ToolsCapability {
list_changed: false,
},
},
server_info: ServerInfo {
name: "poem-mcpserver".to_string(),