Skip to content

Commit 6c4a7f1

Browse files
committed
feat: Comprehensive MCP tool improvements and fixes
- Convert all MCP tool names from kebab-case to snake_case for consistency - Fix darwin_search to prioritize macOS dock settings over Docker results - Enhance hm_show to display Type, Default, and Example values - Add context awareness and intelligent suggestions across all tools - Implement search result grouping for package versions - Add concise mode parameter to reduce output verbosity - Improve error messages with did-you-mean suggestions - Add GitHub API integration for enhanced flake search - Increase test coverage to 89% with 334 tests - Rename test files for better clarity and organization - Update documentation to reflect all changes This represents a major enhancement to the MCP-NixOS server, improving search relevance, output quality, and overall user experience.
1 parent 392f947 commit 6c4a7f1

27 files changed

+6033
-1001
lines changed

CLAUDE.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,31 @@ mypy mcp_nixos/
6262

6363
## Testing Approach
6464

65-
- 367+ async tests using pytest-asyncio
65+
- 334+ async tests using pytest-asyncio (89% coverage)
6666
- Real API calls (no mocks) for integration tests
6767
- Unit tests marked with `@pytest.mark.unit`
6868
- Integration tests marked with `@pytest.mark.integration`
6969
- Tests ensure plain text output (no XML/JSON leakage)
70+
- Comprehensive test coverage including:
71+
- Search relevance fixes (darwin_search dock prioritization)
72+
- Enhanced Home Manager option display
73+
- Error handling edge cases
74+
- AI usability evaluations
75+
76+
## Code Quality Commands
77+
78+
When making changes, always run:
79+
```bash
80+
# Lint and format
81+
ruff check mcp_nixos/ --fix
82+
ruff format mcp_nixos/
83+
84+
# Run tests
85+
pytest tests/
86+
87+
# Type check (note: some type issues are known and non-critical)
88+
mypy mcp_nixos/
89+
```
7090

7191
## Local Development with MCP Clients
7292

@@ -95,12 +115,21 @@ Create `.mcp.json` in project root (already gitignored):
95115

96116
2. **Error Handling**: All tools return helpful plain text error messages. API failures gracefully degrade with user-friendly messages.
97117

98-
3. **No Caching**: Version 1.0+ removed all caching for simplicity. All queries hit live APIs.
118+
3. **No Caching**: Version 1.0+ removed all caching for simplicity. All queries hit live APIs. **IMPORTANT**: Never implement caching for external services like NixHub - this is over-engineering for an MCP server. Always prefer simple, direct API calls.
99119

100120
4. **Async Everything**: Version 1.0.1 migrated to FastMCP 2.x. All tools are async functions.
101121

102122
5. **Plain Text Output**: All responses are formatted as human-readable plain text. Never return raw JSON or XML to users.
103123

124+
6. **Keep It Simple**: This is an MCP server, not a web application. Avoid over-engineering solutions like:
125+
- Caching layers for external APIs
126+
- Complex retry mechanisms with backoff
127+
- Database storage
128+
- Background workers or queues
129+
- Complicated state management
130+
131+
Always prefer simple, direct implementations that are easy to understand and maintain.
132+
104133
## CI/CD Workflows
105134

106135
- **CI**: Runs on all PRs - tests (unit + integration), linting, type checking

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ nix profile install github:utensils/mcp-nixos
139139
- **Deduped flake results** - No more duplicate spam
140140
- **Version-aware searches** - Find that old Ruby version you need
141141
- **Category browsing** - Explore options systematically
142+
- **Search relevance fixes** - Darwin dock searches now find dock, not Docker (revolutionary!)
143+
- **Enhanced Home Manager display** - Now shows default values like a proper tool
142144

143145
## For Developers (The Brave Ones)
144146

@@ -205,11 +207,12 @@ twine upload dist/* # Upload to PyPI
205207
```
206208

207209
### Testing Philosophy
208-
- **367 tests** that actually test things (now async because why not)
210+
- **334 tests** that actually test things (now async because why not)
211+
- **89% coverage** because perfection is overrated (but we're close)
209212
- **Real API calls** because mocks are for cowards (await real_courage())
210213
- **Plain text validation** ensuring no XML leaks through
211214
- **Cross-platform tests** because Windows users deserve pain too
212-
- **15 test files** down from 29 because organization is a virtue
215+
- **19 test files** perfectly organized because naming things is half the battle
213216

214217
## Environment Variables
215218

codecov.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Codecov configuration
2+
# https://docs.codecov.com/docs/codecovyml-reference
3+
4+
coverage:
5+
status:
6+
project:
7+
default:
8+
target: 85%
9+
threshold: 1%
10+
paths:
11+
- "mcp_nixos/"
12+
patch:
13+
default:
14+
target: 85%
15+
threshold: 1%
16+
17+
parsers:
18+
gcov:
19+
branch_detection:
20+
conditional: yes
21+
loop: yes
22+
method: no
23+
macro: no
24+
25+
comment:
26+
layout: "reach,diff,flags,files,footer"
27+
behavior: default
28+
require_changes: false
29+
require_base: yes
30+
require_head: yes
31+
32+
ignore:
33+
- "tests/**"
34+
- "setup.py"
35+
- "**/__pycache__/**"
36+
- "**/*.egg-info/**"
37+
- "website/**"
38+
- "docs/**"

0 commit comments

Comments
 (0)