|
| 1 | +# MCP-NixOS: v0.3.1 Release Notes |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +MCP-NixOS v0.3.1 is a patch release that fixes critical issues with the Home Manager and NixOS tools when used through Claude's Model Context Protocol (MCP) interface. |
| 6 | + |
| 7 | +## Changes in v0.3.1 |
| 8 | + |
| 9 | +### 🐛 Bug Fixes |
| 10 | + |
| 11 | +- **Fixed Home Manager context handling in MCP interface**: Resolved issues where Home Manager tools would fail with `'str' object has no attribute 'request_context'` error when accessed through Claude's MCP interface |
| 12 | +- **Improved context type validation**: Added proper type checking with `isinstance(ctx, str)` to handle both server request contexts and string contexts from MCP |
| 13 | +- **Enhanced error handling in tool registration**: Modified MCP tool registration to dynamically import the proper context when string contexts are passed |
| 14 | +- **Restored dependency lock file**: Added `uv.lock` to ensure consistent dependencies across all environments, fixing missing `psutil` dependency issues |
| 15 | + |
| 16 | +## Technical Details |
| 17 | + |
| 18 | +The fundamental issue occurred in the context handling within the MCP-NixOS integration: |
| 19 | + |
| 20 | +1. **Inconsistent Context Types**: The Home Manager tools were originally designed to handle `request_context` objects from the internal server, but when called through Claude's MCP interface, they received a string context instead. |
| 21 | + |
| 22 | +2. **Type Mismatch Error**: This led to the error `'str' object has no attribute 'request_context'` when the tools tried to access `ctx.request_context` on a string. |
| 23 | + |
| 24 | +3. **Two-Layer Context Problem**: The issue existed in both: |
| 25 | + - The direct tool functions |
| 26 | + - The MCP tool registration wrappers |
| 27 | + |
| 28 | +The fix required implementing proper type checking in both the tool functions themselves and in their MCP registration wrappers, along with appropriate handling for string contexts by dynamically importing the proper context object. |
| 29 | + |
| 30 | +## Installation |
| 31 | + |
| 32 | +```bash |
| 33 | +# Install with pip |
| 34 | +pip install mcp-nixos==0.3.1 |
| 35 | + |
| 36 | +# Install with uv |
| 37 | +uv pip install mcp-nixos==0.3.1 |
| 38 | + |
| 39 | +# Install with uvx |
| 40 | +uvx mcp-nixos==0.3.1 |
| 41 | +``` |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +Configure Claude to use the tool by adding it to your `~/.config/claude/config.json` file: |
| 46 | + |
| 47 | +```json |
| 48 | +{ |
| 49 | + "tools": [ |
| 50 | + { |
| 51 | + "path": "mcp_nixos", |
| 52 | + "default_enabled": true |
| 53 | + } |
| 54 | + ] |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +## Contributors |
| 59 | + |
| 60 | +- James Brink (@utensils) |
| 61 | +- Sean Callan (Moral Support) |
0 commit comments