Skip to content

Commit e8fe23c

Browse files
committed
feat(mcp): use aggressive MANDATORY instructions in initialize response
Change ServerInfo.instructions field from marketing copy to the aggressive MANDATORY usage protocol (INITIAL_INSTRUCTIONS). This provides automatic delivery of usage guidelines to MCP clients at connection time. Why This Change: - MCP prompts require manual user triggering (click + button in Claude Desktop) - The 'instructions' field is the ONLY automatic delivery mechanism in MCP - Per MCP spec, instructions "can be used by clients to improve the LLM's understanding of available tools, potentially being added to system prompt" - Client support varies, but it's the best pattern for automatic guidance Impact: - Instructions now sent automatically in every initialize response - Clients that support serverInstructions will add to system prompt - MCP prompt 'codegraph_initial_instructions' still available as fallback - Tool 'read_initial_instructions' remains for explicit access Verified: - Build successful - Initialize response contains full MANDATORY protocol - Tested with: echo initialize | codegraph start stdio References: - MCP Lifecycle spec: instructions field in InitializeResult - LibreChat pattern: serverInstructions configuration - Client support: 20 of 58 MCP clients support prompts, fewer support automatic instructions field, but this is still best practice
1 parent fa89ea5 commit e8fe23c

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

crates/codegraph-mcp/src/official_server.rs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -756,35 +756,10 @@ impl CodeGraphMCPServer {
756756
impl ServerHandler for CodeGraphMCPServer {
757757
fn get_info(&self) -> ServerInfo {
758758
ServerInfo {
759-
instructions: Some(
760-
"CodeGraph provides revolutionary AI codebase intelligence through local SOTA models.
761-
\n\
762-
🚀 Revolutionary Features:
763-
\
764-
• Enhanced semantic search with Qwen2.5-Coder-14B-128K analysis
765-
\
766-
• Revolutionary impact prediction before code changes
767-
\
768-
• Team intelligence and pattern detection
769-
\
770-
• 128K context window comprehensive analysis
771-
\
772-
• Complete local-first processing with zero external dependencies
773-
\
774-
• Performance optimized for high-memory systems
775-
\n\
776-
This is the world's most advanced local-first AI development platform.
777-
\n\
778-
💡 Getting Started:
779-
\
780-
1. Navigate to your project directory
781-
\
782-
2. Run: codegraph init .
783-
\
784-
3. Run: codegraph index . --recursive
785-
\
786-
4. Experience revolutionary AI codebase intelligence!".into()
787-
),
759+
// Use the aggressive MANDATORY instructions for automatic delivery
760+
// This is sent automatically in the initialize response
761+
// Also available via MCP prompt 'codegraph_initial_instructions'
762+
instructions: Some(INITIAL_INSTRUCTIONS.into()),
788763
capabilities: ServerCapabilities::builder()
789764
.enable_tools()
790765
.enable_prompts()

0 commit comments

Comments
 (0)