summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-06-26 23:54:17 +0900
committertanaka takashi <isazaka@gmail.com>2026-06-26 23:54:17 +0900
commit3a9e8e18df4c596360da54000f65e1bebc6039c2 (patch)
tree0c6dc5fd75cc8f751ca6d7dca01c7e7b5fb3c9f5 /README.md
parenta296c2c3a294648c04286a5c027deddbbdc8d5ae (diff)
MCP機能追加
Diffstat (limited to 'README.md')
-rw-r--r--README.md65
1 files changed, 65 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7081436..e7f5232 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Starlette ベースの軽量なサーバーで、チャット、セッションä
- 会話セッションと添付ファイルのローカル保存
- 画像添付のリサイズと vision モデル向け送信
- Web 検索、URL スクレイピング、ファイル検索/取得、PDF テキスト抽出ツール
+- MCP クライアント機能:stdio / Streamable HTTP の MCP サーバーからツールを利用可能
- PIN 認証、CSRF 保護、CSP、ローカル配布のフロントエンド依存ファイル
- SSRF 対策付きの外部 URL 取得
@@ -75,6 +76,70 @@ ollama-web
| `OLLAMA_WEB_SECRET_KEY` | 起動時に自動生成 | Cookie 署名鍵 |
| `OLLAMA_WEB_ALLOWED_ORIGINS` | 未設定 | CORS 許可オリジンのカンマ区切り |
+### MCP サーバー設定
+
+`data/mcpServers.json` に接続先 MCP サーバーを記述します。ブラウザの左ペイン下部「MCP設定」からも編集・保存できます。
+
+stdio サーバーの例:
+
+```json
+{
+ "mcpServers": {
+ "calc": {
+ "command": "python",
+ "args": ["scripts/calc_server.py"]
+ },
+ "echo": {
+ "command": "python",
+ "args": ["scripts/echo_server.py"]
+ }
+ }
+}
+```
+
+Streamable HTTP サーバーの例:
+
+```json
+{
+ "mcpServers": {
+ "remote_calc": {
+ "url": "http://127.0.0.1:9000/mcp",
+ "headers": {
+ "Authorization": "Bearer optional-token"
+ },
+ "timeout": 30
+ }
+ }
+}
+```
+
+`scripts/` 以下には動作確認用の MCP サーバーが用意されています。
+
+```bash
+# stdio モードで起動
+python scripts/calc_server.py
+
+# Streamable HTTP モードで起動(既定ポート 9000)
+python scripts/calc_server.py streamable-http
+
+# ポートを明示して起動(ollama-web の 8000 と衝突しないように)
+python scripts/calc_server.py streamable-http 9001
+```
+
+テスト用 MCP サーバーは `scripts/test_stdio_servers.py` で一括動作確認できます。
+
+```bash
+python scripts/test_stdio_servers.py
+```
+
+対応パラメータ:
+
+| Transport | 必須 | 任意 |
+| --- | --- | --- |
+| stdio | `command` | `args`, `env`, `cwd`, `encoding`, `encoding_error_handler` |
+| Streamable HTTP | `url` | `headers`, `timeout`, `sse_read_timeout`, `terminate_on_close` |
+
+
### Security Notes
- 既定の待受は `127.0.0.1` です。LAN に公開する場合だけ `OLLAMA_WEB_HOST=0.0.0.0` を明示してください。