0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code上のmcp設定をJsonから変更したい場合

Last updated at Posted at 2025-06-11

背景

ClaudeCodeには以下のコマンドでClaudeForDesktopにて設定していたMCPサーバの情報を一気に引き継ぐ機能があります。

$ claude mcp add-from-claude-desktop

これで自分が設定していたMCPのjson情報が引き継げたものの、filesystemMCPやObsidianMCPのファイル参照がWSL上だと違うパスになるのでエラーになります。
ClaudeDesktopでは「構成情報を変更」ボタンで簡単にJsonを直変更できますが、ClaudeCodeの場合はどこをいじるべきか自分で探しに行く必要があったので、どの部分を変更したか備忘録として残しておきます。

実行環境

Windows11
Ubuntu 24.04.2 LTS On WSL2
Claude Code 1.0.18
Claude Desktop 0.10.14

手順

WSL上で claude mcp とコマンドを実行すると以下のような説明が出てきます

Usage: claude mcp [options] [command]

Configure and manage MCP servers

Options:
  -h, --help                                     Display help for command

Commands:
  serve [options]                                Start the Claude Code MCP server
  add [options] <name> <commandOrUrl> [args...]  Add a server
  remove [options] <name>                        Remove an MCP server
  list                                           List configured MCP servers
  get <name>                                     Get details about an MCP server
  add-json [options] <name> <json>               Add an MCP server (stdio or SSE) with a JSON string
  add-from-claude-desktop [options]              Import MCP servers from Claude Desktop (Mac and WSL only)
  reset-project-choices                          Reset all approved and rejected project-scoped (.mcp.json) servers within this project
  help [command]                                 display help for command

前提として、ClaudeCodeにてnpmを使わないローカル環境への移動をしている必要があります

╭────────────────────────────────────────────────────────╮                                                                                                                                                                          
│ ✻ Welcome to Claude Code!                              │                                                                                                                                                                          
│                                                        │                                                                                                                                                                          
│   /help for help, /status for your current setup       │                                                                                                                                                                          
│                                                        │                                                                                                                                                                          
│   cwd: Hogehoge  │                                                                                                                                                                          
╰────────────────────────────────────────────────────────╯                                                                                                                                                                          

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > /migrate-installer                                                                                                                                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

上記設定も終わると、.claude.jsonにmcpの設定が載っていましたので、そこを編集してmcpの情報を更新できました。

$ vi /home/{UserName}/.claude.json
・・・中略・・・
"mcpServers": {                                                                                                                                                                                                               
        "filesystem": {                                                                                                                                                                                                             
          "command": "npx",
          "args": [                                                                                                                                                                                                                 
            "-y"
            "path"
          ]                                                                                                                                                                                                                         
        },
        "obsidian-mcp-tools": {
          "command": "path",
          "args": [],
          "env": {                                                                                                                                                                                                                  
            "OBSIDIAN_API_KEY": "abcdefghijklmnopqrstuvwxyz"
          }                                                                                                                                                                                                                         
        }
      },
・・・・・・・
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?