Project Goals
Combine efforts with Offical MCP Rust SDK. The offical SDK repo is new and collaborations are in works to bring these features to the adopted platform.
- Efficiency & Scalability
- Handles many concurrent connections with low overhead.
- Scales easily across multiple nodes.
- Security
- Strong authentication and authorization.
- Built-in rate limiting and quota management.
- Rust Advantages
- High performance and predictable latency.
- Memory safety with no runtime overhead.
Installation
Use the cargo add
command to automatically add it to your Cargo.toml
Or add mcp-core
to your Cargo.toml
dependencies directly
[]
= "0.1.0"
Server Implementation
Easily start your own local SSE MCP Servers with tooling capabilities
sse-server.rs
use ;
use json;
use Error;
async
Public SSE MCP Servers
If you want to expose this MCP Server publicly via a reverse proxy make sure you set the public_url
to your domain.
Host
SSE Server Authentication
Client connections are authenticated using JWT middleware via mcp_core::sse::middleware
. Enable this by setting the auth_config
of your server to include the secret to verify claims.
SSE Client Connection
Connect to an SSE MCP Server using the ClientSseTransport
. Here is an example of connecting to one and listing the tools from that server.
let transport = builder.build;
transport.open.await?;
let mcp_client = new;
let mcp_client_clone = mcp_client.clone;
spawn;
mcp_client
.initialize
.await?;
let tools = mcp_client.list_tools.await?.tools;
println!;
Setting SecureValues
to your SSE MCP Client
Have API Keys or Secrets needed to be passed to MCP Tool Calls, but you don't want to pass this information to the LLM you are prompting? Use mcp_core::client::SecureValue
!
.with_secure_value
.with_secure_value
.use_strict
.build
builder
mcp_core::client::SecureValue::Static
Automatically have MCP Tool Call Parameters be replaced by the string value set to it.
mcp_core::client::SecureValue::Env
Automatically have MCP Tool Call Parameters be replaced by the value in your .env
from the string set to it.
SSE MCP Client Tool Call
let response = mcp_client
.call_tool
.await?;
println!;