> ## Documentation Index
> Fetch the complete documentation index at: https://docs.learningcommons.org/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Use the MCP server to access knowledge graph our data.

export const EarlyAccessCallout = ({children}) => <div className="eyebrow-callout not-prose rounded-xl border border-gray-200/80 p-5 dark:border-white/10" style={{
  marginBottom: "1rem",
  borderRadius: "4px"
}}>
    <div className="mb-3">
      <Badge color="green" size="md" icon="flask">
        Early access
      </Badge>
    </div>
    <div className="callout-body text-[15px] leading-relaxed text-gray-700 dark:text-gray-300">{children}</div>
    <style>{`.callout-body a { text-decoration: underline; text-decoration-color: #178251; }`}</style>
  </div>;

<EarlyAccessCallout>
  Early access features and functionality are actively evolving, and breaking changes may occur as we expand capabilities and improve accuracy and reliability. [support@learningcommons.org](mailto:support@learningcommons.org)  ↗ with your feedback or issues.
</EarlyAccessCallout>

The Knowledge Graph MCP Server implements the [Model Context Protocol](https://modelcontextprotocol.io/docs/getting-started/intro) ↗ for K-12 educational data.

Instead of relying on model recall, the MCP Server relies on [tools](https://modelcontextprotocol.io/docs/learn/server-concepts#tools) ↗ and structured Knowledge Graph data to:

* Resolve [Academic Standards](/knowledge-graph/graph-reference/academic-standards)
* Deconstruct them into granular [Learning Components](/knowledge-graph/graph-reference/learning-components)
* Trace [Learning Progressions](/knowledge-graph/graph-reference/learning-progressions) across standards

## What you'll need

* MCP Server URL:
  ```text theme={null}
  https://kg.mcp.learningcommons.org/mcp
  ```
* API keys generated in the [Learning Commons Platform](https://platform.learningcommons.org/) ↗ to include in your request headers for authentication:

  ```text theme={null}
  x-api-key: YOUR_API_KEY
  ```

  or

  ```
  Authorization: Bearer YOUR_API_KEY
  ```

  <Note>
    If using an SDK, verify how to pass in the MCP authorization key for your
    client.
  </Note>

## Steps

<Steps>
  <Step title="Set up environment variables">
    ```text .env theme={null}
    OPENAI_API_KEY=sk-...
    MCP_AUTH_KEY=your_learning_commons_api_key
    MCP_SERVER_URL=https://kg.mcp.learningcommons.org/mcp
    ```
  </Step>

  <Step title="Connect to the MCP server">
    Make a request to the MCP server with your question — for example, asking about skills and unfinished learning for California standard `4.OA.A.3`:

    <CodeGroup>
      ```python Python theme={null}
      import os
      import requests
      from dotenv import load_dotenv

      load_dotenv()

      openai_api_key = os.getenv("OPENAI_API_KEY")
      mcp_server_url = os.getenv("MCP_SERVER_URL")
      mcp_auth_key   = os.getenv("MCP_AUTH_KEY")

      input_prompt = "I am a 4th grade teacher in California. A new student in my class is struggling with the concepts related to 4.OA.A.3. What are the skills required for mastery and what potential unfinished learning should I address?."

      response = requests.post(
        "https://api.openai.com/v1/responses",
        headers={
          "Content-Type":  "application/json",
          "Authorization": f"Bearer {openai_api_key}",
        },
        json={
          "model": "gpt-4o",
          "tools": [
            {
              "type": "mcp",
              "server_label": "learning-commons-kg",
              "server_url": mcp_server_url,
              "require_approval": "never",
              "headers": { "x-api-key": mcp_auth_key }
            }
          ],
          "input": input_prompt
        }
      )

      print(response.status_code)
      for item in response.json()["output"]:
        if item["type"] == "mcp_call":
          print(f"Tool called: {item['name']}")
          print(f"Arguments:   {item['arguments']}")
          print(f"Result:      {item['output']}")
        elif item["type"] == "message":
          print(f"Answer: {item['content'][0]['text']}")
      ```

      ```javascript JavaScript theme={null}
      import "dotenv/config";

      const openaiApiKey = process.env.OPENAI_API_KEY;
      const mcpServerUrl = process.env.MCP_SERVER_URL;
      const mcpAuthKey = process.env.MCP_AUTH_KEY;

      const inputPrompt =
        "I am a 4th grade teacher in California. A new student in my class is struggling with the concepts related to 4.OA.A.3. What are the skills required for mastery and what potential unfinished learning should I address?.";

      async function main() {
        const response = await fetch("https://api.openai.com/v1/responses", {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${openaiApiKey}`,
          },
          body: JSON.stringify({
            model: "gpt-4o",
            tools: [
              {
                type: "mcp",
                server_label: "learning-commons-kg",
                server_url: mcpServerUrl,
                require_approval: "never",
                headers: {
                  "x-api-key": mcpAuthKey,
                },
              },
            ],
            input: inputPrompt,
          }),
        });

        const data = await response.json();
        console.log(response.status);
        for (const item of data.output) {
          if (item.type === "mcp_call") {
            console.log(`Tool called: ${item.name}`);
            console.log(`Arguments:   ${item.arguments}`);
            console.log(`Result:      ${item.output}`);
          } else if (item.type === "message") {
            console.log(`Answer: ${item.content[0].text}`);
          }
        }
      }

      main();
      ```
    </CodeGroup>
  </Step>

  <Step title="Review the response">
    Your AI client will call Knowledge Graph MCP tools to return structured results (e.g., [Academic Standard](/knowledge-graph/graph-reference/academic-standards) statements, [Learning Components](/knowledge-graph/graph-reference/learning-components), or [Learning Progressions](/knowledge-graph/graph-reference/learning-progressions)).

    Inspect `mcp_call` output entries for tool names, arguments, and results.
  </Step>
</Steps>

## Tools

<Note>
  Please review the [Knowledge Graph
  License](/knowledge-graph/resources/license) before using these tools.
</Note>

The MCP server contains the following [tools](https://modelcontextprotocol.io/docs/learn/server-concepts#tools) ↗, which can be used individually or in sequence:

| Tool                                         | Description                                                                                                                                       |
| :------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Find Academic Standard statement**         | Resolves an education standard code into its authoritative statement and metadata, optionally scoped to a jurisdiction                            |
| **Find Learning Components from standard**   | Breaks a broad standard down into granular Learning Components that represent individual teachable skills                                         |
| **Find Learning Progressions from standard** | Identifies prior or subsequent standards in a learning progression, based on the Student Achievement Partners (SAP) Coherence Map for Mathematics |

<Info>
  A common workflow may use all 3 tools:

  * Resolving a standard code to its official statement
  * Retrieving the associated learning components for targeted instruction
  * Tracing progressions to identify prior or follow-on standards
</Info>

### Inputs

<table>
  <thead style={{ textAlign: "left" }}>
    <tr>
      <th>Tool</th>
      <th>Field</th>
      <th>Type</th>
      <th>Required</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td rowspan="2" id="find-academic-standard-statement">
        **Find Academic Standard statement**
      </td>

      <td>
        <code>statementCode</code>
      </td>

      <td>string</td>
      <td>✓</td>

      <td>
        e.g., <code>RI.5.2</code> or <code>8.F.B.4</code>
      </td>
    </tr>

    <tr>
      <td>
        <code>jurisdiction</code>
      </td>

      <td>string</td>

      <td />

      <td>
        Jurisdiction where standard is adopted (e.g., <code>Maryland</code>)
      </td>
    </tr>

    <tr>
      <td id="find-learning-components-from-standard">
        **Find Learning Components from standard**
      </td>

      <td>
        <code>caseIdentifierUUID</code>
      </td>

      <td>string</td>
      <td>✓</td>
      <td>UUID of the standard in the CASE Network</td>
    </tr>

    <tr>
      <td rowspan="2" id="find-learning-progressions-from-standard">
        **Find Learning Progressions from standard**
      </td>

      <td>
        <code>caseIdentifierUUID</code>
      </td>

      <td>string</td>
      <td>✓</td>
      <td>UUID of the standard in the CASE Network</td>
    </tr>

    <tr>
      <td>
        <code>direction</code>
      </td>

      <td>string</td>
      <td>✓</td>

      <td>
        <code>backward</code> for prerequisites and <code>forward</code> for
        subsequent
      </td>
    </tr>
  </tbody>
</table>
