2 unstable releases

Uses new Rust 2024

0.2.0 Oct 26, 2025
0.1.0 Oct 8, 2025

#738 in Network programming

Download history 172/week @ 2025-10-08 9/week @ 2025-10-15 112/week @ 2025-10-22

112 downloads per month

MIT license

21KB
83 lines

mcp-stdio-rust

A simple, containerized Rust server implementing the Model Context Protocol (MCP), designed for deployment on Google Cloud Run.

Overview

This project provides a basic server that exposes several tools via the Model Context Protocol. It serves as a template and example for building and deploying a minimal, secure, and efficient Rust application on Google Cloud Run using Docker and Google Cloud Build.

Technologies Used

Getting Started

A Makefile is included to simplify common development tasks.

Prerequisites

Before you begin, ensure you have the following installed:

Initial Setup

Clone the repository and install the necessary dependencies:

cargo build

Development Workflow

The following commands are available through the Makefile.

Building the Project

  • Development Build:
    make build
    
  • Release Build (optimized for production):
    make release
    

Running Locally

To start the server:

make run

Available Tools

This server exposes the following tools via the Model Context Protocol:

  • hellomcp: Returns "Hello World MCP!".
  • rustmcp: Returns "Hello World Rust MCP!".
  • z: Returns "Z".
  • version: Returns the program's version (e.g., "MyProgram v1.0.0").

Code Quality

  • Format the code:
    make format
    
  • Lint the code with Clippy:
    make clippy
    

Testing

Run the test suite:

make test

Deployment

Deployment is automated via Google Cloud Build, as defined in cloudbuild.yaml. The process uses a multi-stage Dockerfile to build a minimal, secure production image based on gcr.io/distroless/cc-debian12.

To manually trigger a deployment, run:

make deploy

This command will:

  1. Submit a build to Google Cloud Build.
  2. Build and push the Docker image to Google Container Registry (GCR).
  3. Deploy the new image to the mcp-stdio-rust service in the us-central1 region.

Dependencies

~26–44MB
~746K SLoC