Skip to content

Commit 367f7ef

Browse files
yzx9khaneliman
authored andcommitted
claude-code: shorten generated plugin name to "hm"
The synthesized plugin that delivers managed MCP and LSP configuration to Claude Code was named `claude-code-home-manager`. Claude Code derives the MCP tool namespace from the plugin manifest (`plugin.json`), so that name appeared in the prefix of every plugin-loaded MCP tool (`mcp__plugin_<name>_<server>__<tool>`), adding 22 characters of overhead per tool name. Shorten the manifest name to `hm`, centralizing it in a `generatedPluginName` binding, so tool prefixes become `mcp__plugin_hm_<server>__<tool>`. The personal-plugin directory entry keeps the stable `claude-code-home-manager` name (the path under `~/.claude/skills/`); a short name there would collide with valid `programs.claude-code.plugins.hm` or `skills.hm` and fail the uniqueness assertions. This is a breaking change: users who allow or deny these tools by name in their settings must update references from `claude-code-home-manager` to `hm`. A news entry documents the migration. Closes #9446 Assisted-by: Claude-Code:GLM-5.2
1 parent 7834e82 commit 367f7ef

3 files changed

Lines changed: 56 additions & 2 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ config, ... }:
2+
{
3+
time = "2026-08-06T01:29:34+00:00";
4+
# Mirrors the generated-plugin trigger in the module: the plugin is created
5+
# whenever MCP or LSP servers are produced, including shared MCP servers
6+
# pulled in via `enableMcpIntegration`, not just direct `mcpServers`.
7+
condition =
8+
config.programs.claude-code.enable
9+
&& (
10+
config.programs.claude-code.enableMcpIntegration
11+
&& config.programs.mcp.enable
12+
&& config.programs.mcp.servers != { }
13+
|| config.programs.claude-code.mcpServers != { }
14+
|| config.programs.claude-code.lspServers != { }
15+
);
16+
message = ''
17+
The generated plugin that delivers managed MCP and LSP configuration to
18+
Claude Code now uses the manifest name `hm` (previously
19+
`claude-code-home-manager`). Claude Code derives the MCP tool namespace from
20+
the plugin manifest, so this shortens every plugin-loaded MCP tool prefix to
21+
`mcp__plugin_hm_<server>__<tool>`. See
22+
[issue #9446](https://github.com/nix-community/home-manager/issues/9446).
23+
24+
The personal skills directory stays `~/.claude/skills/claude-code-home-manager`
25+
unchanged, so it does not collide with user plugins or skills.
26+
27+
This is a breaking change. If you allow or deny these tools by name in
28+
{file}`<project>/.claude/settings.{, local.}json` or via
29+
{option}`programs.claude-code.settings`, update any references from
30+
`claude-code-home-manager` to `hm`, for example:
31+
32+
```json
33+
{
34+
"permissions": {
35+
"allow": ["mcp__plugin_hm_github"]
36+
}
37+
}
38+
```
39+
'';
40+
}

modules/programs/claude-code/default.nix

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ in
9292
mkSkillEntry
9393
;
9494

95+
# Manifest name of the synthesized plugin that carries generated MCP and
96+
# LSP config. Claude Code derives the MCP tool namespace from this name
97+
# (`mcp__plugin_<name>_<server>__<tool>`), so it is kept short to reduce
98+
# token overhead. The personal-plugin directory entry keeps the longer,
99+
# stable `claude-code-home-manager` name to avoid colliding with user
100+
# plugins or skills. See issue #9446.
101+
generatedPluginName = "hm";
102+
95103
mergedMcpServers =
96104
transformedMcpServers
97105
// lib.mapAttrs (_: server: removeAttrs (lib.hm.mcp.addType server) [ "enabled" ]) cfg.mcpServers;
@@ -110,7 +118,7 @@ in
110118
''
111119
install -Dm644 ${
112120
jsonFormat.generate "claude-code-plugin.json" {
113-
name = "claude-code-home-manager";
121+
name = generatedPluginName;
114122
}
115123
} $out/.claude-plugin/plugin.json
116124
''
@@ -133,6 +141,12 @@ in
133141

134142
pluginEntries =
135143
lib.optional (generatedPluginFiles != [ ]) {
144+
# Keep the directory name as the long, stable `claude-code-home-manager`
145+
# rather than the short `generatedPluginName`: this entry becomes a
146+
# personal-plugin directory under `skills/`, and a short name like `hm`
147+
# would collide with valid `programs.claude-code.plugins.hm` or
148+
# `skills.hm`, failing the uniqueness assertions. The MCP tool prefix
149+
# already uses the short manifest name above.
136150
name = "claude-code-home-manager";
137151
source = generatedPlugin;
138152
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"name": "claude-code-home-manager"
2+
"name": "hm"
33
}

0 commit comments

Comments
 (0)