📢 Webサイト閉鎖と移転のお知らせ
このWebサイトは2026年9月に閉鎖いたします。
新しい記事は移転先で追加しております。(旧サイトでは記事を追加しておりません)
| 185行目: | 185行目: | ||
"command": "npx", | "command": "npx", | ||
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"] | "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"] | ||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
<br> | |||
==== プロジェクトルートのみ参照する場合 ==== | |||
.mcp.json / opencode.jsonファイルがあるディレクトリ自体を指すには、相対パス <u>.</u> を指定する。<br> | |||
<u>.</u> は、MCPサーバ起動時のカレントディレクトリ (一般的には、.mcp.jsonがあるプロジェクトルート) を指す。<br> | |||
<br> | |||
<u>.mcp.json</u> / <u>opencode.json</u> ファイルがあるディレクトリを作業ディレクトリとしてMCPサーバを起動するため、<u>.</u> でそのディレクトリを指定できる。<br> | |||
サブディレクトリに限定する場合は、<u>./src</u> のように指定する。<br> | |||
<br> | |||
<syntaxhighlight lang="json"> | |||
{ | |||
"mcpServers": { | |||
"filesystem": { | |||
"command": "npx", | |||
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."] | |||
} | } | ||
} | } | ||