privsim
MCP Server
privsim
public

rust repl

一个基于 Rust 的 TCP REPL 服务器,支持变量管理与异步操作。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Rust
Language
-
License

About This Server

一个基于 Rust 的 TCP REPL 服务器,支持变量管理与异步操作。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

# Rust MCP REPL Server

A REPL (Read-Eval-Print Loop) server implementation in Rust that provides an interactive shell environment with variable management capabilities.

## Features

- TCP-based REPL server
- Variable storage and retrieval
- Extensible command system
- Async/await support with Tokio
- Thread-safe state management

## Prerequisites

- Rust (latest stable version)
- Cargo (Rust's package manager)

## Installation

1. Clone the repository
2. Navigate to the project directory
3. Build the project:
```bash
cargo build
```

## Running the Server

Start the server using cargo:

```bash
cargo run
```

The server will start listening on `127.0.0.1:8080`.

## Connecting to the Server

You can connect to the server using any TCP client. For example, using netcat:

```bash
nc localhost 8080
```

## Available Commands

The REPL supports the following commands:

### `set <key> <value>`
Store a variable with the specified key and value.

Example:
```
mcp> set name John
Variable name set to John
```

### `get <key>`
Retrieve the value of a stored variable.

Example:
```
mcp> get name
John
```

### `execute <args...>`
Execute a model with the specified arguments.

Example:
```
mcp> execute model1 param1 param2
Executing model with args: ["model1", "param1", "param2"]
```

## Architecture

The server is built with a multi-threaded architecture using Tokio for async I/O operations. Key components include:

- `McpServer`: Core server implementation handling TCP connections
- `ReplState`: Thread-safe state management using `Arc` and `RwLock`
- `Shell`: Command processing and execution

## Configuration

The server listens on `127.0.0.1:8080` by default. To modify this or other settings, update the corresponding values in `src/server.rs`.

## Error Handling

The server provides informative error messages for:
- Invalid command syntax
- Uninitialized shell
- Connection issues
- Command execution failures

## Development

To run tests:
```bash
cargo test
```

To run with debug logging:
```bash
RUST_LOG=debug cargo run

Quick Start

1

Clone the repository

git clone https://github.com/privsim/rust-repl
2

Install dependencies

cd rust-repl
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerprivsim
Reporust-repl
Language
Rust
License-
Last fetched8/8/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation