無料ベータ公開中

シフト屋さん Public API & MCP サーバー

シフト屋さんのシフト自動作成エンジン (制約最適化エンジンによる数理最適化)を、公開 HTTP API と MCP サーバーとして提供します。 Claude や ChatGPT などの AI エージェントに話しかけるだけでシフト表を作成・最適化できます。

API キーを発行する(無料β・ログイン/新規登録)

クイックスタート(MCP — Claude から使う)

Claude Code の場合:

claude mcp add shiftyasan -e SHIFTYASAN_API_KEY=sk_live_... -- npx -y @shiftyasan/mcp-server

Claude Desktop の場合(claude_desktop_config.json):

{
  "mcpServers": {
    "shiftyasan": {
      "command": "npx",
      "args": ["-y", "@shiftyasan/mcp-server"],
      "env": { "SHIFTYASAN_API_KEY": "sk_live_..." }
    }
  }
}

設定後、「9月の第1週、早番と遅番で4人のシフトを組んで。夜勤明けは休みにして、 遅番は公平に分担して」のように話しかけると、エージェントが validate_shift_input(無料)→ solve_shift を呼んでシフト表を返します。

API キーはキー管理ダッシュボードで発行できます (シフト屋さん本体のアカウントがそのまま使えます。新規登録も可能)。 うまくいかない場合は [email protected] へどうぞ。

クイックスタート(ChatGPT — Custom GPT で使う)

ChatGPT はローカルの MCP サーバーを起動できないため、Custom GPT の Actions で HTTP API を直接使います(この API の OpenAPI は Actions 互換設計です):

  1. My GPTs → Create a GPT → Configure → Actions → Import from URLhttps://api.shiftyasan.com/v1/public/openapi.json を取り込む
  2. Authentication → API Key → Bearersk_live_... を設定
  3. 取り込むと validate_shift_input / solve_shift / get_solve_job / get_usage の4つが使えるようになります。 Instructions に「solve_shift の前に必ず validate_shift_input を呼ぶ」 「202 と job_id が返ったら get_solve_job を約15秒間隔でポーリングする」 と書いておくと自律的に動きます
Custom GPT の作成には ChatGPT の有料プランが必要です。API キーは GPT 内に保存されるため、 その GPT を公開共有しないでください。

クイックスタート(HTTP API 直接)

スキーマ検証は無料・認証不要です:

curl -X POST "https://api.shiftyasan.com/v1/public/solve/validate" \
  -H 'Content-Type: application/json' \
  --data @request.json

solve は API キーが必要です(1回あたり数 units を消費・残量は GET /v1/public/usage):

curl -X POST "https://api.shiftyasan.com/v1/public/solve" \
  -H "Authorization: Bearer $SHIFTYASAN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data @request.json

大規模な問題(概ね25人超の規模)は同期では返らず、202 と job_id が返ります。 GET https://api.shiftyasan.com/v1/public/solve/jobs/{job_id} を約15秒間隔でポーリングしてください (通常2〜7分で完了します)。

リクエスト/レスポンスの完全なスキーマは GET https://api.shiftyasan.com/v1/public/openapi.json(OpenAPI 3.1)で取得できます。 エラーは RFC 7807 (problem+json) 形式で、フィールド単位の指摘を返すため AI エージェントが自己修正しやすい設計です。

対応している制約(公開 API・現在)

制約指定方法種別
シフト別・日別の必要人数(下限/上限)shifts[].staffing_demand下限 hard / 上限 soft
業務別の必要人数(シフト×日)duties[].staffing_demand_by_shift下限 hard / 上限 soft
従業員ごとの勤務可能シフトemployees[].assignable_shift_idshard
スキルレベル(0 = その業務に就けない)employees[].skill_levelshard
休み希望・シフト希望employees[].preferencessoft(尊重を強く加点)
固定割当(この日はこのシフト、と確定)employees[].fixed_assignmentshard
月間勤務日数の下限/上限employees[].working_days_per_monthsoft+hard
週間勤務日数employees[].working_days_per_weeksoft
連続勤務日数の上限
※未指定でも既定でハード6日・ソフト5日が適用されます(無制限ではありません)
constraints.max_consecutive_working_dayssoft+hard
シフト遷移の禁止/強制(例: 夜勤→明けは必ず休み)constraints.shift_transitionshard / soft 選択可
従業員ペアの同時配置禁止constraints.employee_pairings(exclude)hard
負担シフトの公平な分担(独立グループ最大4件・回数の均し・重み調整可)constraints.fairness_groupssoft(penalty_weight 調整可)
責任者の必置(シフト×日ごとの人数)shifts[].manager_demand下限 hard / 上限 soft
週間勤務時間の上限(シフト時刻から自動計算)employees[].weekly_working_hours_limitsoft / hard 選択可
スキルサポート(初心者に熟練者を同席)constraints.skill_supportsoft / hard 選択可
シフト横断の合計人数(時間帯需要。夜間帯をまたぐ人数保証等)constraints.cross_shift_demands下限 hard / 上限 soft
曜日単位の出勤可否(火・木だけ出勤等。日跨ぎは開始日の曜日で判定)employees[].available_weekdayshard
シフト種別ごとの回数上限・下限(夜勤は月4回まで等)employees[].shift_count_limitshard
休業日schedule_period.holidayshard

解が存在しない場合は原因を自動診断します。制約を1つずつ外した 検証を短時間で再実行し、「どの制約を緩めると組めるようになるか」を diagnosis.causes[](原因の種類・該当フィールド・緩和の提案)として 返すので、エージェントがそのまま利用者に改善案を提示できます。 人手不足はエラーにせず、不足マーカーつきの解として返します (現実の「人が足りない週」でも表は出ます)。

最近追加した制約

料金

ベータ期間中は無料です。キーごとに無料利用枠(units)が付与され、 solve 呼び出しごとに消費します。枠が尽きたらメールで追加をリクエストできます。 正式リリース後の料金は準備中で、ベータ利用者には事前にお知らせします。

Free open beta

Shiftyasan Public API & MCP Server

The shift-scheduling engine behind Shiftyasan (mathematical optimization by a constraint-optimization engine), exposed as a public HTTP API and an MCP server. AI agents such as Claude and ChatGPT can build and optimize shift schedules conversationally.

Get an API key (free beta — log in / sign up)

Quickstart (MCP — use from Claude)

Claude Code:

claude mcp add shiftyasan -e SHIFTYASAN_API_KEY=sk_live_... -- npx -y @shiftyasan/mcp-server

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "shiftyasan": {
      "command": "npx",
      "args": ["-y", "@shiftyasan/mcp-server"],
      "env": { "SHIFTYASAN_API_KEY": "sk_live_..." }
    }
  }
}

Then just ask something like: "Schedule 4 people across early and late shifts for the first week of September. Give a day off after each night shift, and share late shifts fairly." The agent calls validate_shift_input (free) and then solve_shift and returns the schedule.

Issue API keys in the key management dashboard (your existing Shiftyasan account works; sign-up is also available). If anything goes wrong, email [email protected].

Quickstart (ChatGPT — via a Custom GPT)

ChatGPT cannot spawn local MCP servers, so use the HTTP API directly through a Custom GPT with Actions (our OpenAPI spec is designed to be Actions-compatible):

  1. My GPTs → Create a GPT → Configure → Actions → Import from URL with https://api.shiftyasan.com/v1/public/openapi.json
  2. Authentication → API Key → Bearer → paste your sk_live_... token
  3. You get four actions: validate_shift_input, solve_shift, get_solve_job and get_usage. Add to Instructions: "Always call validate_shift_input before solve_shift. If solve_shift returns 202 with a job_id, poll get_solve_job every ~15 seconds until it completes."
Creating custom GPTs requires a paid ChatGPT plan. Your API key is stored inside the GPT — do not share that GPT publicly.

Quickstart (HTTP API)

Schema validation is free and requires no auth:

curl -X POST "https://api.shiftyasan.com/v1/public/solve/validate" \
  -H 'Content-Type: application/json' \
  --data @request.json

Solving requires an API key (consumes a few units per call; check the balance with GET /v1/public/usage):

curl -X POST "https://api.shiftyasan.com/v1/public/solve" \
  -H "Authorization: Bearer $SHIFTYASAN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data @request.json

Large problems (roughly 25+ employees) do not return synchronously: you get 202 with a job_id. Poll GET https://api.shiftyasan.com/v1/public/solve/jobs/{job_id} every ~15 seconds (typically done in 2–7 minutes).

The full request/response schema is served at GET https://api.shiftyasan.com/v1/public/openapi.json (OpenAPI 3.1). Errors follow RFC 7807 (problem+json) with field-level details, so AI agents can self-correct.

Supported constraints (public API, today)

ConstraintWhereKind
Staffing demand per shift per day (min/max)shifts[].staffing_demandmin hard / max soft
Staffing demand per duty (shift × day)duties[].staffing_demand_by_shiftmin hard / max soft
Assignable shifts per employeeemployees[].assignable_shift_idshard
Skill levels (0 = cannot do the duty)employees[].skill_levelshard
Day-off / shift preferencesemployees[].preferencessoft (strongly rewarded)
Fixed assignmentsemployees[].fixed_assignmentshard
Working days per month (min/max)employees[].working_days_per_monthsoft+hard
Working days per weekemployees[].working_days_per_weeksoft
Max consecutive working days
Note: omitting this is not "unlimited" — the default is a hard cap of 6 (soft 5)
constraints.max_consecutive_working_dayssoft+hard
Forbid/require shift transitions (e.g. rest after night shift)constraints.shift_transitionshard or soft
Keep employee pairs apartconstraints.employee_pairings (exclude)hard
Fair distribution of burdensome shifts (up to 4 independent groups, count-balanced, weight tunable)constraints.fairness_groupssoft (penalty_weight)
Manager presence per shift per dayshifts[].manager_demandmin hard / max soft
Weekly working-hours cap (derived from shift times)employees[].weekly_working_hours_limitsoft or hard
Skill support (pair beginners with seniors)constraints.skill_supportsoft or hard
Cross-shift headcount (time-band style demand, e.g. overnight coverage)constraints.cross_shift_demandsmin hard / max soft
Weekday availability (e.g. Tue/Thu only; overnight shifts count by start date)employees[].available_weekdayshard
Per-shift assignment count bounds (e.g. at most 4 night shifts)employees[].shift_count_limitshard
Business holidaysschedule_period.holidayshard

When no solution exists, the API diagnoses the cause automatically: it re-solves quick probe variants with one hard constraint removed at a time and returns diagnosis.causes[] (cause type, offending field, suggested relaxation), so your agent can tell the user exactly which constraint to relax. Understaffing is not an error: the solver returns a schedule with shortage markers, so you still get a usable roster in a short-staffed week.

Recently added constraints

Pricing

The open beta is free. Each key comes with a free usage quota (units) consumed per solve call. Email us when you run out. Post-beta pricing is in preparation and beta users will be notified in advance.