Skip to main content

Crate a2c_smcp

Crate a2c_smcp 

Source
Expand description

§A2C-SMCP Rust SDK

A Rust implementation of the A2C-SMCP protocol, providing Agent, Computer, and Server components for building intelligent agent systems with tool execution capabilities.

§Features

  • agent - Agent client implementation for connecting to SMCP servers
  • computer - Computer client implementation for managing MCP servers and desktop resources
  • server - Server implementation with Socket.IO support
  • full - Enables all features (default when using --all-features)

§Quick Start

Add to your Cargo.toml:

[dependencies]
a2c-smcp = { version = "0.1.0", features = ["agent", "computer"] }

§Example

// Add features to your Cargo.toml:
// a2c-smcp = { version = "0.1.0", features = ["agent", "computer"] }

#[cfg(feature = "agent")]
use a2c_smcp::agent::SmcpAgent;

#[cfg(feature = "computer")]
use a2c_smcp::computer::SmcpComputer;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Your SMCP application code here
    Ok(())
}

Re-exports§

pub use serde;
pub use serde_json;
pub use thiserror;
pub use tokio;
pub use tracing;

Modules§

error_codes
标准错误码模块 / Standard error codes module
events
SMCP事件常量定义

Structs§

AgentCallData
代理调用数据(基类)
EnterOfficeNotification
进入办公室通知
EnterOfficeReq
进入办公室请求
ErrorDetail
错误详情结构 / Error detail structure
ErrorResponse
标准错误响应格式 / Standard error response format 格式: { “error”: { “code”: i32, “message”: str, “details”: object? } }
GetComputerConfigReq
获取计算机配置请求
GetComputerConfigRet
获取计算机配置返回
GetDesktopReq
获取桌面请求
GetDesktopRet
获取桌面返回
GetToolsReq
获取工具请求
GetToolsRet
获取工具返回
LeaveOfficeNotification
离开办公室通知
LeaveOfficeReq
离开办公室请求
ListRoomReq
列出房间请求
ListRoomRet
列出房间返回
ReqId
请求ID,使用UUID确保全局唯一性
SMCPTool
SMCP工具定义
SessionInfo
会话信息
ToolCallReq
工具调用请求
ToolCallRet
工具调用返回(符合 MCP CallToolResult 标准)
UpdateComputerConfigReq
更新计算机配置请求
UpdateMCPConfigNotification
更新MCP配置通知
UpdateToolListNotification
更新工具列表通知
UserInfo
用户信息

Enums§

Notification
通知类型枚举
Role
角色类型

Constants§

SMCP_NAMESPACE
SMCP协议的命名空间

Type Aliases§

Desktop
桌面类型别名