mc-mcp: an MCP server for smart contract development

mc-mcp: an MCP server for smart contract development

mc-mcp•bymetacontract

mc-mcp is an extensible MCP server for the metacontract framework that enables AI-powered smart contract development workflows with Foundry integration and semantic documentation search.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Performs semantic search over mc documentation and user-configured sources, returning structured JSON results.
  • •Initializes a new Foundry project using the metacontract template.
  • •Runs Foundry tests in the workspace via forge test.
  • •Deploys and upgrades contracts using configured Foundry scripts, with dry-run default and optional broadcast mode.

BEST FOR

  • •Smart contract developers using an MCP-compatible agent or IDE to design, search docs, and run TDD cycles.
  • •Foundry projects that need agent-driven project setup, testing, deployment, and upgrades.

ABOUT MC-MCP

mc-mcp: an MCP server for smart contract development is cataloged as an MCP server attributed to metacontract. mc-mcp is an extensible MCP server for the metacontract framework that enables AI-powered smart contract development workflows with Foundry integration and semantic documentation search. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for mc-mcp: an MCP server for smart contract development are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What environment variable is required to define the project root?

The MC_PROJECT_ROOT environment variable is required; if it is unset or the directory does not exist, mc-mcp returns an error and does not start.

What happens if the mcp_config.toml file is missing?

mc-mcp uses built-in default settings for all configuration values and logs a warning.

How does mc-mcp support semantic documentation search?

It uses an embedded Qdrant vector database with local embedding generation, loading a prebuilt documentation index downloaded on first startup.

上游原版 README

在 GitHub 查看同一版本原文

README.md · f17080dae9ef · 采集于 2026-11-13 11:22:00 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

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)

# recommended for most users
cargo install mc-mcp
# Or, to use the latest development version from GitHub:
cargo install --git https://github.com/metacontract/mc-mcp.git

# Alternatively, you can clone and build manually:
git clone https://github.com/metacontract/mc-mcp.git
cd mc-mcp
cargo build --release

2. Add to your MCP client

mc-mcp works with any MCP-compatible client, such as:

Example: Cursor

Add your MCP server in the settings (./cursor/mcp.json or global settings):

{
  "mcpServers": {
    "mc-mcp": {
      "command": "mc-mcp", // or "/path/to/mc-mcp/target/release/mc-mcp",
      "env": {
        "MC_PROJECT_ROOT": "/absolute-path/to/your/project"
      }
    }
  }
}

Example: Cline

Cline auto-detects MCP servers in your workspace. For advanced configuration, see Cline's documentation.

Example: RooCode

RooCode supports MCP integration out of the box. See RooCode's documentation for details.

{
  "mcpServers": {
    "mc-mcp": {
      "disabled": false,
      "timeout": 60,
      "command": "mc-mcp",
      "transportType": "stdio",
      "alwaysAllow": ["mc_setup", "mc_search_docs_semantic", "mc_test", "mc_deploy", "mc_upgrade"], // if needed
      "env": {
        "MC_PROJECT_ROOT": "/absolute-path/to/your/project"
      }
    }
  }
}

Then, your MCP client starts the mc-mcp server automatically.

  • On first startup, the prebuilt documentation index (prebuilt_index.jsonl.gz) will be downloaded from the latest GitHub Release if not present.

3. Initialize a new mc project

You can simply instruct your agent to "setup mc project".

or, manual setup

forge init <your-project-name> -t metacontract/template
cd <your-project-name>

4. Develop your smart contract

  • Use your MCP-compatible Agent/IDE to interact with mc-mcp
  • Design, search docs, and run TDD cycles (mc_test, mc_search_docs_semantic, etc.)

Configuration Example

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

# Reference sources for semantic search
[reference]
# The prebuilt index is downloaded to the system cache directory by default.
# You can override the path here if needed:
# prebuilt_index_path = "/custom/path/to/prebuilt_index.jsonl.gz"

[[reference.sources]]
name = "mc-docs"
source_type = "local"
path = "metacontract/mc/site/docs"

[[reference.sources]]
name = "solidity-docs"
source_type = "local"
path = "docs/solidity"

[[reference.sources]]
name = "user-docs"
source_type = "local"
path = "docs/user"

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

# Optional: Settings for broadcasting transactions (used when broadcast=true)
rpc_url = "http://localhost:8545" # RPC endpoint URL
private_key_env_var = "PRIVATE_KEY" # Name of the env var holding the deployer's private key
  • prebuilt_index_path ... (optional) Path to a prebuilt index (jsonl or gzipped jsonl). If set, it overrides the default cache location. The index will be loaded and upserted into Qdrant on startup.
  • Each [[reference.sources]] must have name, source_type (usually local), and path (relative to the execution directory).
  • [scripts].deploy and [scripts].upgrade specify the default Foundry script paths used by the mc_deploy and mc_upgrade tools respectively.
  • [scripts].rpc_url and [scripts].private_key_env_var are required when using mc_deploy or mc_upgrade with the broadcast: true argument. forge will use these to send the transaction.
  • All paths must exist and be directories, or indexing will fail.

See also: config.rs for the full config structure.


Features

  • 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

Architecture

  • Library + Binary crate structure
  • Domain / Application / Infrastructure layering
  • Manual Dependency Injection
  • Strict inward dependency rule (Entry Point → Application → Domain ← Infrastructure)
  • Prebuilt index: Downloaded automatically from GitHub Releases on first run (not included in the crate)

Project Structure

  • src/domain/ — Core business logic, traits, entities
  • src/application/ — Use cases, DTOs
  • src/infrastructure/ — Integrations (Qdrant, embeddings, file system, etc.)
  • src/main.rs — Entry point, MCP tool registration, DI

Development

  • TDD: Test-Driven Development is enforced (unit/integration tests)
  • Integration tests: Use testcontainers for Qdrant, ensuring isolated and stable test environments.
  • CI/CD: GitHub Actions for build, test, and prebuilt index artifact management

Testing & Troubleshooting

Some tests (especially integration tests and embedding-related tests) may fail due to OS file descriptor limits or cache lock issues.

Common Commands (via Makefile)

  • All tests (include ignored tests):
    make test-all
    
  • Unit tests (lib only, with cache lock cleanup, single-threaded):
    make test-lib
    
  • Integration tests (single-threaded):
    make test-integration
    
  • Clean embedding model cache:
    make clean-cache
    

Troubleshooting

  • If you see Too many open files errors:
    • Increase the file descriptor limit in your shell before running tests: ulimit -n 4096
    • Run tests sequentially: cargo test -- --test-threads=1 (or use make test-lib / make test-integration)
  • If you see .lock errors (related to embedding model cache):
    • Clean the cache: make clean-cache
  • If tests involving forge commands fail unexpectedly:
    • Ensure the mock script setup within the specific test file (src/main.rs tests) is correct.
  • Note:
    • The Makefile provides handy shortcuts for common tasks, but some OS or CI environments may require manual adjustment of file descriptor limits (ulimit).
    • See each Makefile target for more details.

Task Management & Progress

For up-to-date milestones, progress, and detailed task tracking, see: ➡️ mc-mcp Task List


License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for mc-mcp: an MCP server for smart contract development from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mc-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools