diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..9d269a1 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,3 @@ +[mcp_servers.chatwork] +command = "docker" +args = ["run", "--rm", "-i", "--env-file", ".env", "chatwork-mcp-server"] diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e8163c7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +node_modules +dist +.git +.github +.devcontainer +.env +.env.test +npm-debug.log diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..03cc29b --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +CHATWORK_API_TOKEN= diff --git a/.gitignore b/.gitignore index c98b30e..734ee03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules dist -.env.test \ No newline at end of file +.env +.env.test diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7538077 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:22-bookworm-slim AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY src ./src +COPY tsconfig.json ./ +RUN npm run build + +FROM node:22-bookworm-slim AS runner + +WORKDIR /app + +COPY --from=builder /app/dist ./dist + +CMD ["node", "dist/index.js"] diff --git a/README.md b/README.md index 254e364..cebe247 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Chatwork を AI から操作するための MCP (Model Context Protocol) サーバーです。 +英語版は [README_en.md](README_en.md) を参照してください。 + ## 使い方 Claude Desktop を例に説明します。 @@ -28,3 +30,45 @@ Claude Desktop を例に説明します。 ``` 今後、MCP に対応した AI ツールが増える可能性があります。使い方を追加してほしいツールがあった場合、あなたのコントリビュートをお待ちしています! + +## Docker + Codex + +Docker を使って Codex から利用する場合は、以下の手順でセットアップします。 + +1. `.env` を作成し、Chatwork API token を設定する + +```sh +cp .env.example .env +``` + +`.env` に `CHATWORK_API_TOKEN` を設定してください。 + +2. Docker イメージをビルドする + +```sh +docker build -t chatwork-mcp-server . +``` + +3. プロジェクトローカルの Codex 設定 [`.codex/config.toml`](.codex/config.toml) を使う + +```toml +[mcp_servers.chatwork] +command = "docker" +args = ["run", "--rm", "-i", "--env-file", ".env", "chatwork-mcp-server"] +``` + +4. このプロジェクトルートで Codex を起動する + +```sh +codex +``` + +5. Codex をすでに開いていた場合は、新しいセッションを開始するか再起動する + +6. Codex 内で `/mcp` を開き、`chatwork` が表示されることを確認する + +補足: + +- Codex はこの設定では `.mcp.json` ではなく `.codex/config.toml` を使います +- `docker run -d ...` で事前に常駐コンテナを起動しておく必要はありません +- `.env` はプロジェクトルートに置く前提です diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..d730c87 --- /dev/null +++ b/README_en.md @@ -0,0 +1,72 @@ +# Chatwork MCP Server + +Chatwork MCP (Model Context Protocol) server for operating Chatwork from AI tools. + +## Usage + +The following example uses Claude Desktop. + +1. Start Claude Desktop +2. Click "Settings" from the menu +3. Click the "Developer" tab +4. Click "Edit Config" +5. When `claude_desktop_config.json` opens in your editor, update it with the following +6. Add this configuration + +```json +{ + "mcpServers": { + "chatwork": { + "command": "npx", + "args": ["@chatwork/mcp-server"], + "env": { + "CHATWORK_API_TOKEN": "YOUR_CHATWORK_API_TOKEN" + } + } + } +} +``` + +As more AI tools add MCP support, we may add more usage examples here. + +## Docker + Codex + +To use this server from Codex with Docker, set it up as follows. + +1. Create `.env` and set your Chatwork API token + +```sh +cp .env.example .env +``` + +Set `CHATWORK_API_TOKEN` in `.env`. + +2. Build the Docker image + +```sh +docker build -t chatwork-mcp-server . +``` + +3. Use the project-local Codex configuration in [`.codex/config.toml`](.codex/config.toml) + +```toml +[mcp_servers.chatwork] +command = "docker" +args = ["run", "--rm", "-i", "--env-file", ".env", "chatwork-mcp-server"] +``` + +4. Start Codex from this project root + +```sh +codex +``` + +5. If Codex was already open, start a new session or restart it + +6. Open `/mcp` in Codex and confirm that `chatwork` is listed + +Notes: + +- For this setup, Codex uses `.codex/config.toml`, not `.mcp.json` +- You do not need to start a long-running container with `docker run -d ...` in advance +- `.env` is expected to exist at the project root diff --git a/package.json b/package.json index 3a8f5ea..4b4d263 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "type-check": "tsc", "test": "vitest run", "build": "esbuild src/index.ts --minify --bundle --platform=node --format=esm --outfile=dist/index.js", - "dev": "npm run build -- --watch" + "dev": "npm run build -- --watch", + "docker:build": "docker build -t chatwork-mcp-server ." }, "repository": { "type": "git",