baserCMS MCP Server
Model Context Protocol server implementation for operating baserCMS that enables GitHub Copilot and other agent modes to interact with baserCMS through its API.
README Documentation
basercms-mcp
baserCMSを操作するためのModel Context Protocol (MCP) サーバー実装です。Cline や GitHub Copilotのエージェントモードで利用できます。
Installation
npm install basercms-mcp
.env
ファイルを作成して必要な環境変数を設定
cp .env.example .env
# エディタで.envファイルを開き、必要な値を設定
必要な環境変数:
API_BASE_URL
: baserCMS APIのベースURLAPI_USER
: baserCMS APIのユーザー名(メールアドレス)API_PASSWORD
: baserCMS APIのパスワード
GitHub Copilotの場合
MCPサーバーの設定ファイルに設定を記載します。
~/Library/Application Support/Code/User/mcp.json
{
"servers": {
"basercms-mcp": {
"type": "stdio",
"command": "node",
"args": [
"dist/index.js"
]
}
}
}
Clineの場合
MCPサーバーの設定ファイルに設定を記載します。
# MacOSの場合
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
"mcpServers": {
"basercms-mcp": {
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "node",
"args": [
"dist/index.js"
],
"cwd": "{プロジェクトのフルパス}"
}
}
}
Claude Desktopの場合
MCPサーバーの設定ファイルに設定を記載します。
開発プロジェクト内での利用ではないため、環境変数を記載します。
# MacOSの場合
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"basercms-mcp-for-claude": {
"command": "node",
"args": [
"{basercms-mcpの設置フォルダ}/dist/index.js"
],
"cwd": "{basercms-mcpの設置フォルダ}",
"env": {
"API_BASE_URL": "{操作対象のサーバーのURL(例:https://localhost/)",
"API_USER": "{baserCMSのログインユーザー名(メールアドレス)}",
"API_PASSWORD": "{baserCMSのログインパスワード}"
}
}
}
}
Usage
baserCMS MCPサーバーは、baserCMSのWeb APIを通じて様々な機能を提供します。Cline や GitHub Copilotのエージェントモードから自然言語で操作できます。
使用例
# ブログ記事を作成する
「baserCMSの『News』コンテンツに『AI活用の新時代』というタイトルでブログ記事を作成してください」
# ブログ記事を検索する
「『AI』というキーワードでブログ記事を検索してください」
# 家具情報コンテンツを作成する
「新しく家具情報コンテンツをカスタムコンテンツで作ってください。フィールドの定義はお任せします。」
※ 事前にカスタムコンテンツプラグインを有効化してください。
# カスタムエントリーを作成する
「家具情報のカスタムコンテンツに新しい商品を追加してください」
ブログ機能(bc-blog)
ブログ記事(Blog Posts)
getBlogPost
- 指定IDのブログ記事を取得getBlogPosts
- ブログ記事一覧を取得(検索、ページング対応)addBlogPost
- ブログ記事を追加editBlogPost
- ブログ記事を編集deleteBlogPost
- ブログ記事を削除
ブログカテゴリ(Blog Categories)
getBlogCategory
- 指定IDのブログカテゴリを取得getBlogCategories
- ブログカテゴリ一覧を取得addBlogCategory
- ブログカテゴリを追加editBlogCategory
- ブログカテゴリを編集deleteBlogCategory
- ブログカテゴリを削除
ブログコンテンツ(Blog Contents)
getBlogContent
- 指定IDのブログコンテンツを取得getBlogContents
- ブログコンテンツ一覧を取得addBlogContent
- ブログコンテンツを追加editBlogContent
- ブログコンテンツを編集deleteBlogContent
- ブログコンテンツを削除
ブログタグ(Blog Tags)
getBlogTag
- 指定IDのブログタグを取得getBlogTags
- ブログタグ一覧を取得addBlogTag
- ブログタグを追加editBlogTag
- ブログタグを編集deleteBlogTag
- ブログタグを削除
カスタムコンテンツ機能(bc-custom-content)
カスタムテーブル(Custom Tables)
getCustomTable
- 指定IDのカスタムテーブルを取得getCustomTables
- カスタムテーブル一覧を取得addCustomTable
- カスタムテーブルを追加(カスタムフィールド関連付け)editCustomTable
- カスタムテーブルを編集deleteCustomTable
- カスタムテーブルを削除
カスタムフィールド(Custom Fields)
getCustomField
- 指定IDのカスタムフィールドを取得getCustomFields
- カスタムフィールド一覧を取得getIndexCustomFields
- インデックス用カスタムフィールドを取得addCustomField
- カスタムフィールドを追加editCustomField
- カスタムフィールドを編集deleteCustomField
- カスタムフィールドを削除
カスタムエントリー(Custom Entries)
getCustomEntry
- 指定IDのカスタムエントリーを取得getCustomEntries
- カスタムエントリー一覧を取得addCustomEntry
- カスタムエントリーを追加(ファイルアップロード対応)editCustomEntry
- カスタムエントリーを編集deleteCustomEntry
- カスタムエントリーを削除
カスタムコンテンツ(Custom Contents)
getCustomContent
- 指定IDのカスタムコンテンツを取得getCustomContents
- カスタムコンテンツ一覧を取得addCustomContent
- カスタムコンテンツを追加editCustomContent
- カスタムコンテンツを編集deleteCustomContent
- カスタムコンテンツを削除
カスタムリンク(Custom Links)
getCustomLink
- 指定IDのカスタムリンクを取得getCustomLinks
- カスタムリンク一覧を取得addCustomLink
- カスタムリンクを追加editCustomLink
- カスタムリンクを編集deleteCustomLink
- カスタムリンクを削除
システム機能(system)
サーバー情報(Server Info)
serverInfo
- サーバーのバージョンや環境情報を取得
Debugging
.vscode/launch.json
を以下のように設定します。
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug ts-node",
"runtimeArgs": [
"-r",
"ts-node/register"
],
"program": "${workspaceFolder}/src/index.ts",
"cwd": "${workspaceFolder}",
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.json"
},
"skipFiles": [
"<node_internals>/**"
],
"args": [
"${workspaceFolder}/request.json"
]
}
]
}
request.json ファイルを作成し、以下のように記述します。
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "{メソッド名}",
"arguments": {
"引数1": "引数1の値",
"引数2": "引数2の値",
}
}
}
ブレークポイントを設定してデバッグを実行します。