Skip to content

Commit c6bb5c0

Browse files
committed
feat: bump version to 0.4.0 with channel switching and context management fixes
1 parent 28746af commit c6bb5c0

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

RELEASE_NOTES.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
1-
# MCP-NixOS: v0.3.1 Release Notes
1+
# MCP-NixOS: v0.4.0 Release Notes
22

33
## Overview
44

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.
5+
MCP-NixOS v0.4.0 introduces significant architectural improvements, focusing on resolving critical issues with channel switching and context management. This release also includes a completely redesigned prompt system following Model Context Protocol (MCP) best practices for dynamic discovery.
66

7-
## Changes in v0.3.1
7+
## Changes in v0.4.0
88

9-
### 🐛 Bug Fixes
9+
### 🚀 Major Enhancements
1010

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
11+
- **Fixed Channel Switching Functionality**: Resolved issues with channel switching between stable and unstable NixOS versions, ensuring accurate data retrieval for different channels
12+
- **Improved Context Management**: Completely refactored context management to eliminate type confusion and provide consistent handling across all tools
13+
- **Dynamic Discovery Tools**: Implemented discovery tools following MCP best practices, enabling AI to explore available capabilities dynamically
14+
- **Redesigned MCP Prompt**: Replaced the extensive documentation with a concise, principle-based prompt that emphasizes proper tool usage patterns
1515

16-
## Technical Details
16+
### 🛠️ Implementation Details
17+
18+
- **Channel Validation**: Added proper validation to ensure channel switching actually retrieves distinct data
19+
- **Context Type Consistency**: Standardized context handling across NixOS, Home Manager, and Darwin tools
20+
- **Enhanced Parameter Documentation**: Improved documentation for the `ctx` parameter across all tools
21+
- **Comprehensive Testing**: Added new tests for channel switching and context handling
1722

18-
The fundamental issue occurred in the context handling within the MCP-NixOS integration:
23+
## Technical Details
1924

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.
25+
The release addresses two main architectural issues:
2126

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.
27+
1. **Channel Switching Failure**: Previously, switching between channels (like "unstable" and "24.11") didn't properly change the Elasticsearch index, resulting in identical data regardless of channel selection. This has been fixed with proper verification of channel differences.
2328

24-
3. **Two-Layer Context Problem**: The issue existed in both:
25-
- The direct tool functions
26-
- The MCP tool registration wrappers
29+
2. **Context Management Chaos**: The codebase had inconsistent handling of the `ctx` parameter across different tools, sometimes treating it as a request context object and other times as a string identifier. This has been standardized with proper type checking and appropriate handling for all context types.
2730

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.
31+
3. **Dynamic Discovery**: Following MCP best practices, tools now support dynamic discovery rather than requiring hardcoded documentation in the prompt, making the system more maintainable and scalable.
2932

3033
## Installation
3134

3235
```bash
3336
# Install with pip
34-
pip install mcp-nixos==0.3.1
37+
pip install mcp-nixos==0.4.0
3538

3639
# Install with uv
37-
uv pip install mcp-nixos==0.3.1
40+
uv pip install mcp-nixos==0.4.0
3841

3942
# Install with uvx
40-
uvx mcp-nixos==0.3.1
43+
uvx mcp-nixos==0.4.0
4144
```
4245

4346
## Usage

mcp_nixos/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
__version__ = version("mcp-nixos")
1313
except PackageNotFoundError:
1414
# Package is not installed, use a default version
15-
__version__ = "0.3.1"
15+
__version__ = "0.4.0"
1616
except ImportError:
1717
# Fallback for Python < 3.8
1818
try:
1919
import pkg_resources
2020

2121
__version__ = pkg_resources.get_distribution("mcp-nixos").version
2222
except Exception:
23-
__version__ = "0.3.1"
23+
__version__ = "0.4.0"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "mcp-nixos"
7-
version = "0.3.1"
7+
version = "0.4.0"
88
description = "Model Context Protocol server for NixOS, Home Manager, and nix-darwin resources"
99
readme = "README.md"
1010
authors = [

tests/test_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_version_fallback_package_not_found(mock_version):
4747
import mcp_nixos
4848

4949
# Check that the default version is used
50-
assert mcp_nixos.__version__ == "0.3.1"
50+
assert mcp_nixos.__version__ == "0.4.0"
5151
mock_version.assert_called_once_with("mcp-nixos")
5252

5353

@@ -80,5 +80,5 @@ def test_version_ultimate_fallback(mock_get_distribution, _):
8080
import mcp_nixos
8181

8282
# Check that the default version is used when everything fails
83-
assert mcp_nixos.__version__ == "0.3.1"
83+
assert mcp_nixos.__version__ == "0.4.0"
8484
mock_get_distribution.assert_called_once()

0 commit comments

Comments
 (0)