You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+82-68Lines changed: 82 additions & 68 deletions
Original file line number
Diff line number
Diff line change
@@ -9,55 +9,26 @@ A Model Context Protocol (MCP) server for the [metacontract (mc)](https://github
9
9
**mc-mcp** is an extensible MCP server designed for the [metacontract](https://github.com/metacontract/mc) (mc) framework.
10
10
It enables AI-powered smart contract development workflows by exposing tools such as:
11
11
12
-
-**`mc_search_docs`**: Perform semantic search over mc documentation and user-configured sources, returning structured JSON results.
13
-
-**`mc_test`**: Run Foundry tests (`forge test`) in your workspace.
14
-
-**`mc_setup`**: Initialize a new Foundry project using the `metacontract/template` (requires an empty directory).
15
-
-**`mc_deploy`**: Deploy contracts using the script specified in `mcp_config.toml`. Supports dry-run (default) and broadcast mode (`broadcast: true` argument).
16
-
-**`mc_upgrade`**: Upgrade contracts using the script specified in `mcp_config.toml`. Supports dry-run and broadcast mode.
17
-
-**`mc_lint`**: (Coming Soon) Lint project files for best practices and errors.
18
-
19
-
---
20
-
21
-
## Features
22
-
23
-
-**Layered (Onion) Architecture** for maintainability and testability
24
-
-**Rust** implementation for performance and safety
25
-
-**MCP SDK** (`modelcontextprotocol-rust-sdk`) with `#[tool]` annotation-based tool definition
26
-
-**Qdrant** (embedded vector DB) for fast semantic search
27
-
-**Local embedding generation** using [fastembed-rs](https://github.com/kuvaus/fastembed-rs)
28
-
-**Markdown parsing** with [comrak](https://github.com/kivikakk/comrak)
29
-
-**Flexible configuration** via [figment](https://github.com/SergioBenitez/figment)
30
-
-**Structured logging** with [tracing](https://github.com/tokio-rs/tracing)
31
-
-**CI/CD**: Prebuilt documentation index is generated, compressed, and published as a GitHub Release asset
-**Prebuilt index**: Downloaded automatically from GitHub Releases on first run (not included in the crate)
12
+
-**`mc_search_docs_semantic`**: Performs semantic search over mc documentation and user-configured sources, returning structured JSON results.
13
+
-**`mc_setup`**: Initializes a new Foundry project using the `metacontract/template`. (Set `setup.force=true` in the config if the directory is not empty.)
14
+
-**`mc_test`**: Runs Foundry tests (`forge test`) in your workspace.
15
+
-**`mc_deploy`**: Deploys contracts using the script specified in `mcp_config.toml`. Supports dry-run (default) and broadcast mode (`broadcast: true` argument).
16
+
-**`mc_upgrade`**: Upgrades contracts using the script specified in `mcp_config.toml`. Supports dry-run and broadcast mode.
17
+
-**`mc_lint`**: _(Coming Soon)_ Lints project files for best practices and errors.
18
+
-**`mc_erc7201_slot`**: Calculates the namespaced storage slot using ERC-7201.
42
19
43
20
---
44
21
45
22
## Configuration and Project Root
46
23
47
24
**Project Root is always specified by the `MC_PROJECT_ROOT` environment variable.**
48
25
26
+
- 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.
49
27
- Set `MC_PROJECT_ROOT` to your project root directory before running any mc-mcp command or tool.
50
28
- All configuration, including `mcp_config.toml`, is expected to be in this directory.
51
29
- If `MC_PROJECT_ROOT` is not set or does not exist, mc-mcp will return an error and not start.
52
30
- If `mcp_config.toml` is missing, mc-mcp will use built-in defaults and log a warning.
53
31
54
-
### Example: Setting up and running mc-mcp
55
-
56
-
```sh
57
-
export MC_PROJECT_ROOT=/path/to/your/project
58
-
mc-mcp
59
-
```
60
-
61
32
### Example: Project Structure
62
33
63
34
```
@@ -71,43 +42,30 @@ mc-mcp
71
42
### Configuration File (`mcp_config.toml`)
72
43
- Place this file directly under your `MC_PROJECT_ROOT` directory.
73
44
- If omitted, mc-mcp will use default settings for all configuration values.
74
-
- See below for a sample config and field descriptions.
45
+
- See below for a [sample config and field descriptions](#configuration-example).
75
46
76
47
---
77
48
78
49
## Getting Started
79
50
80
51
### 1. Install mc-mcp (as a CLI tool)
81
52
82
-
# If published on crates.io (recommended for most users)
53
+
```bash
54
+
# recommended for most users
83
55
cargo install mc-mcp
56
+
```
84
57
58
+
```bash
85
59
# Or, to use the latest development version from GitHub:
-**Prebuilt index**: Downloaded automatically from GitHub Releases on first run (not included in the crate)
205
+
206
+
---
207
+
193
208
## Project Structure
194
209
195
210
-`src/domain/` — Core business logic, traits, entities
@@ -211,14 +226,13 @@ Some tests (especially integration tests and embedding-related tests) may fail d
211
226
212
227
### Common Commands (via Makefile)
213
228
214
-
-**Unit tests (lib only, with cache lock cleanup, single-threaded):**
229
+
-**All tests (include ignored tests):**
215
230
```sh
216
-
make test-lib
231
+
make test-all
217
232
```
218
-
-**All tests (recommended: increase ulimit before running):**
233
+
-**Unit tests (lib only, with cache lock cleanup, single-threaded):**
219
234
```sh
220
-
ulimit -n 4096
221
-
make test-all
235
+
make test-lib
222
236
```
223
237
-**Integration tests (single-threaded):**
224
238
```sh
@@ -240,7 +254,7 @@ Some tests (especially integration tests and embedding-related tests) may fail d
240
254
- Ensure the mock script setup within the specific test file (`src/main.rs` tests) is correct.
241
255
-**Note:**
242
256
- The Makefile provides handy shortcuts for common tasks, but some OS or CI environments may require manual adjustment of file descriptor limits (`ulimit`).
0 commit comments