Skip to content

officecli mcp claude registers to the wrong file (~/.claude/settings.json); Claude Code never loads it #154

Description

@vlasky

Summary

officecli mcp claude registers the MCP server in the wrong file~/.claude/settings.json — which Claude Code does not read MCP servers from. As a result the server is never loaded by Claude Code, yet officecli mcp list reports it as registered (false positive).

Claude Code loads MCP servers from ~/.claude.json (user scope) or a project-level .mcp.jsonnot from ~/.claude/settings.json. (settings.json is for permissions/hooks/env/model/etc.; an mcpServers key there is silently ignored.)

Environment

  • officecli 1.0.111 (installed via Homebrew)
  • macOS (Apple Silicon)
  • Claude Code (CLI)

Steps to reproduce

$ officecli mcp claude
Registered officecli MCP in Claude Code.
  Config: /Users/<me>/.claude/settings.json

$ claude mcp list | grep -i officecli
# (nothing — Claude Code does not see it)

$ officecli mcp list
  ...
  ✓ Claude Code     registered      # <-- false positive

officecli writes:

// ~/.claude/settings.json
"mcpServers": {
  "officecli": { "command": ".../officecli", "args": ["mcp"] }
}

but claude mcp list still does not list it, confirming Claude Code ignores mcpServers in settings.json.

Expected

After officecli mcp claude, the server should appear in claude mcp list and be usable in Claude Code.

Root cause

src/officecli/McpInstaller.cs:

// L120-124
private static string GetClaudeSettingsPath() =>
    Path.Combine(..., ".claude", "settings.json");        // wrong file

private static void InstallClaude() =>
    InstallJson("Claude Code", GetClaudeSettingsPath(), "mcpServers");

The status check (L277, CheckJsonStatus("Claude Code", GetClaudeSettingsPath())) reads the same wrong path, which is why it reports success.

Suggested fix

Target a location Claude Code actually loads. Two options:

  1. Preferred — shell out to the official CLI, which handles file + scope correctly across versions:
    claude mcp add -s user officecli -- officecli mcp
  2. Or write directly to ~/.claude.json under the top-level mcpServers key (user scope), instead of ~/.claude/settings.json.

Secondary issues

  • Uninstall leaves residue: officecli mcp uninstall claude removes the server entry but leaves an empty "mcpServers": {} key behind in settings.json.
  • Status check is a false positive: because install and status both read settings.json, officecli mcp list reports "registered" even though Claude Code never loads the server. The status check should verify the location Claude Code actually reads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions