Skip to content

Study plan template MCP

Platform admins, Bible and Tech designers, and Bible and Tech auditors can connect external AI tools (for example Cursor or Claude Desktop) to Garrison’s study plan template MCP server. Designers write in their own course. Auditors can list, get, and flag a needs-fix. AI draft, review, and step-instruction tools stay with a platform admin.

Cross-links: Study plans (designer), Study plans (planning), AI guidelines, Admin study plan AI.

Item Value
Protocol Model Context Protocol over HTTP
Server name study-plan-templates
HTTP endpoint POST {APP_URL}/mcp/study-plan-templates
Transport Streamable HTTP (JSON-RPC)
Audience Platform admins, Bible and Tech designers, and Bible and Tech auditors

Example endpoint (local dev with bin/start):

https://api.garrison.test/mcp/study-plan-templates

Replace the host with your deployment’s public API URL in production.

MCP clients cannot use the web app’s session cookies. Send an API token as a Bearer header:

Authorization: Bearer {plain-text-token}

Requirements:

  • Create the token on Profile → API tokens and select the Study plan MCP server permission (mcp:study-plan-templates).
  • The token’s user must have curriculum access (platform admin, designer, or auditor).
  • The MCP route rejects tokens that do not include the study-plan MCP scope.
  • Other permissions you add to the same token in the future will apply only where those scopes are accepted—this route checks the study-plan scope only.

AI generation tools also require the admin_study_plan_ai feature flag (see below).

Unauthenticated requests receive 401 with a WWW-Authenticate: Bearer header. Non-admin users or tokens without the required scope receive 403.

  1. Sign in as a platform admin, designer, or auditor.
  2. If you are a platform admin, complete MFA when prompted (admin step-up).
  3. Open Profile → API tokens.
  4. Enter a name (for example Cursor laptop).
  5. In the permissions tree, check Study plan MCP server (under Study plan templates).
  6. Create token and copy the plain-text value immediately—it is shown once.
  7. Revoke unused tokens from the same section.

Token lifetime defaults to 90 days (API_TOKEN_EXPIRATION_DAYS in api/.env).

GraphQL Purpose
apiTokenScopeTree Permission tree for the signed-in user
apiAccessTokens List your API tokens (metadata only)
createApiAccessToken(name, scopes) Issue a token; returns plainTextToken once
revokeApiAccessToken(id) Revoke by token id

Available scopes are defined in config/api_tokens.php. New integrations add entries there and wire route middleware or resolver checks to the scope key.

Scope Who can assign Used for
studies:read Any signed-in user GraphQL studies and study queries with a bearer token
mcp:study-plan-templates Platform admin, designer, or auditor Study plan template MCP server (POST /mcp/study-plan-templates). Writes stay in the caller’s course
mcp:tracks Platform admin, designer, or auditor Track MCP server (POST /mcp/tracks). Designers write tracks in their own course. Auditors can list and get
mcp:quizzes Platform admin, designer, or auditor Quiz MCP server (POST /mcp/quizzes). Designers write quizzes and questions in their own course. Auditors can get, list, and flag needs-fix
Requirement Config
AI tools enabled Feature flag admin_study_plan_ai must be on (feature_flags.default_enabled)
LLM provider config/study_plan_ai.php / STUDY_PLAN_AI_* env vars (default Ollama in dev)

Read-only tools (get-study-plan-template, rubric resource, review when AI is on) still require curriculum access. AI generation tools are hidden from MCP tool lists when the feature flag is off.

Usage is logged to ai_usage like GraphQL AI mutations.

Add a server entry pointing at the HTTP endpoint and your Bearer token.

Cursor (api/.mcp.json, copied from .mcp.json.example):

{
"mcpServers": {
"study-plan-templates": {
"url": "https://api.garrison.test/mcp/study-plan-templates",
"headers": {
"Authorization": "Bearer YOUR_TOKEN_FROM_PROFILE"
}
}
}
}

Use the API container’s reachable URL from your machine. For local dev with bin/start, https://api.garrison.test is typical.

Reload MCP in the client after saving. The server advertises name study-plan-templates and version 0.1.0.

Tool names use kebab-case derived from the server registration.

Tool Read-only Feature flag Description
get-study-plan-template Yes — Load a template by id (UUID) or slug, including unpublished drafts, step completion_mode, quiz_id, scenario_slug, pass_threshold, and open needs-fix flags
delete-topic No — Delete a topic in the caller’s course. Refused when any study references it, published or not
list-flags Yes — List needs-fix flags. Filter by status (open, resolved, all), topic, or track
resolve-flag No — Resolve a needs-fix flag with an optional note. View access is enough
list-study-plan-feedback Yes — Final ratings and aggregates for a template
list-study-plan-step-reports Yes — Mid-study step problem reports (filters: priority, step key)
analyze-study-plan-feedback Yes* admin_study_plan_ai Summarize aggregated feedback for a template
generate-study-plan-template-draft No admin_study_plan_ai Wizard brief → unpublished template draft (JSON)
review-study-plan-template Yes* admin_study_plan_ai Rubric review; criticism only, no rewrites
generate-study-plan-step-instructions No admin_study_plan_ai Markdown for one step and instruction lane

*Calls the LLM but does not mutate stored templates.

Argument Type Required Notes
id string (UUID) One of id / slug Template primary key
slug string One of id / slug Template slug

Returns JSON: metadata, participation flags, open needs-fix flags, and steps. Each step includes lane markdown plus completion_mode, quiz_id, scenario_slug (the first linked simulator scenario), pass_threshold, and completion_config.

Argument Type Required
studyMethod string Yes — e.g. Topical, Book
spiritualPhases string[] Yes — e.g. ["Milk"]
focusKind string Yes
focusValue string No
variant string No
supportsMentoredParticipation boolean Yes
supportsIndividualParticipation boolean Yes
goals string Yes — author brief
referenceTemplateId string (UUID) No
referenceUrls string[] No — up to three URLs

Returns an unpublished draft (isPublished: false). Same shape as GraphQL generateStudyPlanTemplateDraft.

Accepts a full template draft: slug, title, description, studyMethod, spiritualPhases, focusKind, focusValue, variant, isPublished, participation flags, sortOrder, and steps[] (stepKey, title, optional instruction fields, position).

Returns { findings: [{ severity, category, message, stepIndex?, suggestion? }] }. Categories use rubric slugs.

Template context plus: stepIndex, stepKey, stepTitle, instructionRole (individual | mentee | mentor), optional currentInstructions, and required intent.

Returns { instructionsMarkdown: "…" }.

URI MIME Description
garrison://study-plan/rubric application/json Rubric dimensions (slug, title, description, aiInstructions, sortOrder)
Prompt Arguments Description
study-plan-template-authoring goal (optional) System context: rubric, guardrails, optional author goal
  1. Confirm admin_study_plan_ai is enabled if operators need AI tools.
  2. Configure STUDY_PLAN_AI_* / Ollama (or other provider) on the API service.
  3. Ensure the API URL is reachable from the operator’s workstation (TLS, firewall, Traefik).
  4. Platform admin creates an API token on Profile → API tokens with the study-plan MCP permission.
  5. Configure the MCP client with url + Authorization: Bearer ….
  6. Revoke tokens when a device or client is decommissioned.
Symptom Cause Fix
HTTP 500 on connect MCP streamable HTTP requires Accept: application/json, text/event-stream. Clients that omit it used to crash the transport. Upgrade API (middleware normalizes Accept) or add the header in mcp.json.
HTTP 504 on AI tools Edge gateway timeout is shorter than study-plan AI runs (draft up to ~6 minutes with queue buffer). Enable httpRoute.mcpExtendedTimeout in Helm (see values-production.example.yaml), or raise proxy timeouts on your Gateway / CDN for /mcp/*.
MCP tool error: timed out waiting for AI queue Queue worker not running, GPU saturated, or inference slower than agent timeout. Confirm queue deployment is healthy; check STUDY_PLAN_AI_* and Ollama; review ai_usage logs.
HTTP 403 from scripts / bots Some CDNs block default Python or empty User-Agent on GraphQL. Send a normal User-Agent header (Cursor and browsers are fine).

AI generation tools block the MCP HTTP request until the queued agent finishes. Read-only tools (get-study-plan-template, rubric) return quickly.

File Purpose
api/config/api_tokens.php Permission scopes, groups, token expiry
api/config/mcp.php MCP route path and required scope key
api/routes/ai.php Web route registration and middleware
api/.mcp.json.example Example Cursor MCP config
api/.env.example API_TOKEN_EXPIRATION_DAYS

Implementation reference: App\Mcp\Servers\StudyPlanTemplateServer in the API package.