0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

rex0220 kSQL codex にグラフ表示

0
Last updated at Posted at 2026-05-26

kintone アプリを kSQL で結合して、codex にグラフ表示してみます。

概要

kSQL を使ってアプリを結合・集計して、codex にグラフを表示する例です。
プロンプトで要件を指示すると、SQLを組み立てて実行し、グラフ表示してくれます。

2026-05-26_18h32_49.png

kSQL MCP サーバーの設定

事前準備

設定を進める前に、以下の環境が整っていることを確認してください。

  • Node.js (v18以上推奨)
  • kintone 環境 (サブドメイン、ログイン資格情報、またはAPIトークン)
  • MCP対応クライアント codex
  • GitHub からダウンロードした ksql-mcp.js (Github-rex0220)

codex の設定ファイルに、kSQL MCP サーバーを追加します。

C:\Users\your-name\.codex\config.toml
[mcp_servers.ksql]
enabled = true
command = 'C:\Program Files (x86)\Nodist\v-x64\24.14.0\node.exe'
cwd = 'C:\Users\path\Documents\kSQL'
args = [
  'C:\Users\path\kintone-sql-tools\dist-mcp\ksql-mcp.js',
  '--config',
  'C:\Users\path\kintone-sql-tools\ksql.config.json',
  '--profile',
  'dev'
]

codex を 再立ち上げ

Exit 後に、codex を起動します。

2026-05-26_18h46_53.png

グラフ表示

codex のプロンプトで指示。
プロンプトで kSQL MCP を指定する必要があります。

kSQL MCP で、APP89 と APP88 を結合して、顧客ランク別の金額を集計してグラフ表示して

kSQL MCP 実行時に許可を行う必要がある。

2026-05-26_18h40_17.png

結果

kSQL MCP で APP88(案件管理)と APP89(顧客管理)を結合し、顧客ランク 別に 合計費用 を集計しました。

SELECT
  c.顧客ランク,
  SUM(a.合計費用) AS 金額
FROM APP88 a
JOIN APP89 c
  ON a.顧客管理レコード番号_関連レコード紐付け用 = c.レコード番号
GROUP BY c.顧客ランク
ORDER BY c.顧客ランク
顧客ランク 金額
A 4,400,000
B 8,500,000
C 6,000,000

Bランクが最大で、合計金額は 8,500,000円 です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?