Skip to content
Draft
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
25 changes: 22 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# microCMS Service Configuration
# Copy this file to .env and fill in your actual values

# ============================================
# Single Service Mode (従来の設定方法)
# ============================================
# Your microCMS service id (without .microcms.io)
# Example: If your URL is https://my-blog.microcms.io, set this to "my-blog"
MICROCMS_SERVICE_ID=your-service-id
Expand All @@ -9,6 +12,22 @@ MICROCMS_SERVICE_ID=your-service-id
# Get this from your microCMS dashboard
MICROCMS_API_KEY=your-api-key

# Note: You can also pass these as command line arguments:
# node dist/index.js --service-id your-service-id --api-key your-api-key
# Command line arguments take precedence over environment variables.
# ============================================
# Multi Service Mode (複数サービス対応)
# ============================================
# 複数のmicroCMSサービスに接続する場合は、以下の形式でJSON配列を設定します。
# MICROCMS_SERVICES が設定されている場合、上記の単一サービス設定より優先されます。
#
# 例: 2つのサービス (blog と shop) に接続する場合
# MICROCMS_SERVICES=[{"id":"blog","apiKey":"your-blog-api-key"},{"id":"shop","apiKey":"your-shop-api-key"}]
#
# 複数サービスモードでは、各ツール呼び出し時に serviceId パラメータを指定します。
# ツール名は単一サービスモードと同じ microcms_* 形式です。
# 設定済みサービスの一覧は microcms://services リソースで確認できます。

# ============================================
# Notes
# ============================================
# - You can also pass these as command line arguments (single service mode only):
# node dist/index.js --service-id your-service-id --api-key your-api-key
# - Command line arguments take precedence over environment variables.
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

82 changes: 81 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Claude Desktopに導入する場合、mcpbファイルを使って簡単にイ
2. ダウンロードしたmcpbファイルをダブルクリックで開く
3. サービスIDとAPIキーを設定する

### 方法2: npx をつかう
### 方法2: npx をつかう(単一サービス)

```json
{
Expand All @@ -38,6 +38,43 @@ Claude Desktopに導入する場合、mcpbファイルを使って簡単にイ

設定更新後はクライアントを再起動してください。

### 方法3: 複数サービスを使う

複数のmicroCMSサービスに接続する場合は、`MICROCMS_SERVICES` 環境変数にJSON形式でサービス情報を設定します。

```json
{
"mcpServers": {
"microcms-multi": {
"command": "npx",
"args": ["-y", "microcms-mcp-server@latest"],
"env": {
"MICROCMS_SERVICES": "[{\"id\":\"blog\",\"apiKey\":\"xxx-api-key\"},{\"id\":\"shop\",\"apiKey\":\"yyy-api-key\"}]"
}
}
}
}
```

#### 複数サービスモードの動作

複数サービスモードでは、各ツールに `serviceId` パラメータが必須になります。

- ツール名は単一サービスモードと同じ `microcms_*` 形式です
- 各ツール呼び出し時に `serviceId` を指定してサービスを選択します
- 設定済みサービスの一覧は `microcms_get_services` ツールで確認できます
- MCPリソース `microcms://services` からも同様の情報を取得できます

#### 後方互換性

| 設定方法 | モード | serviceIdパラメータ |
|---------|-------|-------------------|
| `MICROCMS_SERVICE_ID` + `MICROCMS_API_KEY` | 単一サービス | 省略可(自動でデフォルトサービスを使用) |
| `MICROCMS_SERVICES` (JSON) | 複数サービス | 必須 |

- 従来の環境変数設定をそのまま使う場合、serviceIdを指定せずに今まで通り動作します
- 両方の設定が存在する場合、`MICROCMS_SERVICES` が優先されます

## 利用方法

microCMSのコンテンツを確認する
Expand Down Expand Up @@ -68,6 +105,49 @@ microCMSのメディア一覧に画像をアップロードする
- https://example.com/sample-image-3.png
```

### 複数サービスモードでの使用例

複数サービスモードでは、サービスIDを指定して各サービスを操作できます。

```
blogサービスの記事一覧を取得して
```

```
shopサービスに新しい商品を追加して
```

```
blogの最新記事をshopの商品説明にコピーして
```

#### サービス一覧の確認

`microcms://services` リソースを読み取ることで、設定済みサービスと各サービスのAPI(エンドポイント)一覧を確認できます。AIエージェントはこの情報を使って、指定されたendpointがどのサービスに属するか判断できます。

```json
{
"mode": "multi",
"description": "Multi service mode - serviceId parameter is required for all tools. Use the serviceId that contains the endpoint you need.",
"services": [
{
"id": "blog",
"apis": [
{ "name": "ブログ記事", "endpoint": "blogs", "type": "list" },
{ "name": "カテゴリー", "endpoint": "categories", "type": "list" }
]
},
{
"id": "shop",
"apis": [
{ "name": "商品", "endpoint": "products", "type": "list" },
{ "name": "注文", "endpoint": "orders", "type": "list" }
]
}
]
}
```

### より詳しい使い方

以下の記事でより詳しい使い方を紹介しています。
Expand Down
39 changes: 39 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.4/schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noExplicitAny": "warn",
"noConsole": "off"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80
},
"javascript": {
"formatter": {
"semicolons": "always",
"quoteStyle": "single",
"trailingCommas": "es5"
}
},
"files": {
"includes": ["src/**"]
}
}
23 changes: 0 additions & 23 deletions eslint.config.js

This file was deleted.

Loading