| Crates.io | mcpkit-client |
| lib.rs | mcpkit-client |
| version | 0.5.0 |
| created_at | 2025-12-11 17:11:27.837298+00 |
| updated_at | 2025-12-26 00:54:57.787897+00 |
| description | Client implementation for mcpkit |
| homepage | |
| repository | https://github.com/praxiomlabs/mcpkit |
| max_upload_size | |
| id | 1980149 |
| size | 130,009 |
Client implementation for the Model Context Protocol (MCP).
This crate provides the client-side implementation including a fluent client API, server discovery, and connection pooling.
The MCP client allows AI applications to:
use mcpkit_client::ClientBuilder;
use mcpkit_transport::SpawnedTransport;
#[tokio::main]
async fn main() -> Result<(), mcpkit_core::error::McpError> {
// Spawn an MCP server as a subprocess
let transport = SpawnedTransport::spawn("my-mcp-server", &[] as &[&str]).await?;
let client = ClientBuilder::new()
.name("my-client")
.version("1.0.0")
.build(transport)
.await?;
// List available tools
let tools = client.list_tools().await?;
// Call a tool
let result = client.call_tool("add", serde_json::json!({
"a": 1,
"b": 2
})).await?;
Ok(())
}
Discover MCP servers from configuration:
use mcpkit_client::ServerDiscovery;
let discovery = ServerDiscovery::new();
discovery.register("my-server", config);
let server = discovery.get("my-server");
Manage multiple client connections:
use mcpkit_client::{ClientPool, PoolConfig};
let pool = ClientPool::builder()
.max_connections(10)
.build();
Handle server-initiated requests by implementing ClientHandler:
use mcpkit_client::ClientHandler;
struct MyHandler;
impl ClientHandler for MyHandler {
// Handle sampling requests, elicitation, etc.
}
This crate is part of the mcpkit SDK. For most use cases, depend on mcpkit directly rather than this crate.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.