Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Documentation

on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch: # 手動トリガーも可能に

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: docs/package-lock.json

- name: Install dependencies
run: |
cd docs
npm ci

- name: Build site
run: |
cd docs
npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Cloudflare Workers
run: |
cd docs
npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Documentation site (deployed separately to Cloudflare Workers)
docs/

# Development
*.log
.DS_Store

# Git
.git/
.github/
.gitignore
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
.astro/
197 changes: 197 additions & 0 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# Deployment Guide

このドキュメントサイトは、Cloudflare Workers Static Assetsを使用して自動デプロイされます。

## 自動デプロイ(推奨)

GitHub Actionsを使用した自動デプロイが設定されています。

### トリガー条件

以下のタイミングで自動的にビルド&デプロイが実行されます:

- `main`ブランチへのプッシュ
- 新しいリリースの公開
- 手動トリガー(GitHub Actionsページから)

### 初回セットアップ

1. **Cloudflare API トークンを取得**
- Cloudflare Profile > API Tokens
- Create Token > "Edit Cloudflare Workers" テンプレートを選択
- Account Resources: 該当アカウントを選択
- Zone Resources: All zones (または特定のゾーン)
- トークンをコピー
Comment on lines +19 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify Cloudflare API token creation steps reflect current UI.

The API token creation steps reference "Cloudflare Profile > API Tokens" which may have changed in recent Cloudflare updates. Since Cloudflare periodically updates its dashboard UI, these instructions should be verified against the current Cloudflare documentation to ensure they don't mislead users who access an updated interface.


🌐 Web query:

What is the current UI path for creating Cloudflare API tokens in 2024-2025?

💡 Result:

Current UI path (2024–2025):

  • For user API tokens: Log in to the Cloudflare dashboard → click the profile/user icon (top-right) → My Profile → API Tokens → Create Token. [1][2]

  • For account (service) API tokens: Log in to the Cloudflare dashboard → Account Home / Manage Account → API Tokens → Create Token. [1][3]

References:
[1] Cloudflare Docs — Create API token.
[2] Cloudflare Docs — Cloudflare API overview.
[3] Cloudflare Docs — Roll tokens / account-token instructions.


Update Cloudflare API token creation steps to match current UI paths.

The documentation currently states "Cloudflare Profile > API Tokens," but the current Cloudflare UI (2024-2025) requires: click the profile/user icon (top-right) → My Profile → API Tokens → Create Token. Update the documentation to reflect this more accurate navigation path to prevent user confusion with the updated dashboard interface.

🤖 Prompt for AI Agents
In docs/DEPLOYMENT.md around lines 19 to 24, update the Cloudflare API token
creation instructions to reflect the current UI navigation: instruct users to
click the profile/user icon (top-right) → My Profile → API Tokens → Create
Token, then select the "Edit Cloudflare Workers" template and configure
Account/Zone resources as described, and ensure the sentence order and labels
match the current dashboard wording so readers are not misdirected.


2. **GitHubシークレットを設定**

リポジトリの Settings > Secrets and variables > Actions で以下を追加:

- `CLOUDFLARE_API_TOKEN`: 上記で作成したAPIトークン
- `CLOUDFLARE_ACCOUNT_ID`: CloudflareのAccount ID
- ダッシュボードのURLから取得: `dash.cloudflare.com/[Account ID]`

3. **設定ファイルの確認**

`docs/wrangler.toml` の内容を確認:
```toml
name = "create-mcp-tools-docs" # 任意の名前に変更可能
compatibility_date = "2024-01-01"

[assets]
directory = "dist"
not_found_handling = "404-page"
```

4. **完了!**

これで、`main`ブランチへのプッシュや新しいリリースの公開時に、自動的にドキュメントサイトが更新されます。

## 手動デプロイ

### 方法1: GitHub Actionsから手動実行

1. GitHubリポジトリの Actions タブを開く
2. "Deploy Documentation" ワークフローを選択
3. "Run workflow" ボタンをクリック

### 方法2: ローカルからWranglerでデプロイ

```bash
cd docs
npm install
npm run build
npx wrangler deploy
```

初回は認証が必要です:
```bash
npx wrangler login
```

## Cloudflare Workers Static Assetsについて

このプロジェクトは、Cloudflare Workers の Static Assets 機能を使用しています。

### 特徴

- **高速**: Cloudflareのグローバルネットワークでコンテンツを配信
- **スケーラブル**: 自動的にスケール、トラフィック制限なし
- **シンプル**: Workerスクリプト不要で静的ファイルを直接配信
- **無料**: 静的アセットへのリクエストは無料

### 仕組み

1. Astroで静的サイトをビルド → `dist/` ディレクトリに出力
2. Wranglerが `dist/` 内のファイルをCloudflareにアップロード
3. Cloudflareが静的アセットを自動的に配信(Workerスクリプト不要)

## データの更新

GitHubのリリースノートとREADMEは、ビルド時に自動的に取得されます。

- **リリース情報**: GitHub APIから最新5件を取得
- **README**: リポジトリルートの `README.md` を読み込み

ビルドスクリプト: `docs/scripts/fetch-github-data.js`

### GitHub APIレート制限について

デフォルトでは未認証でGitHub APIにアクセスするため、1時間あたり60リクエストの制限があります。

**推奨**: GitHub Personal Access Tokenを設定してレート制限を回避(1時間あたり5,000リクエスト)

1. [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens) でトークンを作成
2. スコープ: `public_repo` (または読み取り専用でOK)
3. 環境変数に設定:
- ローカル開発: `.env` ファイルに `GITHUB_TOKEN=your_token_here`
- GitHub Actions: すでに `secrets.GITHUB_TOKEN` が自動的に利用可能
- 本番ビルド: Cloudflare Workersの環境変数に設定(オプション)

## カスタムドメインの設定

### Workers.devサブドメイン

デプロイ後、自動的に `https://create-mcp-tools-docs.<your-subdomain>.workers.dev` でアクセス可能。

### カスタムドメイン

1. Cloudflareでドメインを管理
2. `wrangler.toml` に routes を追加:
```toml
routes = [
{ pattern = "docs.example.com", custom_domain = true }
]
```
3. 再デプロイ: `npx wrangler deploy`

または、Cloudflare Dashboardから設定:
1. Workers & Pages > create-mcp-tools-docs
2. Settings > Triggers > Custom Domains
3. "Add Custom Domain" でドメインを追加

## ローカル開発

### 開発サーバー

```bash
cd docs
npm run dev
```

ブラウザで `http://localhost:4321` を開く

### Wranglerでローカルプレビュー

```bash
cd docs
npm run build
npx wrangler dev
```

実際のWorkers環境と同じようにローカルでテスト可能。

## トラブルシューティング

### ビルドが失敗する

- Node.jsのバージョンを確認(20以上を推奨)
- `docs/package-lock.json` が最新か確認
- GitHub Actionsのログを確認

### GitHubデータが取得できない

- GitHub APIのレート制限に達していないか確認
- リポジトリが公開されているか確認
- `scripts/fetch-github-data.js` のリポジトリ名を確認

### デプロイはされるがサイトが表示されない

- `wrangler.toml` の設定を確認
- ビルド出力ディレクトリが `dist` になっているか確認
- Worker名が一意か確認
- Cloudflare Dashboardでデプロイログを確認

### Wranglerのデプロイエラー

```
Error: A request to the Cloudflare API failed.
```

- `CLOUDFLARE_API_TOKEN` が正しく設定されているか確認
- トークンに必要な権限があるか確認
- `CLOUDFLARE_ACCOUNT_ID` が正しいか確認

## コスト

Cloudflare Workersの無料プランでは:
- 100,000 リクエスト/日
- 静的アセットのストレージは無制限

通常のドキュメントサイトであれば、無料プラン内で運用可能です。

## 参考リンク

- [Cloudflare Workers Static Assets](https://developers.cloudflare.com/workers/static-assets/)
- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)
- [Astro Documentation](https://docs.astro.build/)
97 changes: 97 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# create-mcp-tools Documentation Site

このディレクトリには、create-mcp-toolsの静的ドキュメントサイトが含まれています。

Astroで構築され、GitHubのリリースノートとREADMEを動的に取得して表示します。

## 開発

### セットアップ

```bash
cd docs
npm install
```

### 開発サーバーの起動

```bash
npm run dev
```

ブラウザで `http://localhost:4321` を開くとサイトをプレビューできます。

### ビルド

```bash
npm run build
```

このコマンドは以下を実行します:
1. GitHubからリリースノートとREADMEを取得 (`scripts/fetch-github-data.js`)
2. Astroで静的サイトをビルド
3. `dist/` ディレクトリに出力

## デプロイ方法

### Cloudflare Workers Static Assetsへのデプロイ

1. Wranglerをインストール:
```bash
npm install -g wrangler
```

2. Cloudflareにログイン:
```bash
wrangler login
```

3. ビルドしてデプロイ:
```bash
npm run build
npx wrangler deploy
```

詳細は `DEPLOYMENT.md` を参照してください。

## ファイル構成

```
docs/
├── src/
│ ├── pages/ # ページファイル
│ │ ├── index.astro # 英語版トップページ
│ │ └── ja/
│ │ └── index.astro # 日本語版トップページ
│ ├── layouts/ # レイアウトコンポーネント
│ ├── components/ # 再利用可能なコンポーネント
│ └── data/ # GitHubから取得したデータ
├── scripts/
│ └── fetch-github-data.js # GitHubデータ取得スクリプト
├── astro.config.mjs # Astro設定
├── wrangler.toml # Cloudflare Workers設定
└── package.json

```

## 多言語対応

- 英語: `/` (デフォルト)
- 日本語: `/ja`

## 技術スタック

- **Astro**: 静的サイトジェネレーター
- **Cloudflare Workers**: Static Assets機能を使用
- **GitHub Actions**: 自動ビルド&デプロイ

## 注意事項

このディレクトリはnpmパッケージには含まれません。親ディレクトリの`.npmignore`で除外されています。

## デプロイURL

デプロイ後、以下のURLでアクセス可能:
- `https://create-mcp-tools-docs.<your-subdomain>.workers.dev`

カスタムドメインの設定方法は `DEPLOYMENT.md` を参照。
14 changes: 14 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'astro/config';

export default defineConfig({
output: 'static',
outDir: './dist',
site: process.env.SITE_URL || 'https://create-mcp-tools-docs.workers.dev',
i18n: {
defaultLocale: 'en',
locales: ['en', 'ja'],
routing: {
prefixDefaultLocale: false
}
}
});
Loading