Enables AI assistants to interact with kintone data via the Model Context Protocol
kintone MCP Server (Python3) サンプル
kintone と連携するためのMCP (Model Context Protocol) サーバーのサンプル実装です。 このサーバーは、AI アシスタント(Claude等)が kintone のデータを読み取り、操作できるようにします。
主な特徴
- 🔐 セキュアな認証: APIトークン認証とパスワード認証の両方をサポート
- 📊 完全なCRUD操作: レコードの作成・読み取り・更新・削除が可能
- 📄 自動ページネーション: 大量のレコードを効率的に処理
- 🔍 高度なクエリ機能: kintoneのクエリ構文をフルサポート
- 📎 ファイル管理: ファイルのアップロード・ダウンロードに対応
- 💬 コメント機能: レコードへのコメント追加・取得
- 🔄 ステータス管理: プロセス管理のステータス更新
- 🚀 非同期処理: 高速なレスポンスと効率的なリソース使用
- 🛡️ 堅牢なエラー処理: 詳細なエラーメッセージと適切な例外処理
- 🌐 国際化対応: 多言語フィールドのサポート
利用可能なツール
レコード操作
| ツール名 | 説明 | 主な用途 |
|---|---|---|
get_record |
単一レコードの取得 | 特定のレコードの詳細情報を取得 |
get_records |
レコード一覧の取得(ページネーション付き) | 条件に合うレコードを検索・取得 |
get_all_records |
全レコードの自動取得 | 大量レコードの一括取得(自動ページネーション) |
add_record |
単一レコードの追加 | 新規レコードの作成 |
add_records |
複数レコードの一括追加(最大100件) | バッチ処理による効率的なレコード作成 |
update_record |
単一レコードの更新 | 既存レコードの情報更新 |
update_records |
複数レコードの一括更新(最大100件) | バッチ処理による効率的なレコード更新 |
コメント・ステータス操作
| ツール名 | 説明 | 主な用途 |
|---|---|---|
get_comments |
レコードのコメント取得 | コミュニケーション履歴の確認 |
add_comment |
レコードへのコメント追加 | メンション付きコメントの投稿 |
update_status |
レコードのステータス更新 | ワークフローの進行 |
update_statuses |
複数レコードのステータス一括更新 | 効率的なワークフロー処理 |
ファイル・アプリ管理
| ツール名 | 説明 | 主な用途 |
|---|---|---|
upload_file |
ファイルのアップロード | 添付ファイルの登録 |
download_file |
ファイルのダウンロード | 添付ファイルの取得 |
get_app |
アプリ情報の取得 | アプリ設定の確認 |
get_apps |
アプリ一覧の検索・取得 | 利用可能なアプリの探索 |
get_form_fields |
フォームフィールド設定の取得 | アプリ構造の理解 |
必要条件
- Python 3.12以上
- uv (推奨)
- kintone環境へのアクセス権限
- APIトークンまたはユーザー認証情報
MCPクライアント設定
Claude Desktop設定
Claude Desktopでこのサーバーを使用するには、設定ファイルに以下を追加してください。
設定ファイルの場所
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
uvxを使用(推奨)
GitHubから直接実行する設定:
{
"mcpServers": {
"kintone": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git",
"kintone-mcp-server-python3"
],
"env": {
"KINTONE_DOMAIN": "your-subdomain.cybozu.com",
"KINTONE_USERNAME": "your-username",
"KINTONE_PASSWORD": "your-password"
}
}
}
}
重要:
KINTONE_DOMAINは必ず実際の値に置き換えてください(例: dev-demo.cybozu.com)- 認証は、ユーザー名とパスワードの両方が指定されている場合はパスワード認証、そうでない場合はAPIトークン認証が使用されます
- 環境変数は
claude_desktop_config.json内に直接記載されます - 設定変更後はClaude Desktopを再起動してください
VS Code設定
VS CodeのMCP拡張機能を使用する場合:
{
"mcp.servers": {
"kintone": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git",
"kintone-mcp-server-python3"
],
"env": {
"KINTONE_DOMAIN": "your-subdomain.cybozu.com",
"KINTONE_API_TOKEN": "your-api-token"
}
}
}
}
複数環境の設定例
本番環境と開発環境を分けて管理する場合:
{
"mcpServers": {
"kintone-prod": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git",
"kintone-mcp-server-python3"
],
"env": {
"KINTONE_DOMAIN": "your-subdomain.cybozu.com",
"KINTONE_API_TOKEN": "prod-api-token"
}
},
"kintone-dev": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git",
"kintone-mcp-server-python3"
],
"env": {
"KINTONE_DOMAIN": "your-subdomain.cybozu.com",
"KINTONE_USERNAME": "dev-user",
"KINTONE_PASSWORD": "dev-password"
}
}
}
}
設定のポイント
uvxの利点
- 事前のインストールが不要
- 常に最新版を実行
- 依存関係の競合を回避
セキュリティの注意点
claude_desktop_config.jsonに kintoneへアクセスするための機密情報(ユーザー名, パスワード, APIトークン)を平文で保存する必要があります- このファイルを他人と共有しないでください
- Gitリポジトリにコミットしないよう注意してください
トラブルシューティング
よくある問題と解決方法
接続エラー
Error: Failed to connect to kintone
解決方法:
KINTONE_DOMAINが正しいか確認(例: dev-demo.cybozu.com)- ネットワーク接続を確認
- ファイアウォール設定を確認
認証エラー
Error: Authentication failed (401)
解決方法:
- ユーザー名,パスワードやAPIトークンが正しいか確認
- APIトークンに必要な権限があるか確認
- アプリの設定でAPIトークンが有効になっているか確認
権限エラー
Error: Permission denied (403)
解決方法:
- ユーザーにアプリへのアクセス権限があるか確認
- APIトークンに必要な権限が付与されているか確認
- レコードのアクセス権限を確認
デバッグモード
詳細なログを出力するには:
export LOG_LEVEL=DEBUG
uvx --from git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git kintone-mcp-server-python3
ソースコードをローカルインス
Tools (16)
get_recordRetrieves details for a single recordget_recordsRetrieves a list of records with paginationget_all_recordsRetrieves all records using automatic paginationadd_recordCreates a new recordadd_recordsCreates multiple records in bulkupdate_recordUpdates an existing recordupdate_recordsUpdates multiple records in bulkget_commentsRetrieves comments from a recordadd_commentAdds a comment to a recordupdate_statusUpdates the workflow status of a recordupdate_statusesUpdates statuses for multiple records in bulkupload_fileUploads a file to Kintonedownload_fileDownloads a file from Kintoneget_appRetrieves information about a specific appget_appsSearches and retrieves a list of appsget_form_fieldsRetrieves the form field configuration for an appEnvironment Variables
KINTONE_DOMAINrequiredYour Kintone subdomain (e.g., your-subdomain.cybozu.com)KINTONE_USERNAMEKintone username for password-based authenticationKINTONE_PASSWORDKintone password for password-based authenticationKINTONE_API_TOKENAPI token for token-based authenticationConfiguration
{"mcpServers": {"kintone": {"command": "uvx", "args": ["--from", "git+https://github.com/r3-yamauchi/kintone-mcp-server-python3.git", "kintone-mcp-server-python3"], "env": {"KINTONE_DOMAIN": "your-subdomain.cybozu.com", "KINTONE_USERNAME": "your-username", "KINTONE_PASSWORD": "your-password"}}}}