Get the FREE Ultimate OpenClaw Setup Guide →

commune

A Rust library designed to support the development of discoverable networks of AI agents.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jgmartin-commune cargo run --package mcp-commune

How to use

Commune is a Rust library that wraps the MCP SDK to help you build discoverable networks of AI agents. It focuses on peer discovery, resource sharing, and easy access to tools, prompts, and resources exposed by other MCP servers. The library provides a peer builder to define connections to other MCP peers, and a commune client to aggregate and utilize resources across peers. Typical usage involves creating peers for the MCP servers you want to connect to, constructing a commune client with those peers, and then querying or subscribing to tools, resources, and prompts exposed by those peers. Commune also includes type conversion helpers to adapt data from common inference APIs, such as AWS Bedrock and OpenAI, simplifying integration in Rust applications.

To use Commune in your project, first create a Peer for each MCP server you want to connect to, then assemble a Client with those peers. You can retrieve all available tools, resources, and prompts across the connected peers, and you can start using the tools or subscribe to resource updates as needed. The library is designed to be used inside a Rust application, enabling you to orchestrate multiple peers and consume their capabilities within a single process.

How to install

Prerequisites:

  • Rust and Cargo installed (via Rustup recommended).
  • A Rust project where you want to use Commune as a library.

Installation steps:

  1. Add the commune crate to your Cargo.toml dependencies:

[dependencies] commune = { package = "mcp-commune", version = "0.1.2" }

  1. Build or run your project to fetch and compile the dependency:

cargo build

  1. (Optional) If you plan to run examples or a standalone binary, ensure you have a main function that uses the Commune API as shown in the README example.

  2. If you publish or share your project, include Commune as a normal Rust dependency so others can build with cargo as well.

Additional notes

Notes and tips:

  • Commune is a library, not a standalone MCP server. You implement the server-side or client-side logic in your Rust application using the Commune APIs.
  • The library supports WebSocket communication (with and without TLS) via the MCP ecosystem; ensure your peer URLs and TLS settings align with the servers you connect to.
  • The type conversion utilities help map results from inference providers (like AWS Bedrock or OpenAI) into the structures used by MCP-enabled tooling.
  • When configuring peers, consider subscribing to resource updates for dynamic data, which enables reactive behavior in your application.
  • If you run into integration issues, verify you are using compatible MCP SDK versions and that your Rust toolchain is up to date.

Related MCP Servers

Sponsor this space

Reach thousands of developers