0
0

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 Desktopを試してみた

Last updated at Posted at 2025-05-31

背景・目的

以前、下記の通りMCPについて基本を整理しました。今回はClaude Desktopでクライアント側でMCPの動作を確認してみます

まとめ

下記にFilesystem MCP Serverの特徴をまとめました

特徴 説明
概要 ファイルシステム操作用のMCPを実装する Node.js サーバー
機能 ・Read/write files
・Create/list/delete directories
・Move files/directories
・Search files
・Get file metadata
License MITライセンス

概要

アーキテクチャ

以前まとめた下記の通り、MCPはMCPホスト、MCPサーバ、データソースの3層で構成されています。

  • MCPホストは、Claude DespktopやIDEなどMCPプロトコルを通じてデータにアクセスするプログラム、AIツール
    • MCPクライアントは、MCPサーバと1:1接続するプログラム
    • LLMは、MCPホスト側に存在します
  • MCPサーバは、MCPプロトコルを通じて機能を提供するプログラム
  • データソースは、MCPサーバよりアクセス可能なローカルファイル、社内DBは、クラウド上のREST APIなど

Filesystem MCP Server

下記について整理します。

  • ファイルシステム操作用のMCPを実装する Node.js サーバー
  • 下記の機能を有します
    • Read/write files
    • Create/list/delete directories
    • Move files/directories
    • Search files
    • Get file metadata

Usage with Claude Desktop

  • claude_desktop_config.json に以下を追加します
  • サンドボックス化されたディレクトリを /projects にマウントすることで、サーバーに提供できる
  • ro フラグを追加すると、そのディレクトリはサーバーによって読み取り専用になる
  • Docker
{
  "mcpServers": {
    "filesystem": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
        "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
        "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
        "mcp/filesystem",
        "/projects"
      ]
    }
  }
}
  • NPX
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop",
        "/path/to/other/allowed/dir"
      ]
    }
  }
}

License

MITラインセンス

実践

Claude Desktopで試す

下記を元に試します。
https://modelcontextprotocol.io/quickstart/user

下記を使用します。

下記の構成になります。
image.png

事前準備

  1. 事前にClaude Desktopをダウンロードしておきます

  2. nodeにパスを通します

    % which node
    /usr/local/opt/node@20/bin/node
    % 
    % sudo ln -s /usr/local/opt/node@20/bin/node /usr/local/bin/node
    

セットアップ

  1. Claude Desktopを開きます

  2. Claude>設定をクリックします
    image.png

  3. 「開発者」>「構成を編集」をクリックします
    image.png

  4. claude_desktop_config.jsonが作成されます

  5. 下記を入力します

    {
      "mcpServers": {
        "filesystem": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-filesystem",
            "/Users/username/Desktop",
            "/path/to/other/allowed/dir"
          ]
        }
      }
    }
    
  6. Claude Desktopを再起動します

  7. 下記のように設定されました
    image.png

  8. 「filesystem」が追加されていました
    image.png

  9. 「filesystem」をクリックすると、有効/無効が選択できます
    image.png

  10. 次を「デスクトップに、claude_test.txtファイルを作成し、今日の日付(JST)を入力して」とプロンプトを入力します
    image.png

  11. ポップアップが表示されるので、許可します(どちらでも問題ありません。)
    image.png

  12. できました
    image.png

  13. ファイルもできました。(日時を指定すればよかったです)

    % ls -l claude_test.txt 
    -rw-r--r--@ 1 XXXX  XXXX  25  5 31 17:35 claude_test.txt
    % cat claude_test.txt 
    2025年5月31日(土)
    % 
    

考察

今回は、Claude Desktopを試してみました。次回はMCPさーばをためしてみm

参考

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?