Skip to content

Commit 2dd753a

Browse files
jamesbrinkclaude
andcommitted
bump: update version from 0.3.0 to 0.3.1
- Fix Home Manager context handling in MCP interface - Implement proper type checking for string contexts from MCP - Fix cascading failures in tool registration - Add RELEASE_NOTES.md with detailed explanation of fixes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 82dd452 commit 2dd753a

File tree

5 files changed

+67
-6
lines changed

5 files changed

+67
-6
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Official repository: [https://github.com/utensils/mcp-nixos](https://github.com/
299299
- Docker image includes pre-cached data for immediate startup
300300
- Build with pre-cache: `docker build -t mcp-nixos .`
301301
- Deployed on Smithery.ai as a hosted service
302-
- Interactive CLI (deprecated from v0.3.0):
302+
- Interactive CLI (deprecated from v0.3.1):
303303
- For manual testing, use a JSON-capable HTTP client like HTTPie or curl
304304
- Example: `echo '{"type":"call","tool":"nixos_search","params":{"query":"python"}}' | nc localhost 8080`
305305
- Development:

RELEASE_NOTES.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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)

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.0"
15+
__version__ = "0.3.1"
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.0"
23+
__version__ = "0.3.1"

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.0"
7+
version = "0.3.1"
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.0"
50+
assert mcp_nixos.__version__ == "0.3.1"
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.0"
83+
assert mcp_nixos.__version__ == "0.3.1"
8484
mock_get_distribution.assert_called_once()

0 commit comments

Comments
 (0)