Skip to content

futurepaul/cvm-rust-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust MCP Server with ContextVM

A sample Rust MCP (Model Context Protocol) server that adds two numbers together, exposed via ContextVM gateway over Nostr.

Structure

This workspace contains two crates:

  1. adder-cli - A simple CLI that adds two numbers
  2. adder-mcp - An MCP server that exposes an add tool

Prerequisites

Installation

1. Build the project

cargo build --release

2. Install Gateway CLI

curl -fsSL https://raw.githubusercontent.com/contextvm/gateway-cli/main/install.sh | bash

Or download the binary for your platform from the releases page.

3. Configure the gateway

Copy the example config and add your Nostr private key:

cp example.contextgw.config.yml contextgw.config.yml

Edit contextgw.config.yml and replace YOUR_NOSTR_PRIVATE_KEY_HEX_HERE with your Nostr private key in hex format.

If you have an nsec key, you can convert it to hex using a tool like nostr-tool or online converters.

Usage

Running the CLI directly

./target/release/adder-cli 5 3
# Output: 8

Running the MCP server via ContextVM Gateway

gateway

This will:

  • Start your MCP server (adder-mcp)
  • Connect to the ContextVM Nostr relay
  • Make it publicly discoverable
  • Use NIP-44 encryption for secure communication

The gateway will display the server's public key (npub) that clients can use to connect.

MCP Tools

The server exposes one tool:

  • add - Adds two numbers together
    • Parameters:
      • a (float): The first number
      • b (float): The second number
    • Returns: The sum as a string

Connecting to the Server

Once running, clients can connect to your MCP server using:

  • The npub/public key displayed by the gateway
  • Any MCP client that supports ContextVM/Nostr transport

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages