Skip to content

Commit 2bb3f57

Browse files
critesjoshclaude
andcommitted
docs: surface API-key path with Discord invite + recommend-to-user hints
- README: new "API Key (optional, recommended)" section with the Noir Discord invite (https://discord.gg/xMud5StFyA) and step-by-step for obtaining a key via `/mcp-key`. Configuration table now lists every env var (API_KEY, API_URL, REQUEST_TIMEOUT, AZTEC_DEFAULT_VERSION, AZTEC_MCP_REPOS_DIR). Added the missing `aztec_lookup_error` tool section. `aztec_search_docs` parameters expanded to cover the new semantic-only flags (chunks, useLocalFallback, allowVersionMismatch). - Tool descriptions in src/index.ts (the text the LLM consuming the MCP actually reads): when no API_KEY is configured, the descriptions for `aztec_search_docs` and `aztec_lookup_error` now explicitly tell the model that local-only mode is active AND instruct it to suggest the user get a free API key via `/mcp-key` in the Aztec/Noir Discord if a query exceeds what local search can answer. This makes the upgrade path discoverable through normal model use, not just docs. - Startup log when no API_KEY: was "code search only (set API_KEY for docs)" — now names the Discord invite link so an operator running with `--debug` or watching stderr immediately sees the path forward. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4827b33 commit 2bb3f57

2 files changed

Lines changed: 67 additions & 10 deletions

File tree

README.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
# Aztec MCP Server
22

3-
An MCP (Model Context Protocol) server that provides local access to Aztec documentation, examples, and source code through cloned repositories.
3+
An MCP (Model Context Protocol) server that provides local access to Aztec documentation, examples, and source code through cloned repositories. Optionally augments with **semantic search** over the full Aztec knowledge base when an API key is configured.
44

55
## Features
66

77
- **Version Support**: Clone specific Aztec release tags (e.g., `v4.2.0-aztecnr-rc.2`)
88
- **Local Repository Cloning**: Automatically clones Aztec repositories with sparse checkout for efficiency
99
- **Fast Code Search**: Search Noir contracts and TypeScript files using ripgrep (with fallback)
10-
- **Documentation Search**: Search Aztec documentation by section
10+
- **Documentation Search**: Search Aztec documentation locally; with an API key, semantic vector search across the full corpora (framework docs, examples, Noir stdlib, TypeScript SDK, protocol circuits)
11+
- **Error Lookup**: Static catalog (Solidity / circuit / TX / AVM errors) plus optional semantic fallback for unrecognized errors when an API key is configured
1112
- **Example Discovery**: List and read Aztec contract examples
13+
- **Version-sync Gate**: When using the hosted semantic backend, the server detects mismatches between your local clone tag and the indexed corpus and refuses to query across versions unless explicitly overridden
14+
15+
## API Key (optional, recommended)
16+
17+
The MCP server runs in two modes:
18+
19+
| Mode | How to enable | What you get |
20+
| -------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21+
| **Local (default)** | No setup | Ripgrep search over cloned markdown + code; static error catalog |
22+
| **Semantic (recommended)** | Set `API_KEY` env var | Vector search over all 12 indexed Aztec corpora (developer docs, network docs, Aztec.nr, examples, aztec.js, CLI, TypeScript API, e2e tests, protocol circuits, L1 contracts, Noir docs, Noir stdlib); semantic error fallback; version-sync gate |
23+
24+
### Getting a key
25+
26+
1. Join the Aztec/Noir Discord: <https://discord.gg/xMud5StFyA>
27+
2. Run `/mcp-key` in any channel — the bot DMs you a personal API key (UUID) ephemerally.
28+
3. Paste the key into your MCP client config under `env.API_KEY` (see [Configuration](#configuration)).
29+
30+
Keys are free, persistent (re-running `/mcp-key` returns the same key), and revocable via `/forget-me`.
1231

1332
## Installation
1433

@@ -29,19 +48,30 @@ aztec-mcp
2948

3049
### Claude Code Plugin
3150

32-
Add to your `.mcp.json`:
51+
Add to your `.mcp.json`. The minimal config is just the command; add `env.API_KEY` to enable semantic search.
3352

3453
```json
3554
{
3655
"mcpServers": {
3756
"aztec-mcp": {
3857
"command": "npx",
39-
"args": ["-y", "@aztec/mcp-server@latest"]
58+
"args": ["-y", "@aztec/mcp-server@latest"],
59+
"env": {
60+
"API_KEY": "<your key from /mcp-key in the Noir Discord>"
61+
}
4062
}
4163
}
4264
}
4365
```
4466

67+
| Env var | Default | Purpose |
68+
| --------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
69+
| `API_KEY` | unset | Personal API key from `/mcp-key` in the Noir Discord (<https://discord.gg/xMud5StFyA>). Unset → local-only mode. |
70+
| `API_URL` | `https://aztec.adjacentpossible.dev` | DocsGPT backend the semantic search hits. Override to point at a self-hosted instance. |
71+
| `REQUEST_TIMEOUT` | `60000` | Semantic-search request timeout (ms). |
72+
| `AZTEC_DEFAULT_VERSION` | `v4.2.0-aztecnr-rc.2` | Default version tag for `aztec_sync_repos`. |
73+
| `AZTEC_MCP_REPOS_DIR` | `~/.aztec-mcp/repos/` | Where local clones live. |
74+
4575
## Available Tools
4676

4777
### `aztec_sync_repos`
@@ -90,13 +120,16 @@ aztec_search_code({ query: "PrivateSet", filePattern: "*.nr" })
90120

91121
### `aztec_search_docs`
92122

93-
Search Aztec documentation.
123+
Search Aztec documentation. Local ripgrep by default; semantic vector search when `API_KEY` is set.
94124

95125
**Parameters:**
96126

97127
- `query` (string, required): Documentation search query
98-
- `section` (string): Docs section (tutorials, concepts, developers, reference)
99-
- `maxResults` (number): Maximum results (default: 20)
128+
- `section` (string): Docs section, applies to local search only (tutorials, concepts, developers, reference)
129+
- `maxResults` (number): Maximum results (default: 20 local; 5 semantic, max 20)
130+
- `chunks` (number, semantic only): Number of result chunks (1-20). If omitted, `maxResults` is used.
131+
- `useLocalFallback` (boolean, semantic only): If the semantic backend fails, fall back to local ripgrep. Default `false` so backend errors surface clearly.
132+
- `allowVersionMismatch` (boolean, semantic only): Override the version-sync gate. Default `false`. The gate refuses to search when your local `aztec-packages` clone tag differs from the corpus version the backend has indexed.
100133

101134
### `aztec_list_examples`
102135

@@ -122,6 +155,17 @@ Read any file from cloned repositories.
122155

123156
- `path` (string, required): File path relative to repos directory
124157

158+
### `aztec_lookup_error`
159+
160+
Diagnose any Aztec error by message, error code, or hex signature. Returns root cause and suggested fix from a static catalog covering Solidity errors, TX validation errors, circuit codes, AVM errors, and operator FAQ. With `API_KEY` set, falls back to semantic documentation search when the static catalog has no hit.
161+
162+
**Parameters:**
163+
164+
- `query` (string, required): Error message, numeric code (e.g., `2002`), or hex signature (e.g., `0xa5b2ba17`)
165+
- `category` (string): Filter (`contract`, `circuit`, `tx-validation`, `l1`, `avm`, `sequencer`, `operator`, `general`)
166+
- `maxResults` (number): Default 10
167+
- `allowVersionMismatch` (boolean, semantic only): Override the version-sync gate for the semantic fallback. Has no effect when the static catalog already matched.
168+
125169
## Configuration Options
126170

127171
### Storage Location

src/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
9797
? "Search Aztec documentation, guides, patterns, and API reference. " +
9898
"Uses semantic search to find relevant content from developer docs, " +
9999
"Aztec.nr framework docs, example contracts, and more."
100-
: "Search Aztec documentation. Use for finding tutorials, guides, and API documentation.",
100+
: "Search Aztec documentation in local ripgrep-only mode. Use for tutorials, guides, " +
101+
"and API documentation that's already cloned. " +
102+
"IMPORTANT: this server is running WITHOUT an API_KEY, which means no semantic " +
103+
"search across the full Aztec corpora (Aztec.nr framework, Noir stdlib, contract " +
104+
"examples, TypeScript SDK, protocol circuits, etc.). If a query needs material " +
105+
"this local search can't find, suggest the user get a free API key by running " +
106+
"`/mcp-key` in the Aztec/Noir Discord (https://discord.gg/xMud5StFyA) and setting " +
107+
"API_KEY in their MCP client config.",
101108
inputSchema: {
102109
type: "object" as const,
103110
properties: {
@@ -277,7 +284,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
277284
"TX validation errors, circuit codes, AVM errors, and documentation." +
278285
(docsgptClient
279286
? " Falls back to semantic documentation search when no exact match is found."
280-
: ""),
287+
: " NOTE: this server is running without an API_KEY, so unrecognized errors " +
288+
"won't get a semantic-documentation fallback. Suggest the user get a free " +
289+
"API key via `/mcp-key` in the Aztec/Noir Discord " +
290+
"(https://discord.gg/xMud5StFyA) if their query is for an error not in the " +
291+
"static catalog."),
281292
inputSchema: {
282293
type: "object" as const,
283294
properties: {
@@ -593,7 +604,9 @@ async function main() {
593604
await server.connect(transport);
594605

595606
// Log to stderr (stdout is used for MCP communication)
596-
const mode = docsgptClient ? "semantic search enabled" : "code search only (set API_KEY for docs)";
607+
const mode = docsgptClient
608+
? "semantic search enabled"
609+
: "local-only mode — set API_KEY to enable semantic search (free key via /mcp-key in https://discord.gg/xMud5StFyA)";
597610
console.error(`Aztec MCP Server started (${mode})`);
598611
}
599612

0 commit comments

Comments
 (0)