MCP Integration

Connect AI agents to TutorFlow's evaluation API via the Model Context Protocol (MCP). Works with Claude Code and any MCP-compatible client.

What is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI agents discover and call tools exposed by a server. Instead of writing raw HTTP calls, your agent gets structured tools it can invoke directly, with typed inputs, validation, and clear descriptions.

TutorFlow provides a hosted MCP server so Claude Code and any other MCP-compatible agent or client can integrate with the platform in minutes.

MCP Server

https://mcp.tutorflow.io/api/mcp

The server is stateless, HTTPS-only, and accepts requests over the Streamable HTTP transport.

Connect with Claude Code

Add the TutorFlow MCP server to .mcp.json in your project root:

{
  "mcpServers": {
    "tutorflow": {
      "type": "http",
      "url": "https://mcp.tutorflow.io/api/mcp",
      "headers": {
        "Authorization": "Bearer tf_platform_..."
      }
    }
  }
}

Restart Claude Code. The tools become available immediately.

Connect Programmatically

Any MCP client can connect using the Streamable HTTP transport:

import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
 
const transport = new StreamableHTTPClientTransport(
  new URL('https://mcp.tutorflow.io/api/mcp'),
  {
    requestInit: {
      headers: { Authorization: 'Bearer tf_platform_...' },
    },
  },
);
 
const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(transport);

Available Tools

ToolAuthDescription
register_organizationNoneCreate a workspace and receive an API key
get_accountAPI KeyAccount info and credit balance
check_billing_statusAPI KeyPayment method and billing mode
create_billing_sessionAPI KeyGenerate a checkout page URL for credit purchase
get_pricingNoneList the live per-unit pricing catalog
run_evaluationAPI Key + CreditsSubmit an evaluation, returns score and feedback
list_evaluationsAPI KeyList past evaluations with filtering
create_courseAPI Key + CreditsGenerate a course curriculum, returns preview/public URLs
list_coursesAPI KeyList past course requests

Tools that require an API key read it from the Authorization: Bearer header passed when connecting.

Modules, tests, slides, and videos are not yet exposed as MCP tools. Use the REST API directly for these. See Create Module, Create Test, Create Slide, and Create Video. They will land in the MCP server in a future release. API-key update endpoints are also REST-only for now: Update Course, Update Test, Update Slide, and Update Video.

Agent Onboarding Flow via MCP

An agent can complete the entire onboarding without any HTTP knowledge:

Step 1: Register

Tool: register_organization
{
  "name": "My AI Tutor",
  "slug": "my-ai-tutor",
  "email": "agent@example.com",
  "agentIdentity": "claude-opus-4"
}

Returns an API key + $1.00 in trial credits. Store the key. It is shown only once.

Step 2: Run a Tool Immediately

Trial credits work without email verification. Skip straight to a generation call. For example, an evaluation:

Step 3: Run an Evaluation

Tool: run_evaluation
{
  "evaluationType": "open_ended",
  "questionText": "Explain photosynthesis",
  "learnerAnswer": "Plants use sunlight to make glucose from CO2 and water.",
  "language": "en",
  "maxScore": 10
}

When trial credits are exhausted, generation tools should be treated the same way as the REST API: the call can fail with a payment-required error such as payment_required or platform_credits_exhausted. Call create_billing_session, forward the checkout URL to a human operator, then retry after credits are available.

Step 4: Purchase Credits (When Trial Runs Out)

Tool: create_billing_session
{}

Returns a url field pointing to a TutorFlow-hosted checkout page. Send this URL to a human (via Slack, email, or any channel). The human opens the page, chooses how much to add ($5 minimum, $5,000 maximum), and is then redirected to Stripe to complete payment. No card data passes through the agent or TutorFlow servers. The workspace email must be verified before this tool can create a checkout session.

Step 5: Verify and Retry

Tool: check_billing_status
{}

Once creditBalance is high enough for the request, retry run_evaluation to get the actual result:

{
  "evaluationId": "uuid",
  "status": "COMPLETED",
  "score": 8,
  "maxScore": 10,
  "feedbackSummary": "Strong grasp of the concept..."
}

Pricing

Quick reference (call get_pricing for the live catalog):

CategoryUnitPrice
Evaluationrequest$0.02
Coursegenerated lesson$0.05
Modulegenerated lesson$0.05
Testgenerated item$0.015
Slideslide$0.03
Slide image add-onimage$0.07
Videogenerated scene$0.04
Video TTS regenerate add-oncall$0.02
Video render add-onvideo minute$0.15

See Pricing & Billing for details on credits, USDC, and enterprise.

Without MCP: REST API

Prefer raw HTTP? Every tool maps 1:1 to a REST endpoint:

# Onboarding
POST /v1/platform/agent/register
GET  /v1/platform/agent/account
POST /v1/platform/agent/billing/session
GET  /v1/platform/agent/billing/status
 
# Generation
POST /v1/platform/evaluations
POST /v1/platform/courses
POST /v1/platform/modules
POST /v1/platform/tests
POST /v1/platform/slides
POST /v1/platform/videos

See the Agent Self-Service Onboarding guide for the full REST flow.