MCP Rust CLI server template

by linux-china

82 stars
425 downloads
Not rated
GitHub

About

Model Context Protocol (MCP) CLI server template for Rust

Details

Author
linux-china
GitHub stars
82
Downloads
425
Categories
Developer Tools

- Implements an MCP CLI server in Rust.
- Based on the JSON-RPC routing library rust-rpc-router.
- Modular handler files for prompts, resources, and tools.
- Supports CLI flags for testing and display.
- Integrates with Claude Desktop via configuration file.
- Provides JSON template files for customization.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Rust CLI server template
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, modify the project information in Cargo.toml and src/mcp/mod.rs, then edit the handler files (src/mcp/prompts.rs, src/mcp/resources.rs, src/mcp/tools.rs) or the JSON templates in src/mcp/templates/. Run the binary with the --mcp flag to enable the MCP server; optional flags --resources, --prompts, and --tools display the corresponding registered items.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp rust cli server template": {
            "current-time": {
                "command": "mcp-rs-template",
                "args": [
                    "--mcp"
                ],
                "env": {
                    "API_KEY": "xxxx"
                }
            }
        }
    }
}

McpServers

{
    "current-time": {
        "command": "mcp-rs-template",
        "args": [
            "--mcp"
        ],
        "env": {
            "API_KEY": "xxxx"
        }
    }
}

MCP Rust CLI server template
=============================

Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications
and external data sources and tools. Whether you’re building an AI-powered IDE, enhancing a chat interface,
or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

mcp-rs-template is a simple application template that demonstrates how to implement MCP CLI server in Rust.

How to use template?

1. Clone the repository
2. Modify project information in Cargo.toml and src/mcp/mod.rs
3. Modify server handlers:
- src/mcp/prompts.rs: prompts handlers
- src/mcp/resources.rs: resources handlers
- src/mcp/tools.rs: tools handlers
4. Modify src/mcp/templates/.json if you prefer to use json files for prompts, resources, and tools

mcp-rs-template is based on rust-rpc-router, a JSON-RPC routing
library for Rust.

CLI options

--mcp: Enable MCP server
--resources: display resources
--prompts: display prompts
--tools: display tools

How to use MCP CLI server in Claude Desktop?

1. Edit claude_desktop_config.json: Claude Desktop -> Settings -> Developer -> Edit Config
2. Add the following configuration to the servers section:

{
   "mcpServers": {
      "current-time": {
         "command": "mcp-rs-template",
         "args": [
            "--mcp"
         ],
         "env": {
            "API_KEY": "xxxx"
         }
      }
   }
}

If you want to check MCP log, please use tail -n 20 -f ~/Library/Logs/Claude/mcp.log.

References

MCP Specification: https://spec.modelcontextprotocol.io/
Model Context Protocol (MCP): https://modelcontextprotocol.io/introduction
rpc-router: json-rpc routing library - https://github.com/jeremychone/rust-rpc-router/
Zed context_server: https://github.com/zed-industries/zed/tree/main/crates/context_server

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.