{
  "id": "mcp-1",
  "title": "MCP Server: How do I initialize a session and execute tools over HTTP?",
  "description": "Demonstrates how to interact with the IndyKite MCP (Model Context Protocol) server using HTTP requests, with the session-based MCP protocol (revision 2025-11-25). Covers session initialization, listing resources and tools, and executing authorization queries through MCP tools. For the stateless protocol (revision 2026-07-28), see the companion resource.",
  "category": "MCP",
  "tags": [
    "MCP",
    "Model Context Protocol",
    "ContX IQ",
    "KBAC",
    "authZEN",
    "AI Integration",
    "LLM Tools"
  ],
  "api": "MCP",
  "language": "Json",
  "lastUpdated": "2026-11-09",
  "openApiEndpoints": [
    "/configs/v1/mcp-servers",
    "/capture/v1/nodes",
    "/capture/v1/relationships",
    "/configs/v1/authorization-policies",
    "/configs/v1/knowledge-queries"
  ],
  "relatedGuides": [
    "/guides/guide-mcp"
  ],
  "commonErrors": [],
  "summary": "This example demonstrates the IndyKite MCP Server for AI/LLM integration:\n\nWhat is MCP?\nModel Context Protocol - a standard for exposing tools and resources to AI models (Claude, GPT, etc.).\n\nIndyKite MCP Server provides:\n1. Resources - List and read knowledge queries available in your project\n2. Tools - Execute authorization operations:\n   - authzen_evaluate: Check if subject can perform action on resource\n   - One tool per active Knowledge Query, named after the query (here payment-method-by-license): run that query with parameters\n   - ciq_execute: Deprecated - runs any Knowledge Query by its id; kept for existing clients\n\nProtocol used here:\nSession-based MCP protocol, revision 2025-11-25 - an initialize handshake starts the session, the server returns an Mcp-Session-Id header, and every follow-up request sends it back. (The MCP server also supports the stateless protocol, revision 2026-07-28 - see the companion resource.)\n\nWorkflow:\n1. Initialize session with MCP server\n2. List available resources (knowledge queries)\n3. List available tools (authzen_evaluate, payment-method-by-license, ...)\n4. Execute tools with parameters\n\nThis enables AI agents to make authorization decisions using IndyKite.",
  "usecase": "Scenario: An AI assistant needs to check user permissions and retrieve authorized data.\n\nMCP Integration flow:\n1. AI agent connects to IndyKite MCP Server\n2. Initializes session -> receives capabilities and session ID\n3. Lists tools -> discovers authzen_evaluate and payment-method-by-license, the tool of the project's Knowledge Query\n4. User asks: \"Can I drive the company car?\"\n5. AI calls authzen_evaluate tool with:\n   - subject: {type: \"Person\", id: \"user-123\"}\n   - action: {name: \"drive\"}\n   - resource: {type: \"Car\", id: \"car-456\"}\n6. MCP evaluates against KBAC policy\n7. Returns: {decision: true} -> AI responds \"Yes, you can drive the car\"\n\nFor data retrieval:\n1. User asks: \"What payment methods do I have?\"\n2. AI calls the payment-method-by-license tool with the license plate as input_params\n3. MCP runs that Knowledge Query with user's authorization context\n4. Returns payment method data\n5. AI presents results to user",
  "requirements": "Prerequisites:\n- ServiceAccount credentials: For creating policies, queries, and the MCP Server configuration (Bearer token)\n- AppAgent: Referenced by the MCP Server config as the identity the server uses to call IndyKite APIs at runtime (resolved server-side)\n- User access token: JWT for the subject performing authorization checks\n- Token Introspect configuration: Required to validate user access tokens (referenced by the MCP Server config)\n\nMCP Server endpoint:\n- URL: https://eu.mcp.indykite.com/mcp/v1/{project_gid}\n- Protocol: JSON-RPC 2.0 over HTTP POST - session-based MCP protocol, revision 2025-11-25 (initialize handshake + Mcp-Session-Id header on every follow-up request)\n\nRequired configurations:\n- MCP Server: Binds the runtime MCP endpoint to an AppAgent + Token Introspect, declares supported OAuth scopes\n- KBAC Policy: Defines authorization rules (e.g., who can drive cars)\n- ContX IQ Policy and Query: Defines data access rules and queries",
  "steps": "Step 1: Create the MCP Server configuration\n- Authentication: ServiceAccount credential (Bearer token)\n- Action: POST to /configs/v1/mcp-servers\n- Input: AppAgent ID, Token Introspect ID, project ID, supported OAuth scopes\n- Result: MCP Server config ID returned; the runtime MCP endpoint will use this binding\n\nStep 2: Ingest Graph Data\n- Authentication: AppAgent credential (X-IK-ClientKey header)\n- Action: POST nodes (Person, Car) and relationships (DRIVES)\n- Note: Replace bearer-token-sub with actual user's token subject claim\n- Result: Graph ready for authorization queries\n\nStep 3: Create ContX IQ Policy\n- Authentication: ServiceAccount credential (Bearer token)\n- Action: POST policy for data access through MCP\n- Result: Policy ID returned\n\nStep 4: Create ContX IQ Knowledge Query\n- Authentication: ServiceAccount credential (Bearer token)\n- Action: POST query with a name and a description; the name becomes the name of its MCP tool, the description the tool's description\n- Important: Write the description for the AI agent: what the query returns and which input_params it needs\n- Result: Query listed via MCP resources, and published as the tool payment-method-by-license\n\nStep 5: Create KBAC Policy\n- Authentication: ServiceAccount credential (Bearer token)\n- Action: POST authZEN policy (e.g., Person can DRIVE Car if DRIVES relationship exists)\n- Result: Policy ID returned, available via authzen_evaluate tool\n\nStep 6: Use MCP Server\n- Initialize session: Send \"initialize\" JSON-RPC request\n- List resources: \"resources/list\" returns available knowledge queries\n- List tools: \"tools/list\" returns the authzen tools, payment-method-by-license and the deprecated ciq_execute\n- Execute authzen_evaluate: Check authorization with subject/action/resource\n- Execute payment-method-by-license: Run the Knowledge Query with its input_params",
  "graph": {
    "caption": "The graph the example runs on: 20 nodes (5 Person, 3 Car, 1 Bus, 1 Ticket, 1 Laptop, 2 PaymentMethod, 1 Vehicle, 2 LicenseNumber, 1 Loyalty, 1 ConsentPayment, 1 Company, 1 Application) and 22 relationships (DRIVES, HAS, FOR, OWNS, IS_MEMBER, GRANTED, USES). Hover a node for its properties, click it to highlight its neighbourhood.",
    "nodes": [
      {
        "external_id": "bearer-token-sub",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "alice@email.com"
          },
          {
            "type": "given_name",
            "value": "Alice"
          },
          {
            "type": "last_name",
            "value": "Smith"
          }
        ]
      },
      {
        "external_id": "knightrider",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "knightrider@demo.com"
          },
          {
            "type": "name",
            "value": "Michael Knight"
          }
        ]
      },
      {
        "external_id": "satchmo",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "satchmo@demo.com"
          },
          {
            "type": "name",
            "value": "Louis Armstrong"
          }
        ]
      },
      {
        "external_id": "karel",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "karel@demo.com"
          },
          {
            "type": "name",
            "value": "Karel Plihal"
          }
        ]
      },
      {
        "external_id": "kitt",
        "type": "Car",
        "is_identity": false,
        "properties": [
          {
            "type": "manufacturer",
            "value": "pontiac"
          },
          {
            "type": "model",
            "value": "Firebird"
          }
        ]
      },
      {
        "external_id": "cadillacv16",
        "type": "Car",
        "is_identity": false,
        "properties": [
          {
            "type": "manufacturer",
            "value": "Cadillac"
          },
          {
            "type": "model",
            "value": "V-16"
          }
        ]
      },
      {
        "external_id": "harmonika",
        "type": "Bus",
        "is_identity": false,
        "properties": [
          {
            "type": "manufacturer",
            "value": "Ikarus"
          },
          {
            "type": "model",
            "value": "280"
          }
        ]
      },
      {
        "external_id": "listek",
        "type": "Ticket",
        "is_identity": false,
        "properties": []
      },
      {
        "external_id": "airbook-xyz",
        "type": "Laptop",
        "is_identity": false,
        "properties": []
      },
      {
        "external_id": "ole",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "ole@yahoo.co.uk"
          },
          {
            "type": "given_name",
            "value": "ole"
          },
          {
            "type": "last_name",
            "value": "einar"
          }
        ]
      },
      {
        "external_id": "cb2563",
        "type": "PaymentMethod",
        "is_identity": false,
        "properties": [
          {
            "type": "payment_name",
            "value": "Credit Card Parking"
          },
          {
            "type": "preference",
            "value": "Pay as you go"
          }
        ]
      },
      {
        "external_id": "carOle",
        "type": "Vehicle",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Car"
          },
          {
            "type": "is_active",
            "value": true
          },
          {
            "type": "vin",
            "value": "pcfjnm78"
          }
        ]
      },
      {
        "external_id": "licenseOle",
        "type": "LicenseNumber",
        "is_identity": false,
        "properties": [
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "AL98745"
          }
        ]
      },
      {
        "external_id": "licenseAlice",
        "type": "LicenseNumber",
        "is_identity": false,
        "properties": [
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "BTYUMN"
          }
        ]
      },
      {
        "external_id": "loyalty1",
        "type": "Loyalty",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Parking Loyalty Plan"
          }
        ]
      },
      {
        "external_id": "consent1",
        "type": "ConsentPayment",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Consent Parking"
          }
        ]
      },
      {
        "external_id": "companyParking",
        "type": "Company",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "City Parking Inc"
          }
        ]
      },
      {
        "external_id": "applicationParking",
        "type": "Application",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "City Mall Parking"
          }
        ]
      },
      {
        "external_id": "cb8521",
        "type": "PaymentMethod"
      },
      {
        "external_id": "carAlice",
        "type": "Car"
      }
    ],
    "relationships": [
      {
        "source": "knightrider",
        "target": "kitt",
        "type": "DRIVES",
        "properties": []
      },
      {
        "source": "satchmo",
        "target": "cadillacv16",
        "type": "DRIVES",
        "properties": []
      },
      {
        "source": "karel",
        "target": "listek",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "listek",
        "target": "harmonika",
        "type": "FOR",
        "properties": []
      },
      {
        "source": "karel",
        "target": "airbook-xyz",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "airbook-xyz",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "knightrider",
        "target": "kitt",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "cadillacv16",
        "type": "DRIVES",
        "properties": []
      },
      {
        "source": "ole",
        "target": "cb2563",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "ole",
        "target": "carOle",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "ole",
        "target": "loyalty1",
        "type": "IS_MEMBER",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "loyalty1",
        "type": "IS_MEMBER",
        "properties": []
      },
      {
        "source": "ole",
        "target": "consent1",
        "type": "GRANTED",
        "properties": []
      },
      {
        "source": "carOle",
        "target": "licenseOle",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "consent1",
        "target": "cb2563",
        "type": "GRANTED",
        "properties": []
      },
      {
        "source": "companyParking",
        "target": "applicationParking",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "applicationParking",
        "target": "consent1",
        "type": "USES",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "cb8521",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "carAlice",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "bearer-token-sub",
        "target": "consent1",
        "type": "GRANTED",
        "properties": []
      },
      {
        "source": "carAlice",
        "target": "licenseAlice",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "consent1",
        "target": "cb8521",
        "type": "GRANTED",
        "properties": []
      }
    ]
  },
  "code": [
    {
      "step": "Step 1",
      "description": "Create the MCP Server configuration. This binds the runtime MCP endpoint (https://<region>.mcp.indykite.com/mcp/v1/<project_gid>) to an AppAgent (the identity the server uses to call IndyKite APIs at runtime, resolved server-side) and a Token Introspect config (used to validate Bearer tokens), and declares the OAuth scopes the server advertises in its .well-known/oauth-protected-resource metadata. Replace gid-of-app-agent and gid-of-token-introspect with the IDs returned in the environment-setup steps.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/mcp-servers",
      "language": "Json",
      "ingest": {
        "app_agent_id": "gid-of-app-agent",
        "token_introspect_id": "gid-of-token-introspect",
        "project_id": "gid-of-project",
        "name": "mcp-server-name",
        "display_name": "MCP Server name",
        "description": "MCP Server configuration description",
        "enabled": true,
        "scopes_supported": [
          "name",
          "email"
        ]
      }
    },
    {
      "step": "Step 2",
      "description": "Capture the nodes needed for this use case (replace bearer-token-sub with actual Bearer token sub).",
      "filename": "POST https://eu.api.indykite.com/capture/v1/nodes/",
      "language": "Json",
      "ingest": {
        "nodes": [
          {
            "external_id": "bearer-token-sub",
            "is_identity": true,
            "type": "Person",
            "properties": [
              {
                "type": "email",
                "value": "alice@email.com"
              },
              {
                "type": "given_name",
                "value": "Alice"
              },
              {
                "type": "last_name",
                "value": "Smith"
              }
            ]
          },
          {
            "external_id": "knightrider",
            "type": "Person",
            "is_identity": true,
            "properties": [
              {
                "type": "email",
                "value": "knightrider@demo.com"
              },
              {
                "type": "name",
                "value": "Michael Knight"
              }
            ]
          },
          {
            "external_id": "satchmo",
            "type": "Person",
            "is_identity": true,
            "properties": [
              {
                "type": "email",
                "value": "satchmo@demo.com"
              },
              {
                "type": "name",
                "value": "Louis Armstrong"
              }
            ]
          },
          {
            "external_id": "karel",
            "type": "Person",
            "is_identity": true,
            "properties": [
              {
                "type": "email",
                "value": "karel@demo.com"
              },
              {
                "type": "name",
                "value": "Karel Plihal"
              }
            ]
          },
          {
            "external_id": "kitt",
            "type": "Car",
            "is_identity": false,
            "properties": [
              {
                "type": "manufacturer",
                "value": "pontiac"
              },
              {
                "type": "model",
                "value": "Firebird"
              }
            ]
          },
          {
            "external_id": "cadillacv16",
            "type": "Car",
            "is_identity": false,
            "properties": [
              {
                "type": "manufacturer",
                "value": "Cadillac"
              },
              {
                "type": "model",
                "value": "V-16"
              }
            ]
          },
          {
            "external_id": "harmonika",
            "type": "Bus",
            "is_identity": false,
            "properties": [
              {
                "type": "manufacturer",
                "value": "Ikarus"
              },
              {
                "type": "model",
                "value": "280"
              }
            ]
          },
          {
            "external_id": "listek",
            "type": "Ticket",
            "is_identity": false
          },
          {
            "external_id": "airbook-xyz",
            "type": "Laptop",
            "is_identity": false
          },
          {
            "external_id": "ole",
            "is_identity": true,
            "type": "Person",
            "properties": [
              {
                "type": "email",
                "value": "ole@yahoo.co.uk"
              },
              {
                "type": "given_name",
                "value": "ole"
              },
              {
                "type": "last_name",
                "value": "einar"
              }
            ]
          },
          {
            "external_id": "cb2563",
            "type": "PaymentMethod",
            "properties": [
              {
                "type": "payment_name",
                "value": "Credit Card Parking"
              },
              {
                "type": "preference",
                "value": "Pay as you go"
              }
            ]
          },
          {
            "external_id": "carOle",
            "type": "Vehicle",
            "properties": [
              {
                "type": "category",
                "value": "Car"
              },
              {
                "type": "is_active",
                "value": true
              },
              {
                "type": "vin",
                "value": "pcfjnm78"
              }
            ]
          },
          {
            "external_id": "licenseOle",
            "type": "LicenseNumber",
            "properties": [
              {
                "type": "status",
                "value": "Active"
              },
              {
                "type": "number",
                "value": "AL98745",
                "metadata": {
                  "assurance_level": 3,
                  "source": "BRREG"
                }
              }
            ]
          },
          {
            "external_id": "licenseAlice",
            "type": "LicenseNumber",
            "properties": [
              {
                "type": "status",
                "value": "Active"
              },
              {
                "type": "number",
                "value": "BTYUMN",
                "metadata": {
                  "assurance_level": 3,
                  "source": "BRREG"
                }
              }
            ]
          },
          {
            "external_id": "loyalty1",
            "type": "Loyalty",
            "properties": [
              {
                "type": "name",
                "value": "Parking Loyalty Plan"
              }
            ]
          },
          {
            "external_id": "consent1",
            "type": "ConsentPayment",
            "properties": [
              {
                "type": "name",
                "value": "Consent Parking"
              }
            ]
          },
          {
            "external_id": "companyParking",
            "type": "Company",
            "properties": [
              {
                "type": "name",
                "value": "City Parking Inc"
              }
            ]
          },
          {
            "external_id": "applicationParking",
            "type": "Application",
            "properties": [
              {
                "type": "name",
                "value": "City Mall Parking"
              }
            ]
          }
        ]
      }
    },
    {
      "step": "Step 2",
      "description": "Capture the relationships needed for this use case (replace bearer-token-sub with actual Bearer token sub).",
      "filename": "POST https://eu.api.indykite.com/capture/v1/relationships/",
      "language": "Json",
      "ingest": {
        "relationships": [
          {
            "source": {
              "external_id": "knightrider",
              "type": "Person"
            },
            "target": {
              "external_id": "kitt",
              "type": "Car"
            },
            "type": "DRIVES"
          },
          {
            "source": {
              "external_id": "satchmo",
              "type": "Person"
            },
            "target": {
              "external_id": "cadillacv16",
              "type": "Car"
            },
            "type": "DRIVES"
          },
          {
            "source": {
              "external_id": "karel",
              "type": "Person"
            },
            "target": {
              "external_id": "listek",
              "type": "Ticket"
            },
            "type": "HAS"
          },
          {
            "source": {
              "external_id": "listek",
              "type": "Ticket"
            },
            "target": {
              "external_id": "harmonika",
              "type": "Bus"
            },
            "type": "FOR"
          },
          {
            "source": {
              "external_id": "karel",
              "type": "Person"
            },
            "target": {
              "external_id": "airbook-xyz",
              "type": "Laptop"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "airbook-xyz",
              "type": "Laptop"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "knightrider",
              "type": "Person"
            },
            "target": {
              "external_id": "kitt",
              "type": "Car"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "cadillacv16",
              "type": "Car"
            },
            "type": "DRIVES"
          },
          {
            "source": {
              "external_id": "ole",
              "type": "Person"
            },
            "target": {
              "external_id": "cb2563",
              "type": "PaymentMethod"
            },
            "type": "HAS"
          },
          {
            "source": {
              "external_id": "ole",
              "type": "Person"
            },
            "target": {
              "external_id": "carOle",
              "type": "Car"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "ole",
              "type": "Person"
            },
            "target": {
              "external_id": "loyalty1",
              "type": "Loyalty"
            },
            "type": "IS_MEMBER"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "loyalty1",
              "type": "Loyalty"
            },
            "type": "IS_MEMBER"
          },
          {
            "source": {
              "external_id": "ole",
              "type": "Person"
            },
            "target": {
              "external_id": "consent1",
              "type": "ConsentPayment"
            },
            "type": "GRANTED"
          },
          {
            "source": {
              "external_id": "carOle",
              "type": "Car"
            },
            "target": {
              "external_id": "licenseOle",
              "type": "LicenseNumber"
            },
            "type": "HAS"
          },
          {
            "source": {
              "external_id": "consent1",
              "type": "ConsentPayment"
            },
            "target": {
              "external_id": "cb2563",
              "type": "PaymentMethod"
            },
            "type": "GRANTED"
          },
          {
            "source": {
              "external_id": "companyParking",
              "type": "Company"
            },
            "target": {
              "external_id": "applicationParking",
              "type": "Application"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "applicationParking",
              "type": "Application"
            },
            "target": {
              "external_id": "consent1",
              "type": "ConsentPayment"
            },
            "type": "USES"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "cb8521",
              "type": "PaymentMethod"
            },
            "type": "HAS"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "carAlice",
              "type": "Car"
            },
            "type": "OWNS"
          },
          {
            "source": {
              "external_id": "bearer-token-sub",
              "type": "Person"
            },
            "target": {
              "external_id": "consent1",
              "type": "ConsentPayment"
            },
            "type": "GRANTED"
          },
          {
            "source": {
              "external_id": "carAlice",
              "type": "Car"
            },
            "target": {
              "external_id": "licenseAlice",
              "type": "LicenseNumber"
            },
            "type": "HAS"
          },
          {
            "source": {
              "external_id": "consent1",
              "type": "ConsentPayment"
            },
            "target": {
              "external_id": "cb8521",
              "type": "PaymentMethod"
            },
            "type": "GRANTED"
          }
        ]
      }
    },
    {
      "step": "Step 3",
      "description": "Create a CIQ Policy which designates the Subject node, the cypher and the nodes allowed to be read.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/authorization-policies",
      "language": "Json",
      "ingest": {
        "project_id": "your_project_gid",
        "description": "description of policy",
        "display_name": "policy name",
        "name": "policy-name",
        "policy": "{\"meta\":{\"policy_version\":\"1.0-ciq\"},\"subject\":{\"type\":\"Person\"},\"condition\":{\"cypher\":\"MATCH (subject:Person) MATCH (app:Application)-[:USES]->(consentpayment:ConsentPayment)<-[:GRANTED]-(subject)-[:HAS]->(paymentmethod:PaymentMethod) MATCH (subject)-[:IS_MEMBER]->(loyalty:Loyalty) MATCH (subject)-[:OWNS]->(car:Car)-[:HAS]->(ln:LicenseNumber)\",\"filter\":[{\"operator\":\"AND\",\"operands\":[{\"attribute\":\"subject.external_id\",\"operator\":\"=\",\"value\":\"$token.sub\"},{\"attribute\":\"subject.property.email\",\"operator\":\"=\",\"value\":\"$subject_email\"}]}]},\"allowed_reads\":{\"nodes\":[\"ln.*\",\"app.*\",\"paymentmethod.external_id\"]}}",
        "status": "ACTIVE",
        "tags": []
      }
    },
    {
      "step": "Step 4",
      "description": "Create a CIQ Query in the context of the policy. The MCP server publishes it as a tool named after the query (payment-method-by-license) and described by its description, so give in the description all the necessary information an agent would need to call that tool.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/knowledge-queries",
      "language": "Json",
      "ingest": {
        "project_id": "your_project_gid",
        "description": "Returns the payment method of the caller's car with the given license plate. input_params: {subject_email: (required) the caller's email, license: (required) car license plate}. Auth: Bearer token required; the policy binds the subject to the token 'sub' claim. Returns: payment_method_external_id",
        "display_name": "Payment method by license plate",
        "name": "payment-method-by-license",
        "policy_id": "your_policy_gid",
        "query": "{\"nodes\":[\"paymentmethod.external_id\"],\"filter\":{\"attribute\":\"ln.property.number\",\"operator\":\"=\",\"value\":\"$license\"}}",
        "status": "ACTIVE"
      }
    },
    {
      "step": "Step 5",
      "description": "Create a KBAC Policy which designates the conditions to drive a car. ",
      "filename": "POST https://eu.api.indykite.com/configs/v1/authorization-policies",
      "language": "Json",
      "ingest": {
        "project_id": "your_project_gid",
        "description": "description of policy",
        "display_name": "policy name",
        "name": "policy-name",
        "policy": "{\"meta\":{\"policy_version\":\"2.0-kbac\"},\"subject\":{\"type\":\"Person\"},\"actions\":[\"CAN_DRIVE\"],\"resource\":{\"type\":\"Car\"},\"condition\":{\"cypher\":\"MATCH (subject:Person)-[:DRIVES]->(resource:Car)\"}}",
        "status": "ACTIVE",
        "tags": []
      }
    },
    {
      "step": "Step 6",
      "description": "Initialize a session with the MCP server. Returns capabilities and session id. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>   -H \"Content-Type: application/json\"   -H \"Authorization: Bearer $BEARER_TOKEN\"   -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"initialize\",\n    \"params\": {\n      \"protocolVersion\": \"2025-11-25\",\n      \"capabilities\": {},\n      \"clientInfo\": {\n        \"name\": \"curl\",\n        \"version\": \"1.0\"\n      }\n    }\n  }'"
    },
    {
      "description": "Check if session is initialized with the MCP server. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>   -H \"Content-Type: application/json\"   -H \"Authorization: Bearer $BEARER_TOKEN\"   -H \"Mcp-Session-Id: $SESSION_ID\"   -d '{\n    \"jsonrpc\": \"2.0\",\n    \"id\": 1,\n    \"method\": \"notifications/initialized\",\n    \"params\": {\n      \"protocolVersion\": \"2025-11-25\",\n      \"capabilities\": {},\n      \"clientInfo\": {\n        \"name\": \"curl\",\n        \"version\": \"1.0\"\n      }\n    }\n  }'1"
    },
    {
      "description": "List resources available in the MCP server. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid> -H \"Content-Type: application/json\"  -H \"Authorization: Bearer $BEARER_TOKEN\" -H \"Mcp-Session-Id: $SESSION_ID\" -d '{\n      \"jsonrpc\": \"2.0\",\n      \"id\": 2,\n      \"method\": \"resources/list\",\n      \"params\": {}\n    }'"
    },
    {
      "description": "List tools available in the MCP server. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid> -H \"Content-Type: application/json\" -H \"Authorization: Bearer $BEARER_TOKEN\" -H \"Mcp-Session-Id: $SESSION_ID\" -d '{\n      \"jsonrpc\": \"2.0\",\n      \"id\": 3,\n      \"method\": \"tools/list\",\n      \"params\": {}\n    }'"
    },
    {
      "description": "List tools response. ",
      "language": "JsonRPC",
      "code": "\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 3,\n  \"result\": {\n    \"tools\": [\n      {\n        \"name\": \"authzen_evaluate\",\n        \"description\": \"Evaluate access with AuthZEN evaluation endpoint\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"subject_type\",\n            \"subject_id\",\n            \"resource_type\",\n            \"resource_id\",\n            \"action_name\"\n          ],\n          \"properties\": {\n            \"subject_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of subject\"\n            },\n            \"subject_id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: ID of subject\"\n            },\n            \"resource_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of resource\"\n            },\n            \"resource_id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: ID of resource\"\n            },\n            \"action_name\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Action name\"\n            },\n            \"context\": {\n              \"type\": \"object\",\n              \"description\": \"Optional context\",\n              \"additionalProperties\": true\n            }\n          },\n          \"additionalProperties\": false\n        }\n      },\n      {\n        \"name\": \"authzen_evaluations\",\n        \"description\": \"Execute multiple access evaluations in a single request\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"required\": [\"evaluations\"],\n          \"properties\": {\n            \"evaluations\": {\n              \"type\": \"array\",\n              \"description\": \"required, description: Evaluations\",\n              \"items\": {\n                \"type\": \"object\",\n                \"additionalProperties\": true\n              }\n            },\n            \"action_name\": {\n              \"type\": [\"null\", \"string\"],\n              \"description\": \"Default action name\"\n            },\n            \"resource_type\": {\n              \"type\": [\"null\", \"string\"],\n              \"description\": \"Default resource type\"\n            },\n            \"resource_id\": {\n              \"type\": [\"null\", \"string\"],\n              \"description\": \"Default resource ID\"\n            },\n            \"subject_type\": {\n              \"type\": [\"null\", \"string\"],\n              \"description\": \"Default subject type\"\n            },\n            \"subject_id\": {\n              \"type\": [\"null\", \"string\"],\n              \"description\": \"Default subject ID\"\n            },\n            \"context\": {\n              \"type\": \"object\",\n              \"description\": \"Optional context\",\n              \"additionalProperties\": true\n            }\n          },\n          \"additionalProperties\": false\n        }\n      },\n      {\n        \"name\": \"authzen_search_action\",\n        \"description\": \"Search for all actions a subject can perform on a resource\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"subject_type\",\n            \"subject_id\",\n            \"resource_type\",\n            \"resource_id\"\n          ],\n          \"properties\": {\n            \"subject_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of subject\"\n            },\n            \"subject_id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: ID of subject\"\n            },\n            \"resource_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of resource\"\n            },\n            \"resource_id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: ID of resource\"\n            },\n            \"context\": {\n              \"type\": \"object\",\n              \"description\": \"Optional context\",\n              \"additionalProperties\": true\n            },\n            \"page\": {\n              \"type\": \"object\",\n              \"description\": \"Pagination parameters\",\n              \"additionalProperties\": true\n            }\n          },\n          \"additionalProperties\": false\n        }\n      },\n      {\n        \"name\": \"authzen_search_resource\",\n        \"description\": \"Search for resources a subject can access with a specified action\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"subject_type\",\n            \"subject_id\",\n            \"resource_type\",\n            \"action_name\"\n          ],\n          \"properties\": {\n            \"subject_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of subject\"\n            },\n            \"subject_id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: ID of subject\"\n            },\n            \"resource_type\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Type of resource\"\n            },\n            \"action_name\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Action name\"\n            },\n            \"context\": {\n              \"type\": \"object\",\n              \"description\": \"Optional context\",\n              \"additionalProperties\": true\n            },\n            \"page\": {\n              \"type\": \"object\",\n              \"description\": \"Pagination parameters\",\n              \"additionalProperties\": true\n            }\n          },\n          \"additionalProperties\": false\n        }\n      },\n      {\n        \"name\": \"ciq_execute\",\n        \"description\": \"Deprecated: call the tool named after the query instead. Execute a ContX IQ (CIQ) query by id (knowledge_query id)\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"required\": [\"id\"],\n          \"properties\": {\n            \"id\": {\n              \"type\": \"string\",\n              \"description\": \"required, description: Knowledge query ID\"\n            },\n            \"input_params\": {\n              \"type\": \"object\",\n              \"description\": \"Optional input parameters\",\n              \"additionalProperties\": true\n            },\n            \"page_size\": {\n              \"type\": [\"null\", \"integer\"],\n              \"description\": \"Optional page size (default 100)\"\n            },\n            \"page_token\": {\n              \"type\": [\"null\", \"integer\"],\n              \"description\": \"Optional pagination token\"\n            }\n          },\n          \"additionalProperties\": false\n        }\n      },\n      {\n        \"name\": \"payment-method-by-license\",\n        \"description\": \"Returns the payment method of the caller's car with the given license plate. input_params: {subject_email: (required) the caller's email, license: (required) car license plate}. Auth: Bearer token required; the policy binds the subject to the token 'sub' claim. Returns: payment_method_external_id\",\n        \"inputSchema\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"input_params\": {\n              \"type\": \"object\",\n              \"description\": \"Optional input parameters\",\n              \"additionalProperties\": true\n            },\n            \"page_size\": {\n              \"type\": [\"null\", \"integer\"],\n              \"description\": \"Optional page size (default 100)\"\n            },\n            \"page_token\": {\n              \"type\": [\"null\", \"integer\"],\n              \"description\": \"Optional pagination token\"\n            }\n          },\n          \"additionalProperties\": false\n        }\n      }\n    ]\n  }\n}"
    },
    {
      "description": "Call the knowledge-queries resource. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid> -H \"Content-Type: application/json\" -H \"Authorization: Bearer $BEARER_TOKEN\" -H \"Mcp-Session-Id: $SESSION_ID\" -d '{\n      \"jsonrpc\": \"2.0\",\n      \"id\": 4,\n      \"method\": \"resources/read\",\n      \"params\": {\n        \"uri\": \"indykite://knowledge-queries/\"\n      }\n    }'\n    "
    },
    {
      "description": "Call the knowledge-queries resource. ",
      "language": "JsonRPC",
      "code": "\n    {\n        \"jsonrpc\":\"2.0\",\n        \"id\":4,\n        \"result\":{\n            \"contents\":[\n            {\n                \"uri\":\"indykite://knowledge-queries/\",\n                \"mimeType\":\"application/json\",\n                \"text\":{\n                    \"knowledge_queries\": [\n                        {\n                            \"id\": \"<knowledge_queries_id>\",\n                            \"description\": \"Returns the payment method of the caller's car with the given license plate. input_params: {subject_email: (required) the caller's email, license: (required) car license plate}. Auth: Bearer token required; the policy binds the subject to the token 'sub' claim. Returns: payment_method_external_id\",\n                            \"status\": \"STATUS_ACTIVE\"\n                        }\n                    ],\n                    \"mcp_url\": \"https://eu.mcp.indykite.com/mcp/v1/<project_id>>\",\n                    \"total_count\": 1\n                }\n            }\n            ]\n        }\n    }\n    "
    },
    {
      "description": "Call the authzen_evaluate tool to check if according to the KBAC policy, the subject authorized by the Bearer access token can drive the car. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid> -H \"Content-Type: application/json\" -H \"Authorization: Bearer $BEARER_TOKEN\" -H \"Mcp-Session-Id: $SESSION_ID\" -d '{\n      \"jsonrpc\": \"2.0\",\n      \"id\": 5,\n      \"method\": \"tools/call\",\n      \"params\": {\n        \"name\": \"authzen_evaluate\",\n        \"arguments\": {\n          \"subject_type\": \"Person\",\n          \"subject_id\": <bearer-token-sub>,\n          \"resource_type\": \"Car\",\n          \"resource_id\": \"cadillacv16\",\n          \"action_name\": \"CAN_DRIVE\"\n        }\n      }\n    }'\n    "
    },
    {
      "description": "Authzen_evaluate tool response. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "\n    {\n        \"jsonrpc\":\"2.0\",\n        \"id\":5,\n        \"result\":{\n            \"content\":[\n            {\n            \"type\":\"text\",\n            \"text\": {\"decision\":true}\n            }\n            ]\n        }\n    }\n    "
    },
    {
      "description": "Call the payment-method-by-license tool, the tool of the Knowledge Query, to get the payment method designated by the CIQ policy for the subject authorized by the Bearer access token. The query is fixed by the tool, so the arguments carry only its input_params and paging. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "curl -v -i -X POST https://eu.mcp.indykite.com/mcp/v1/<project_gid> -H \"Content-Type: application/json\" -H \"Authorization: Bearer $BEARER_TOKEN\" -H \"Mcp-Session-Id: $SESSION_ID\" -d '{\n      \"jsonrpc\": \"2.0\",\n      \"id\": 9,\n      \"method\": \"tools/call\",\n      \"params\": {\n        \"name\": \"payment-method-by-license\",\n        \"arguments\": {\n          \"input_params\": {\"license\": \"BTYUMN\",\"subject_email\": \"alice@email.com\"},\n          \"page_token\": 1\n        }\n      }\n   }'\n    "
    },
    {
      "description": "Knowledge Query tool response: the execute answer as text content. ",
      "filename": "POST https://eu.mcp.indykite.com/mcp/v1/<project_gid>",
      "language": "JsonRPC",
      "code": "\n    {\n        \"jsonrpc\":\"2.0\",\n        \"id\":9,\n        \"result\":{\n            \"content\":[{\n                \"type\":\"text\",\n                \"text\":{\n                    \"data\":[{\n                        \"nodes\":{\n                            \"paymentmethod.external_id\":\"cb8521\"\n                        }\n                    }]\n                }\n            }]\n        }\n    }\n\n    "
    }
  ],
  "links": {
    "html": "/resources/mcp-1",
    "markdown": "/resources/mcp-1.md",
    "openApi": "https://openapi.indykite.com/"
  }
}