mcp-tools

Crates.iomcp-tools
lib.rsmcp-tools
version0.1.0
created_at2025-06-25 21:37:05.768049+00
updated_at2025-06-25 21:37:05.768049+00
descriptionRust MCP tools library
homepagehttps://github.com/mexyusef/mcp-tools
repositoryhttps://github.com/mexyusef/mcp-tools
max_upload_size
id1726473
size368,699
Yusef Ulum (mexyusef)

documentation

https://docs.rs/mcp-tools

README

MCP Tools

Crates.io Documentation License

MCP Tools is a Rust library and server suite implementing the Model Context Protocol (MCP) with tools for Git operations, code analysis, web operations, and system management. Built on top of CoderLib and the official Rust MCP SDK, it provides MCP servers and clients for AI integration.

Why MCP Tools?

  • MCP Compliant - Built on official Rust MCP SDK for protocol compliance
  • Modular Design - Individual servers for specific tool categories
  • Docker Ready - Container images and docker-compose setup
  • Easy Integration - Library and standalone binary options
  • Rust Performance - Memory-safe, fast, and reliable implementation

MCP Server Suite

Git Tools Server (git-server)

Provides Git repository operations via MCP protocol:

  • git_status - Repository status including modified, added, deleted files
  • git_diff - File differences and change analysis
  • git_log - Commit history with filtering options
  • git_blame - Line-by-line authorship information
  • git_branches - Branch listing and information

Built with git2 library for robust Git operations.

Code Analysis Server (code-analysis-server)

Provides basic code analysis capabilities:

  • analyze_code - Basic code structure analysis
  • detect_language - Programming language detection from file content
  • complexity_analysis - Simple complexity metrics calculation
  • security_analysis - Basic security pattern detection

Currently supports: Rust, Python, JavaScript, TypeScript, Go, Java, C, C++ Uses tree-sitter for syntax parsing where available.

Web Tools Server (web-server)

Provides web operations via HTTP client:

  • http_request - HTTP requests (GET, POST, PUT, DELETE, PATCH)
  • analyze_webpage - Basic web page content extraction
  • analyze_url - URL structure parsing and validation
  • fetch_content - Content downloading with type detection

Built with reqwest for HTTP operations.

System Tools Server (system-server)

Provides system operations with safety controls:

  • execute_command - Shell command execution with filtering
  • get_system_info - Basic system information
  • get_environment - Environment variable access
  • get_processes - Process listing and information

Includes basic security filtering for command execution.

File Operations Server (file-operations-server)

Provides file system operations:

  • read_file - Read file contents
  • write_file - Write content to files
  • list_directory - Directory listing

Unified Server (mcp-server)

Combines all servers into a single process:

  • Selective Tools - Enable/disable specific tool categories via --tools flag
  • Single Process - All tools available through one server instance
  • Shared Configuration - Common configuration across all tools

CLI Client (mcp-cli)

Basic command-line client for testing and interaction:

  • Tool Execution - Direct tool invocation with JSON parameters
  • Interactive Mode - Basic interactive session support
  • Multiple Servers - Connect to different MCP servers

Installation & Quick Start

Option 1: Install Binaries

# Install all MCP Tools binaries
cargo install mcp-tools

# Verify installation
mcp-server --help
mcp-cli --help

Option 2: Library Integration

Add to your Cargo.toml:

[dependencies]
mcp-tools = "0.1.0"
coderlib = "0.1.0"  # Required dependency
tokio = { version = "1.0", features = ["full"] }

Basic Library Usage

use mcp_tools::{
    servers::GitToolsServer,
    common::{ServerConfig, McpServerBase},
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ServerConfig {
        name: "my-git-server".to_string(),
        description: "Git operations server".to_string(),
        version: "1.0.0".to_string(),
        host: "127.0.0.1".to_string(),
        port: 8080,
        max_connections: 100,
        request_timeout_secs: 300,
        log_requests: true,
        server_config: std::collections::HashMap::new(),
    };

    let mut server = GitToolsServer::new(config).await?;
    server.initialize().await?;

    println!("Git Tools MCP Server running on port 8080");

    // Server is ready to handle MCP requests
    Ok(())
}

Running Standalone Servers

# Unified server (recommended for most use cases)
mcp-server --host 0.0.0.0 --port 8080 --tools git,code,web,system

# Individual specialized servers
git-server --port 8081              # Git operations only
code-analysis-server --port 8082    # Code analysis only
web-server --port 8083              # Web tools only
system-server --port 8084           # System operations only

# CLI client usage
mcp-cli --server http://localhost:8080 list-tools
mcp-cli --server http://localhost:8080 execute git_status repo_path=/path/to/repo
mcp-cli --server http://localhost:8080 interactive

Docker Deployment

# Quick start - unified server
docker run -p 8080:8080 ghcr.io/mexyusef/mcp-tools:latest

# Individual servers
docker run -p 8081:8080 ghcr.io/mexyusef/mcp-tools-git:latest
docker run -p 8082:8081 ghcr.io/mexyusef/mcp-tools-code:latest
docker run -p 8083:8082 ghcr.io/mexyusef/mcp-tools-web:latest
docker run -p 8084:8083 ghcr.io/mexyusef/mcp-tools-system:latest

# Production deployment with docker-compose
curl -O https://raw.githubusercontent.com/mexyusef/mcp-tools/main/docker-compose.yml
docker-compose up -d

# With nginx proxy and SSL
docker-compose --profile with-proxy up -d

One-Command Setup

# Download and run setup script
curl -sSL https://raw.githubusercontent.com/mexyusef/mcp-tools/main/install.sh | bash

# Or using our Makefile
git clone https://github.com/mexyusef/mcp-tools.git
cd mcp-tools
make deploy

Complete Tool Reference

Git Tools (5 tools)

Tool Description Example Usage
git_status Repository status and changes git_status repo_path=/path/to/repo
git_diff Show file differences git_diff repo_path=/path/to/repo file=src/main.rs
git_log Commit history with filtering git_log repo_path=/path/to/repo limit=10
git_blame Line-by-line authorship git_blame repo_path=/path/to/repo file=src/lib.rs
git_branches Branch information git_branches repo_path=/path/to/repo

Code Analysis Tools (4 tools)

Tool Description Languages Supported
analyze_code Basic code structure analysis Rust, Python, JS, TS, Go, Java, C, C++
detect_language Programming language detection Auto-detection from content/extension
complexity_analysis Simple complexity metrics Basic cyclomatic complexity
security_analysis Basic security pattern detection Simple pattern matching

Web Tools (4 tools)

Tool Description Features
http_request HTTP client operations GET, POST, PUT, DELETE, PATCH
analyze_webpage Basic web page analysis Content extraction and metadata
analyze_url URL structure parsing Protocol, domain, path analysis
fetch_content Content downloading Basic content fetching

System Tools (4 tools)

Tool Description Security Level
execute_command Shell command execution Basic command filtering
get_system_info System information Read-only system data
get_environment Environment variables Basic environment access
get_processes Process information Process list and basic stats

File Operations Tools (3 tools)

Tool Description Security Level
read_file Read file contents Path validation
write_file Write content to files Path validation
list_directory Directory listing Basic directory access

Architecture & Design

Modular Architecture

mcp-tools/
├── servers/                 # MCP server implementations
│   ├── git_tools.rs         # Git repository operations
│   ├── code_analysis.rs     # Multi-language code analysis
│   ├── web_tools.rs         # Web scraping and HTTP tools
│   ├── system_tools.rs      # System operations and commands
│   └── file_operations.rs   # File system operations
├── clients/                 # MCP client implementations
│   ├── cli.rs               # Command-line interface
│   └── desktop.rs           # Desktop application framework
├── common/                  # Shared infrastructure
│   ├── server_base.rs       # Base server functionality
│   ├── client_base.rs       # Base client functionality
│   ├── transport.rs         # Transport layer (HTTP/WS/Stdio)
│   ├── protocol.rs          # MCP protocol definitions
│   └── config.rs            # Configuration management
├── bin/                     # Standalone executables
│   ├── mcp-server.rs        # Unified server (all tools)
│   ├── git-server.rs        # Git-only server
│   ├── code-analysis-server.rs # Code analysis server
│   ├── web-server.rs        # Web tools server
│   ├── system-server.rs     # System tools server
│   └── mcp-cli.rs           # CLI client
└── docker/                  # Container configurations
    ├── Dockerfile           # Multi-stage build
    ├── docker-compose.yml   # Service orchestration
    └── nginx.conf           # Reverse proxy config

Technology Stack

  • Rust - Memory-safe systems programming
  • CoderLib - Core library providing AI-powered code assistance tools
  • RMCP - Official Rust MCP SDK for protocol compliance
  • Tree-sitter - Syntax-aware code parsing (where available)
  • Git2 - Git operations library
  • Reqwest - HTTP client with async support
  • Tokio - Async runtime for performance
  • Docker - Containerization and deployment

Security Features

Basic Security

  • Input Validation - Parameter validation and sanitization
  • Command Filtering - Basic dangerous operation blocking
  • Path Validation - Directory traversal prevention
  • Non-root Execution - Containers run as unprivileged user
  • Request Logging - Basic operation tracking

Security Example

// Example: Basic file operations with validation
use mcp_tools::servers::FileOperationsServer;

async fn safe_file_read(path: &str) -> Result<String> {
    // Basic path validation
    let path_buf = std::path::PathBuf::from(path);

    // Read file with standard validation
    tokio::fs::read_to_string(path_buf).await
}

Deployment Options

Available Deployment Methods

  • Standalone Binaries - Single-file executables via cargo install
  • Docker Containers - Pre-built container images
  • Docker Compose - Multi-service orchestration
  • Library Integration - Embed in your Rust applications

Basic Monitoring

  • Health Checks - Basic health endpoints
  • Request Logging - Simple request/response logging
  • Error Tracking - Basic error reporting

Contributing

We welcome contributions! Here's how to get started:

Development Setup

# Clone and setup
git clone https://github.com/mexyusef/mcp-tools.git
cd mcp-tools

# Install dependencies and build
make setup
make build

# Run tests
make test

# Start development servers
make dev-run

Contribution Guidelines

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Test your changes: make test
  4. Document your changes
  5. Submit a pull request

See CONTRIBUTING.md for detailed guidelines.

License

Licensed under:

at your option.

Acknowledgments

  • MCP Protocol - Built on the official Rust MCP SDK
  • Code Analysis - Powered by Tree-sitter for accurate parsing
  • Git Operations - Uses git2 for robust Git integration
  • Rust Community - Built with love by the Rust community
  • CoderLib - Enhanced by CoderLib integration

Support & Community


MCP Tools - Production-ready Model Context Protocol servers and clients for seamless AI integration.

Commit count: 0

cargo fmt