From 8627bfbe0a7a1d285e7f50fb545c6c324c637397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 3 Feb 2026 18:50:51 +0100 Subject: [PATCH] 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 --- internal/mcp/server.go | 9 +++++++++ internal/mcp/types.go | 1 + 2 files changed, 10 insertions(+) diff --git a/internal/mcp/server.go b/internal/mcp/server.go index fbb8e0a..22874d6 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -149,6 +149,15 @@ func (s *Server) handleInitialize(req *Request) *Response { Name: "nixos-options", 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{ diff --git a/internal/mcp/types.go b/internal/mcp/types.go index 6cd9674..e80c398 100644 --- a/internal/mcp/types.go +++ b/internal/mcp/types.go @@ -51,6 +51,7 @@ type InitializeResult struct { ProtocolVersion string `json:"protocolVersion"` Capabilities Capabilities `json:"capabilities"` ServerInfo Implementation `json:"serverInfo"` + Instructions string `json:"instructions,omitempty"` } // Capabilities describes client or server capabilities.