cflaig/simple_mcp_server
If you are the rightful owner of simple_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A simple File System MCP Server implementation using the Rust MCP SDK, providing file system operations through a standardized interface.
Simple MCP Server
A simple File System MCP (Model-Conext-Protocol) Server implementation using the Rust MCP SDK. This server provides file system operations through a standardized interface.
Features
- HTTP server running on localhost:8080
- Server-Sent Events (SSE) for real-time communication
- File system operations:
- Directory listing with customizable options
- File content reading
- Asynchronous request handling with tokio
- Comprehensive logging with tracing
Requirements
- Rust (latest stable version recommended)
- Cargo (comes with Rust)
Installing Rust
On macOS, Linux, or Unix-like systems:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Alternatively, you can use a package manager such as brew, pacman, or similar:
- macOS:
brew install rustup - Arch-based Linux distributions:
sudo pacman -S rustup
On Windows:
- Download the Rust installer from https://www.rust-lang.org/tools/install
- Run the installer and follow the on-screen instructions
Verifying the installation:
After installation, restart your terminal and run:
rustc --version
cargo --version
Both commands should display version information, confirming that Rust and Cargo are properly installed.
Building and Running the Server
Clone the repository:
git clone https://github.com/cflaig/simple_mcp_server
cd simple_mcp_server
Build the project:
cargo build
For a release build with optimizations:
cargo build --release
Run the server:
cargo run
For a release build:
cargo run --release
The server will start on 127.0.0.1:8080 by default.
Usage Examples
The server provides two main tools:
1. List Directory Contents
This tool executes the ls command with customizable options.
Example request parameters:
{
"path": "/path/to/directory",
"args": "-la"
}
2. Read File Contents
This tool reads and returns the contents of a specified file.
Example request parameters:
{
"path": "/path/to/file.txt"
}
Development
Environment Variables
RUST_LOG: Controls the logging level (e.g.,info,debug,trace)
Example:
RUST_LOG=debug cargo run
Project Structure
src/main.rs: Server initialization and configurationsrc/handler.rs: Request handling implementationsrc/tools.rs: File system tools implementation