feat: add MCP server instructions for flake.lock indexing

Provides guidance to AI assistants on how to index the nixpkgs
revision from a project's flake.lock file, ensuring option
documentation matches the project's actual nixpkgs version.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 18:50:51 +01:00
parent 452b0fda86
commit 8627bfbe0a
2 changed files with 10 additions and 0 deletions

View File

@@ -149,6 +149,15 @@ func (s *Server) handleInitialize(req *Request) *Response {
Name: "nixos-options", Name: "nixos-options",
Version: "0.1.0", Version: "0.1.0",
}, },
Instructions: `NixOS Options MCP Server - Search and query NixOS configuration options.
If the current project contains a flake.lock file, you can index the exact nixpkgs revision used by the project:
1. Read the flake.lock file to find the nixpkgs "rev" field
2. Call index_revision with that git hash to index options for that specific version
Example: If flake.lock contains "rev": "abc123...", call index_revision with revision "abc123...".
This ensures option documentation matches the nixpkgs version the project actually uses.`,
} }
return &Response{ return &Response{

View File

@@ -51,6 +51,7 @@ type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"` ProtocolVersion string `json:"protocolVersion"`
Capabilities Capabilities `json:"capabilities"` Capabilities Capabilities `json:"capabilities"`
ServerInfo Implementation `json:"serverInfo"` ServerInfo Implementation `json:"serverInfo"`
Instructions string `json:"instructions,omitempty"`
} }
// Capabilities describes client or server capabilities. // Capabilities describes client or server capabilities.