MCP ガイド
シフト屋さんのシフト作成エンジンを MCP サーバーとして公開しています。 AI エージェントから話しかけるだけでシフト表を作成・調整できます。
接続する
使っているクライアントの手順をご覧ください。
- Claude から接続する — Claude.ai / Desktop / Code
- ChatGPT から接続する — Developer Mode の要件と、使えない場合の代替
エンドポイント
https://api.shiftyasan.com/mcp
Streamable HTTP。1回の呼び出しが1つの POST で完結するステートレスな構成で、 常時接続は張りません。
認証
2通りあり、どちらも Authorization: Bearer で送ります。
| 方式 | 形式 | 向いている場面 |
|---|---|---|
| OAuth | oat_… |
Claude.ai / ChatGPT。キーを扱わずに済む。接続時に自動で用意される |
| API キー | sk_live_… |
Claude Desktop / Code、HTTP 直接。ヘッダーを自分で設定できる場合 |
OAuth の詳細は 認可サーバーメタデータを参照してください (PKCE S256 必須、public client、動的登録と CIMD の両方に対応)。
利用できるツール
| ツール | 内容 | 認証 |
|---|---|---|
validate_shift_input |
リクエストがスキーマに合っているかを検証する。解く前に必ずこれを呼ぶ | 不要 |
solve_shift |
シフトを作成する。規模が大きいと 202 と job_id を返す |
必要 |
get_solve_job |
202 で返ったジョブの完了を待つ。running の間は約15秒間隔で再取得する |
必要 |
validate_shift_input は無料・無認証です。エージェントに
「解く前に必ず検証を通す」と指示しておくと、無駄な失敗が減ります。
解けるまでの時間
問題の規模に応じて実行先が自動で切り替わります。小さい問題は数秒〜十数秒で同期的に返り、
大きい問題は 202 でジョブ化されます。ジョブは get_solve_job で完了を待ってください。
結果の読み方で注意すること
- 人手が足りない日があっても「失敗」ではありません。 埋められない枠には不足の印が付いた状態でシフト表が返ります。 「作れませんでした」ではなく「この枠は人が足りません」と読んでください
- 解が無い場合(422)は、原因になった制約が返ります。 どれを緩めれば解けるようになるかが示されるので、利用者に選ばせてください
- 反映されなかった指定は申告されます。 その場合は「希望も反映しました」と伝えないでください
うまくいかないとき
401 が返る
OAuth なら再接続、API キーなら ダッシュボードでキーが有効かを確認してください。 キーを無効化すると、そのキーに紐づく OAuth 接続も止まります。
429 が返る
レート制限です。Retry-After ヘッダーの秒数だけ待ってから再試行してください。
npm パッケージ(@shiftyasan/mcp-server)はもう使えない?
使えます。既存の設定はそのまま動きます。ただしローカル実行なので Node.js 20 以上が必要で、 更新もご自身で行う必要があります。新規であればリモート接続を推奨します。
HTTP API を直接使う
MCP を介さず REST で呼ぶこともできます。OpenAPI は こちら。 検証だけなら無認証で試せます。
curl -X POST "https://api.shiftyasan.com/v1/public/solve/validate" \
-H 'Content-Type: application/json' \
-d '{"schedule_period":{"start_date":"2026-09-01","end_date":"2026-09-07"}}'
MCP guide
Shiftyasan's scheduling engine is available as an MCP server, so AI agents can build and adjust shift schedules conversationally.
Connecting
Follow the guide for your client.
- Connect from Claude — Claude.ai / Desktop / Code
- Connect from ChatGPT — Developer Mode requirements, and what to do without it
Endpoint
https://api.shiftyasan.com/mcp
Streamable HTTP. Each call is a single POST — the server is stateless and holds no long-lived connection.
Authentication
Two kinds of token, both sent as Authorization: Bearer.
| Kind | Format | Use when |
|---|---|---|
| OAuth | oat_… |
Claude.ai / ChatGPT. No key handling — provisioned when you connect |
| API key | sk_live_… |
Claude Desktop / Code, or direct HTTP — anywhere you can set a header yourself |
For OAuth details see the authorization server metadata (PKCE S256 required, public client, both dynamic registration and CIMD supported).
Tools
| Tool | What it does | Auth |
|---|---|---|
validate_shift_input |
Checks a request against the schema. Always call this before solving | none |
solve_shift |
Builds the schedule. Large problems return 202 with a job_id |
required |
get_solve_job |
Polls a job from 202. While running, retry about every 15 seconds |
required |
validate_shift_input is free and needs no auth. Telling your agent to always
validate before solving cuts down on wasted failures.
How long solving takes
Where the problem runs is chosen automatically by size. Small problems return synchronously in
seconds; large ones come back as a 202 job — wait for it with get_solve_job.
Reading the result
- Understaffing is not a failure. When nobody can cover a slot, you still get a schedule, with shortage markers on the uncovered slots. Report those as "these slots need more people", not as "it could not be built"
- When there is no feasible solution (422), the response names the constraints whose removal would make it solvable. Present those as choices rather than reporting failure
- Dropped constraints are declared. If the response says something was not applied, do not tell the user their preference was honoured
Troubleshooting
I get a 401
With OAuth, reconnect. With an API key, check it is still enabled in the dashboard. Disabling a key also stops the OAuth connections that resolve to it.
I get a 429
Rate limited. Wait the number of seconds in the Retry-After header, then retry.
I cannot find the connection setting (Connectors / Plugins)
It depends on your client's plan and rollout. The ChatGPT and Claude pages cover the requirements and the alternatives.
Is the npm package (@shiftyasan/mcp-server) still usable?
Yes — existing setups keep working. It runs locally, so it needs Node.js 20+ and you update it yourself. For a new setup, the remote connection is recommended.
Using the HTTP API directly
You can call the REST API without MCP. The OpenAPI document is here. Validation is free and needs no auth.
curl -X POST "https://api.shiftyasan.com/v1/public/solve/validate" \
-H 'Content-Type: application/json' \
-d '{"schedule_period":{"start_date":"2026-09-01","end_date":"2026-09-07"}}'