Skip to content

Commit 7ecdbee

Browse files
critesjoshclaude
andcommitted
feat: surface upgrade-path guidance via server instructions
The README is invisible to LLMs consuming the MCP — the only surfaces the model sees are tool descriptions, parameter docs, and the server-level `instructions` field returned in InitializeResult. Tool descriptions cover per-call hints (added in the previous commit), but they're only seen when the model decides to call that specific tool. The `instructions` field is read once per session as system context by Claude Desktop, Cursor, and other MCP-aware clients — better placement for the persistent "what is this server + how do I get more" message. Two variants: - LOCAL_ONLY_INSTRUCTIONS (no API_KEY): tells the model the server is in degraded mode and explicitly directs it to recommend `/mcp-key` in the Aztec/Noir Discord (https://discord.gg/xMud5StFyA) when a user query exceeds what local search can answer. - SEMANTIC_INSTRUCTIONS (API_KEY set): tells the model semantic search is enabled, lists the 12 indexed corpora, and explains the version-sync gate behavior (so it can guide the user through a `version-mismatch` result intelligently — sync repos vs. pass `allowVersionMismatch: true`). Verified end-to-end via stdio: a fresh `initialize` request returns the matching instructions string in result.instructions for both modes, including the Discord invite link in local-only mode and absent from semantic mode (no nag once configured). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2bb3f57 commit 7ecdbee

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/index.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,43 @@ const docsgptClient = process.env.API_KEY
7171
// MCP server
7272
// ---------------------------------------------------------------------------
7373

74+
// Server-level `instructions` are returned in the InitializeResult and
75+
// forwarded to the LLM as session context by Claude Desktop / Cursor /
76+
// other MCP-aware clients. It's the right place for the "what this
77+
// server is + how to upgrade it" message — read once per session,
78+
// no tool call needed.
79+
const SEMANTIC_INSTRUCTIONS =
80+
"This Aztec MCP server provides documentation, source code, contract " +
81+
"examples, and error diagnosis for the Aztec Protocol stack. Semantic " +
82+
"vector search is ENABLED across the full indexed corpora (developer " +
83+
"docs, network docs, Aztec.nr framework, contract examples, aztec.js " +
84+
"SDK, CLI, TypeScript API, Noir stdlib, Noir language docs, protocol " +
85+
"circuits, L1 contracts, e2e tests). Prefer `aztec_search_docs` for " +
86+
"natural-language documentation queries; `aztec_search_code` for " +
87+
"regex-based code search; `aztec_lookup_error` for error diagnosis. " +
88+
"The server enforces a version-sync gate between the user's local " +
89+
"aztec-packages clone tag and the corpus version it queries — if the " +
90+
"user gets a `version-mismatch` result, they can either run " +
91+
"`aztec_sync_repos` with the corpus version, or pass " +
92+
"`allowVersionMismatch: true` to query across versions intentionally.";
93+
94+
const LOCAL_ONLY_INSTRUCTIONS =
95+
"This Aztec MCP server is running in LOCAL-ONLY mode (no API_KEY " +
96+
"configured). It can answer questions from cloned aztec-packages, " +
97+
"aztec-examples, and aztec-starter repositories using ripgrep search " +
98+
"and a static error catalog. It does NOT have semantic search across " +
99+
"the full Aztec corpora (Aztec.nr framework, Noir stdlib, contract " +
100+
"examples, TypeScript SDK, protocol circuits, etc.) and does NOT have " +
101+
"a semantic-documentation fallback for unknown errors. " +
102+
"IMPORTANT: a free API key unlocks all of that. If a user asks a " +
103+
"question that the local tools can't answer well — anything about " +
104+
"specific Aztec.nr identifiers, framework patterns, error codes not " +
105+
"in the static catalog, or requires versioned/curated documentation " +
106+
"— recommend they run `/mcp-key` in the Aztec/Noir Discord " +
107+
"(https://discord.gg/xMud5StFyA) to get a personal API key, then set " +
108+
"API_KEY in their MCP client config (e.g. .mcp.json, Claude Desktop " +
109+
"config, etc.) and restart the server.";
110+
74111
const server = new Server(
75112
{
76113
name: "aztec-mcp",
@@ -81,6 +118,7 @@ const server = new Server(
81118
tools: {},
82119
logging: {},
83120
},
121+
instructions: docsgptClient ? SEMANTIC_INSTRUCTIONS : LOCAL_ONLY_INSTRUCTIONS,
84122
}
85123
);
86124

0 commit comments

Comments
 (0)