reportflow-mcp 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -173
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,70 +1,22 @@
|
|
|
1
1
|
# reportflow-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/reportflow-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
|
|
5
|
-
MCP
|
|
6
|
+
An MCP (Model Context Protocol) server that turns your [ReportFlow](https://re-port-flow.com) templates into PDF reports — invoices, contracts, statements, anything you've designed — straight from Claude or any other MCP-compatible AI agent.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## What it does
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
- Generate PDFs from natural-language requests like *"create an invoice for Acme Corp totalling $300"*
|
|
11
|
+
- Expose your ReportFlow designs and their parameter schemas directly to the AI as MCP **Resources**
|
|
12
|
+
- Bulk-generate many PDFs and download them as a single ZIP
|
|
13
|
+
- Save outputs to whichever workspace folder the user is currently in (Claude Desktop / Claude Code / Cursor / VS Code all supported)
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|--------|------|
|
|
13
|
-
| `authenticate` | **初回認証 / 再認証**。ブラウザで OAuth2 + ワークスペース選択を行い、トークンを keychain (または XDG file) に保存 |
|
|
14
|
-
| `list_templates` | ワークスペース内のデザイン一覧を取得 |
|
|
15
|
-
| `get_design_parameters` | デザインに必要なパラメータ構造を取得 |
|
|
16
|
-
| `generate_pdf_sync` | PDF を同期生成してローカルパスを返す |
|
|
17
|
-
| `generate_pdf_async` | PDF を非同期生成して requestId を返す |
|
|
18
|
-
| `generate_pdfs_sync` | 複数 PDF を一括同期生成(ZIP)してローカルパスを返す |
|
|
19
|
-
| `generate_pdfs_async` | 複数 PDF を一括非同期生成して requestId を返す |
|
|
20
|
-
| `download_file` | 非同期生成した単一 PDF をダウンロード |
|
|
21
|
-
| `download_zip` | 非同期生成した ZIP をダウンロード |
|
|
22
|
-
| `suggest_params` | **Sampling 使用**。自然文の要件からクライアント AI に params JSON を整形させる |
|
|
15
|
+
## Setup
|
|
23
16
|
|
|
24
|
-
###
|
|
17
|
+
### Claude Desktop / Claude Code / Cursor
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|--------|------|
|
|
28
|
-
| `/generate_pdf` | 単一 PDF 生成のステップガイド。`designId` / `description` / `outputDir` を引数として受け取ります |
|
|
29
|
-
| `/generate_pdfs` | 複数 PDF 一括生成のステップガイド。`designId` / `source` / `outputDir` / `zipFileName` |
|
|
30
|
-
| `/reportflow_help` | 提供機能の概要ヘルプ |
|
|
31
|
-
|
|
32
|
-
### Resources(AI のコンテキストに負担をかけず貼り付けられる生データ)
|
|
33
|
-
|
|
34
|
-
| URI | 概要 |
|
|
35
|
-
|-----|------|
|
|
36
|
-
| `reportflow://designs` | デザイン一覧(`list_templates` 同等の JSON) |
|
|
37
|
-
| `reportflow://designs/{designId}/parameters` | 各デザインのパラメータスキーマ(動的テンプレート) |
|
|
38
|
-
| `reportflow://errors` | Content Service が返す主要エラーメッセージカタログ |
|
|
39
|
-
| `reportflow://server-info` | サーバー提供機能・対応ワークフローの概観 |
|
|
40
|
-
|
|
41
|
-
### Sampling
|
|
42
|
-
|
|
43
|
-
`suggest_params` ツールは `sampling/createMessage` を使い、**サーバー側 API キーを持たずにクライアント AI に作業を委譲**します。スキーマを入手した上で自然文の要件を params JSON に整形し、解釈不可なら一回だけ自己修正します。Sampling 未対応クライアント (stdio 単体を読んでいる補助ツール等) では当該ツールはエラーとなります。
|
|
44
|
-
|
|
45
|
-
### Roots
|
|
46
|
-
|
|
47
|
-
`generate_pdf_sync` / `generate_pdfs_sync` で `outputDir` 未指定時、クライアントが提示するワークスペース (Roots) の最初の `file://` を outputDir として使用します。VS Code ・ Claude Desktop から接続したときはそのワークスペース直下に出力されます。Roots 未対応クライアント・取得失敗時は OS 一時ディレクトリ (`<tmp>/reportflow`) にフォールバックします。
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 認証方式
|
|
52
|
-
|
|
53
|
-
OAuth2 **authorization_code + PKCE (S256)** Public client。シークレット (`client_secret`) は使用しません。
|
|
54
|
-
|
|
55
|
-
- 公式 OAuth client (`reportflow-mcp`) は ReportFlow 側で配布済み — **ユーザー側で発行作業は不要**
|
|
56
|
-
- MCP は `authenticate` ツール起動でブラウザを開き、ログイン → ワークスペース選択 → consent → JWT 取得 → ローカル保存
|
|
57
|
-
- consent 画面で毎回ワークスペースを選択 → 同じインストールで複数ワークスペース横断で利用可能
|
|
58
|
-
- 取得 JWT は OS の **Keychain** (macOS Keychain / Windows Credential Manager / Linux libsecret) に優先保存。失敗時は XDG file (chmod 0600) にフォールバック
|
|
59
|
-
- access_token 失効時は refresh_token で自動更新
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## セットアップ
|
|
64
|
-
|
|
65
|
-
### 1. Claude Code (`.mcp.json`)
|
|
66
|
-
|
|
67
|
-
プロジェクトの `.mcp.json` に以下を追加するだけ:
|
|
19
|
+
Add the following to your config file (`.mcp.json`, `claude_desktop_config.json`, `~/.cursor/mcp.json`, etc.):
|
|
68
20
|
|
|
69
21
|
```json
|
|
70
22
|
{
|
|
@@ -77,148 +29,95 @@ OAuth2 **authorization_code + PKCE (S256)** Public client。シークレット (
|
|
|
77
29
|
}
|
|
78
30
|
```
|
|
79
31
|
|
|
80
|
-
env
|
|
32
|
+
That's the whole setup. No env vars, no API keys, no secrets to manage.
|
|
81
33
|
|
|
82
|
-
###
|
|
34
|
+
### VS Code (MCP-enabled builds)
|
|
83
35
|
|
|
84
|
-
|
|
36
|
+
Same JSON in `.vscode/mcp.json`.
|
|
85
37
|
|
|
86
|
-
###
|
|
38
|
+
### Requirements
|
|
87
39
|
|
|
88
|
-
|
|
40
|
+
- Node.js 18+ (auto-fetched by `npx`)
|
|
41
|
+
- A local environment with a browser (only required during the first login)
|
|
42
|
+
- A [ReportFlow](https://re-port-flow.com) account
|
|
89
43
|
|
|
90
|
-
|
|
91
|
-
ReportFlow で認証して
|
|
92
|
-
```
|
|
44
|
+
## Usage
|
|
93
45
|
|
|
94
|
-
|
|
95
|
-
以後はトークンが期限切れになるまで他のツール (list_templates 等) を使えます。期限切れは自動 refresh、refresh も失敗したら `authenticate` を再実行してください。
|
|
46
|
+
### 1. First-run authentication
|
|
96
47
|
|
|
97
|
-
|
|
48
|
+
After reloading the MCP client, ask the AI:
|
|
98
49
|
|
|
99
|
-
|
|
50
|
+
> Authenticate with ReportFlow
|
|
100
51
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
| `REPORTFLOW_CLIENT_ID` | 任意 | `reportflow-mcp` | 公式 client_id を上書きする場合のみ |
|
|
104
|
-
| `REPORTFLOW_API_BASE_URL` | 任意 | `https://api.re-port-flow.com` | Content Service の URL (staging/local で上書き) |
|
|
105
|
-
| `REPORTFLOW_AUTH_URL` | 任意 | `https://re-port-flow.com/api/v1` | ReportFlow OAuth2 サーバーのベース URL (staging/local で上書き) |
|
|
106
|
-
| `REPORTFLOW_CALLBACK_PORT` | 任意 | `53682` | ローカルコールバックサーバーのポート (redirect_uri と一致必須) |
|
|
107
|
-
| `REPORTFLOW_SCOPE` | 任意 | `openid profile designs:read designs:write templates:read templates:write pdf:generate` | 要求スコープ (空白区切り) |
|
|
108
|
-
| `REPORTFLOW_TOKEN_STORE` | 任意 | 自動 (keychain → file) | `keychain` / `file` 強制指定 |
|
|
109
|
-
| `REPORTFLOW_TOKEN_STORE_PATH` | 任意 | `$XDG_STATE_HOME/reportflow-mcp` | file モード時の保存ディレクトリ |
|
|
52
|
+
A browser window opens. **Sign in → pick a workspace → consent**, and you're done.
|
|
53
|
+
Tokens are stored in your OS keychain (macOS Keychain / Windows Credential Manager / Linux libsecret) and refreshed automatically.
|
|
110
54
|
|
|
111
|
-
|
|
55
|
+
### 2. Generate a PDF
|
|
112
56
|
|
|
113
|
-
|
|
57
|
+
#### Natural language (easiest)
|
|
114
58
|
|
|
115
|
-
|
|
59
|
+
> Using the invoice template, create a PDF for Acme Corp totalling $330.
|
|
116
60
|
|
|
117
|
-
|
|
118
|
-
0. authenticate → 初回のみ。ブラウザでログイン・workspace 選択
|
|
119
|
-
1. list_templates → designId 一覧を確認
|
|
120
|
-
2. get_design_parameters → designId でパラメータ構造を確認
|
|
121
|
-
3. generate_pdf_sync → パラメータを埋めて PDF を即時生成
|
|
122
|
-
```
|
|
61
|
+
The AI will look up the template via `list_templates`, fetch its parameter schema with `get_design_parameters`, fill in the values, and call `generate_pdf_sync` — returning a local file path.
|
|
123
62
|
|
|
124
|
-
|
|
63
|
+
#### Slash commands
|
|
125
64
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
65
|
+
| Command | Purpose |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `/generate_pdf` | Step-by-step recipe for a single PDF |
|
|
68
|
+
| `/generate_pdfs` | Recipe for batch PDF generation |
|
|
69
|
+
| `/reportflow_help` | Quick feature tour |
|
|
131
70
|
|
|
132
|
-
|
|
133
|
-
suggest_params ツールを呼び、返った params を generate_pdf_sync に渡して
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### 2. 非同期生成(大量ファイル向け)
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
0. authenticate → 初回のみ
|
|
140
|
-
1. list_templates → designId 一覧を確認
|
|
141
|
-
2. get_design_parameters → パラメータ構造を確認
|
|
142
|
-
3. generate_pdfs_async → 複数件を非同期生成
|
|
143
|
-
4. download_zip → requestId で ZIP をダウンロード
|
|
144
|
-
```
|
|
71
|
+
### 3. Where files are saved
|
|
145
72
|
|
|
146
|
-
|
|
73
|
+
Output location is resolved in this order:
|
|
147
74
|
|
|
148
|
-
|
|
75
|
+
1. Explicit instruction from the user (e.g. *"save to my Desktop"*)
|
|
76
|
+
2. The currently-open workspace root (Claude Code / Cursor / VS Code)
|
|
77
|
+
3. The OS temp directory as fallback
|
|
149
78
|
|
|
150
|
-
|
|
151
|
-
2. クライアントが Roots を提示 (VS Code / Claude Desktop のワークスペース等) → そのパス
|
|
152
|
-
3. いずれもない → OS 一時ディレクトリ (`<tmp>/reportflow`)
|
|
79
|
+
## Reference
|
|
153
80
|
|
|
154
|
-
|
|
81
|
+
### Tools (called by the AI)
|
|
155
82
|
|
|
156
|
-
|
|
83
|
+
| Tool | Purpose |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `authenticate` | First-time / re-authentication |
|
|
86
|
+
| `list_templates` | List available designs |
|
|
87
|
+
| `get_design_parameters` | Fetch the parameter schema for a design |
|
|
88
|
+
| `generate_pdf_sync` / `_async` | Generate one PDF (sync returns path; async returns request ID) |
|
|
89
|
+
| `generate_pdfs_sync` / `_async` | Generate many PDFs (returns a ZIP) |
|
|
90
|
+
| `download_file` / `download_zip` | Download artifacts produced by async tools |
|
|
91
|
+
| `suggest_params` | Translate a natural-language brief into a `params` JSON via MCP Sampling (requires a Sampling-capable client) |
|
|
157
92
|
|
|
158
|
-
|
|
93
|
+
### Resources (attachable as AI context)
|
|
159
94
|
|
|
160
|
-
|
|
95
|
+
| URI | Contents |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `reportflow://designs` | List of available designs |
|
|
98
|
+
| `reportflow://designs/{designId}/parameters` | Parameter schema for one design |
|
|
99
|
+
| `reportflow://errors` | Catalog of error messages from the Content Service |
|
|
100
|
+
| `reportflow://server-info` | Server feature overview |
|
|
161
101
|
|
|
162
|
-
|
|
163
|
-
## ReportFlow MCP 帳票生成
|
|
102
|
+
### Prompts (slash-command recipe cards)
|
|
164
103
|
|
|
165
|
-
|
|
104
|
+
`/generate_pdf`, `/generate_pdfs`, `/reportflow_help` — pass arguments and the AI follows the prepared workflow.
|
|
166
105
|
|
|
167
|
-
|
|
168
|
-
|--------|------|
|
|
169
|
-
| `authenticate` | 初回認証 / 再認証 (他のツールが認証エラーを出したら最初に呼ぶ) |
|
|
170
|
-
| `list_templates` | デザイン一覧取得(designId の確認に使う) |
|
|
171
|
-
| `get_design_parameters` | 指定デザインの必要パラメータ構造を取得 |
|
|
172
|
-
| `generate_pdf_sync` | 単一 PDF を即時生成 → ローカルパスを返す |
|
|
173
|
-
| `generate_pdf_async` | 単一 PDF を非同期生成 → requestId + fileId を返す |
|
|
174
|
-
| `generate_pdfs_sync` | 複数 PDF を一括即時生成 → ZIP パスを返す |
|
|
175
|
-
| `generate_pdfs_async` | 複数 PDF を一括非同期生成 → requestId を返す |
|
|
176
|
-
| `download_file` | requestId + fileId でファイルをダウンロード |
|
|
177
|
-
| `download_zip` | requestId で ZIP をダウンロード |
|
|
178
|
-
| `suggest_params` | 自然文要件 + スキーマから params JSON を Sampling で生成 |
|
|
106
|
+
## Troubleshooting
|
|
179
107
|
|
|
180
|
-
|
|
108
|
+
| Symptom | Fix |
|
|
109
|
+
|---|---|
|
|
110
|
+
| Error containing `re-authentication required` | Ask the AI: *"re-authenticate with ReportFlow"* |
|
|
111
|
+
| `npx` cannot find the package | `npm cache clean --force` then retry |
|
|
112
|
+
| No keychain available on Linux | Falls back automatically to a chmod-0600 file under `$XDG_STATE_HOME/reportflow-mcp/` |
|
|
113
|
+
| Browser cannot open over SSH / remote shell | Authenticate **once on a local machine**; afterwards the cached token works on remote hosts |
|
|
181
114
|
|
|
182
|
-
|
|
183
|
-
2. `list_templates` でデザイン一覧を取得し、目的の `id`(designId)を確認
|
|
184
|
-
3. `get_design_parameters` で `designId` と `version`(latestVersion)を指定してパラメータ構造を確認
|
|
185
|
-
4. パラメータを埋めて `generate_pdf_sync` で PDF を生成
|
|
115
|
+
## License
|
|
186
116
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
### Resources の活用
|
|
190
|
-
|
|
191
|
-
- `reportflow://designs` や `reportflow://designs/{designId}/parameters` を Resource としてコンテキストに添付すれば、ツール呼び出しを加えずにテンプレを参照できます。
|
|
192
|
-
- エラー判別に迷ったときは `reportflow://errors` を見るとメッセージカタログがあります。
|
|
193
|
-
|
|
194
|
-
### 注意事項
|
|
195
|
-
|
|
196
|
-
- 認証エラー (`再認証が必要です` を含むメッセージ) が出たら、まず `authenticate` を呼ぶこと
|
|
197
|
-
- `params` の型は `get_design_parameters` の結果に従うこと
|
|
198
|
-
- `"string"` → 文字列、`"number"` → 数値、`"date"` → "YYYY-MM-DD" 形式
|
|
199
|
-
- 配列型(`[{...}]`)はオブジェクトの配列を渡す
|
|
200
|
-
- `version` は `list_templates` で返る `latestVersion` を使用
|
|
201
|
-
- 同期生成(sync)は即座にファイルパスが返る。件数が多い場合は async を使うこと
|
|
202
|
-
````
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## 開発
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
yarn install
|
|
210
|
-
yarn test # ユニットテスト実行
|
|
211
|
-
yarn build # TypeScript ビルド
|
|
212
|
-
yarn lint # ESLint チェック
|
|
213
|
-
```
|
|
117
|
+
MIT — see [LICENSE](./LICENSE).
|
|
214
118
|
|
|
215
|
-
|
|
119
|
+
## Links
|
|
216
120
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
4. ユーザーがログイン → ワークスペース選択 → 同意 → callback に code 飛ぶ
|
|
221
|
-
5. `<AUTH_URL>/oauth/token` (POST, `grant_type=authorization_code`) で code + code_verifier を送り JWT 取得 (Public client: client_secret なし)
|
|
222
|
-
6. JWT を keychain (or XDG file) に保存。`account = client_id`、`service = reportflow-mcp`
|
|
223
|
-
7. 以後の API 呼び出しは `Authorization: Bearer <jwt>` ヘッダ
|
|
224
|
-
8. `expires_in` 経過時は refresh_token で自動更新
|
|
121
|
+
- ReportFlow: https://re-port-flow.com
|
|
122
|
+
- npm: https://www.npmjs.com/package/reportflow-mcp
|
|
123
|
+
- Issues: https://github.com/re-port-flow/reportflow-mcp/issues
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reportflow-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"mcpName": "io.github.re-port-flow/reportflow-mcp",
|
|
4
5
|
"description": "ReportFlow MCP Server - PDF report generation for Claude and AI agents",
|
|
5
6
|
"keywords": ["mcp", "pdf", "report", "reportflow", "claude", "anthropic", "ai-agent"],
|
|
6
7
|
"license": "MIT",
|