metacontract mcp

by metacontract

345 downloads Not rated yet
GitHub

About

A Model Context Protocol (MCP) server for metacontract smart contract development.

Explore

- Layered (Onion) Architecture for maintainability and testability
- Rust implementation for performance and safety
- MCP SDK (modelcontextprotocol-rust-sdk) with #[tool] annotation-based tool definition
- Qdrant (embedded vector DB) for fast semantic search
- Local embedding generation using fastembed-rs
- Markdown parsing with comrak
- Flexible configuration via figment
- Structured logging with tracing
- CI/CD: Prebuilt documentation index is generated, compressed, and published as a GitHub Release asset

---

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 metacontract mcp
    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

Project Root is always specified by the MC_PROJECT_ROOT environment variable.

- The MC_PROJECT_ROOT environment variable is required because path resolution is delegated to the MCP client implementation. This ensures consistent and reliable behavior across different environments.
- Set MC_PROJECT_ROOT to your project root directory before running any mc-mcp command or tool.
- All configuration, including mcp_config.toml, is expected to be in this directory.
- If MC_PROJECT_ROOT is not set or does not exist, mc-mcp will return an error and not start.
- If mcp_config.toml is missing, mc-mcp will use built-in defaults and log a warning.

- Place this file directly under your MC_PROJECT_ROOT directory.
- If omitted, mc-mcp will use default settings for all configuration values.
- See below for a sample config and field descriptions.

---


Create a file named mcp_config.toml in your project root:

toml

[scripts]
deploy = "scripts/Deploy.s.sol" # Used by mc_deploy
upgrade = "scripts/Upgrade.s.sol" # Used by mc_upgrade

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "metacontract mcp": {
            "mc-mcp": {
                "command": "mc-mcp",
                "env": {
                    "MC_PROJECT_ROOT": "/path/to/your/project"
                }
            }
        }
    }
}

McpServers

{
    "mc-mcp": {
        "command": "mc-mcp",
        "env": {
            "MC_PROJECT_ROOT": "/path/to/your/project"
        }
    }
}

mc-mcp

A Model Context Protocol (MCP) server for the metacontract (mc) framework, providing smart contract development support via Foundry integration and semantic documentation search.

---

Overview

mc-mcp is an extensible MCP server designed for the metacontract (mc) framework.
It enables AI-powered smart contract development workflows by exposing tools such as:

- mc_search_docs_semantic: Performs semantic search over mc documentation and user-configured sources, returning structured JSON results.
- mc_setup: Initializes a new Foundry project using the metacontract/template. (Set setup.force=true in the config if the directory is not empty.)
- mc_test: Runs Foundry tests (forge test) in your workspace.
- mc_deploy: Deploys contracts using the script specified in mcp_config.toml. Supports dry-run (default) and broadcast mode (broadcast: true argument).
- mc_upgrade: Upgrades contracts using the script specified in mcp_config.toml. Supports dry-run and broadcast mode.
- mc_lint: _(Coming Soon)_ Lints project files for best practices and errors.
- mc_erc7201_slot: Calculates the namespaced storage slot using ERC-7201.

---

Configuration and Project Root

Project Root is always specified by the MC_PROJECT_ROOT environment variable.

- The MC_PROJECT_ROOT environment variable is required because path resolution is delegated to the MCP client implementation. This ensures consistent and reliable behavior across different environments.
- Set MC_PROJECT_ROOT to your project root directory before running any mc-mcp command or tool.
- All configuration, including mcp_config.toml, is expected to be in this directory.
- If MC_PROJECT_ROOT is not set or does not exist, mc-mcp will return an error and not start.
- If mcp_config.toml is missing, mc-mcp will use built-in defaults and log a warning.

Example: Project Structure

/path/to/your/project/
├── mcp_config.toml   # (optional) Project configuration
├── contracts/
├── scripts/
└── ...

Configuration File (mcp_config.toml)

- Place this file directly under your MC_PROJECT_ROOT directory. - If omitted, mc-mcp will use default settings for all configuration values. - See below for a sample config and field descriptions.

---

Getting Started

1. Install mc-mcp (as a CLI tool)

```bash

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.