MCP File Upload Sample
Enables uploading files to MinIO (S3 compatible) via MCP tools. Supports Base64 file upload and optional curl command generation.
README
MCP File Upload Sample
MCP 経由でファイルを MinIO(S3 互換)にアップロードするサンプルです。MCP 実装は公式 TypeScript SDK を使用しています。
サーバーはクライアントがペイロードとして送り込んだデータ(Base64 または multipart)のみを処理し、ローカルディスクのファイルを読み出すことはありません。
前提
- Node.js 20+
- Yarn 1.x(
packageManager: yarn@1.22.22) - Docker(MinIO 用)
動作確認済みバージョン
| ソフトウェア | バージョン |
|---|---|
| Claude Desktop | 0.9.5 |
| Claude Code | 2.1.80 |
@modelcontextprotocol/sdk |
1.27.1 |
セットアップ
MinIO の起動
docker compose up -d
- API:
http://127.0.0.1:9000 - コンソール:
http://127.0.0.1:9001(認証情報はdocker-compose.ymlのMINIO_ROOT_*)
アプリの起動
yarn install
yarn build
# サーバー起動
yarn dev
環境変数
.env.example を参考に .env を作成してください。デフォルト値が設定されているため、MinIO をそのまま使う場合は .env なしでも動作します。
エンドポイント(HTTP モード)
| パス | 用途 |
|---|---|
GET /health |
ヘルスチェック |
POST /upload |
HTTP マルチパートアップロード(フィールド名 file) |
POST /mcp |
MCP(Streamable HTTP) |
MCP ツール
| ツール | デフォルト | 用途 |
|---|---|---|
upload_file |
有効 | Base64 エンコードされたファイルを MinIO にアップロード |
upload_via_curl |
コメントアウト | HTTP POST /upload への curl コマンドを返す |
upload_via_curl を有効にするには src/mcpServer.ts の registerUploadViaCurl(server, config) のコメントを外してビルドしてください。
Claude Desktop の設定
claude_desktop_config.json に Stdio 設定を記述します。
{
"mcpServers": {
"file-upload-sample": {
"command": "/Users/YOURNAME/.nvm/versions/node/v22.x.x/bin/node",
"args": [
"/Users/YOURNAME/project/mcp-file-upload-sample/dist/index.js",
"--stdio"
],
"env": {
"MINIO_ENDPOINT": "http://127.0.0.1:9000",
"MINIO_ROOT_USER": "minioadmin",
"MINIO_ROOT_PASSWORD": "minioadmin"
}
}
}
}
commandには Node.js 20+ のフルパスを指定してください(command -v nodeで確認)。argsのスクリプトパスには~を使わない絶対パスを指定してください(Desktop はシェルを経由しないため~が展開されません)。- パスの取得: リポジトリルートで
echo "$(pwd -P)/dist/index.js"を実行し、出力をそのままargs[0]に使います。
Claude Code の設定
claude mcp add file-upload-sample \
-s user \
-e MINIO_ENDPOINT=http://127.0.0.1:9000 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
-- node /Users/YOURNAME/project/mcp-file-upload-sample/dist/index.js --stdio
claude mcp list # 一覧
claude mcp remove file-upload-sample # 削除
注意
サンプル用途のコードです。オープンな環境では使わないようにしてください。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.