Skip to content

Connect Torii to ChatGPT: Manage SaaS Users, Apps, and Contracts

Learn how to connect Torii to ChatGPT using a managed MCP server. Automate SaaS discovery, user audits, and contract management workflows with AI.

Uday Gajavalli Uday Gajavalli · · 10 min read
Connect Torii to ChatGPT: Manage SaaS Users, Apps, and Contracts

If you need to connect Torii to ChatGPT to automate SaaS application discovery, manage user offboarding, or track software contracts, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool-calling capabilities and Torii's REST API. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses Claude, check out our guide on connecting Torii to Claude or explore our broader architectural overview on connecting Torii to AI Agents.

Giving a Large Language Model (LLM) read and write access to a sprawling IT management ecosystem like Torii is an engineering challenge. You have to handle API authentication, map massive JSON schemas to MCP tool definitions, and deal with Torii's specific data validation requirements. Every time an endpoint changes or you need to support custom application fields, you have to update your server code, redeploy, and test the integration. This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Torii, connect it natively to ChatGPT, and execute complex IT administration workflows using natural language.

The Engineering Reality of the Torii API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against vendor APIs is painful. If you decide to build a custom MCP server for Torii, you own the entire API lifecycle (see our hands-on guide to building MCP servers for the full scope of requirements).

Endpoint-Specific Rate Limits and 429 Errors

Torii enforces strict, heavily varied rate limits depending on the exact resource you are calling. For example, getting a single contract allows up to 800 requests per minute, but listing roles is throttled to 100 requests per minute. Creating new apps is capped at 200 requests per minute.

When these limits are hit, Torii returns an HTTP 429 error. Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream API returns a 429, Truto passes that error directly back to the caller. We normalize the upstream rate limit info into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. It is entirely the responsibility of your AI agent or the ChatGPT client to read these headers, catch the error, and implement exponential backoff. If you do not explicitly prompt your agent to handle 429s, it will assume the tool call succeeded and hallucinate the response.

Multi-Currency Contract Complexity

Handling financial data in Torii is not a simple key-value operation. When you create or update a contract, the currency cannot be a top-level field. The API requires nested object-based amount fields for specifying currency values, and multi-currency fields are returned strictly in the contract currency. If your MCP server does not provide an explicitly detailed JSON schema for the create_a_torii_contract or update_a_torii_contract_by_id tools, the LLM will attempt to pass a flat integer or string for cost, resulting in a validation failure from Torii.

Custom Application Details and Schema Drift

Torii allows IT teams to define custom fields for apps via Custom Application Details. When calling update_a_torii_app_by_id, the payload must accurately target these custom fields based on the specific organization's configuration. Hardcoding a static schema in a custom MCP server means your integration will break the moment an IT administrator adds a new required metadata field to their Torii instance. You need a system that dynamically derives schemas directly from the connected account's live metadata.

Generating the Torii MCP Server

Instead of writing boilerplate JSON-RPC handlers and building schema mapping logic, Truto allows you to instantly generate an MCP server for any connected Torii account. Tool generation in Truto is dynamic and documentation-driven, following our 2026 architecture guide for auto-generated MCP tools. Rather than hand-coding definitions, Truto derives them from the integration's resource configurations and automatically injects critical instructions - like pagination constraints - directly into the schemas.

You can create a Torii MCP server in two ways.

Method 1: Via the Truto UI

For no-code deployments and rapid testing, you can spin up a server directly from the dashboard.

  1. Navigate to the Integrated Accounts page in your Truto environment and select your connected Torii account.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration. You can specify a human-readable name, restrict the allowed methods (e.g., only allow read operations to prevent ChatGPT from modifying data), and set an optional expiration time.
  5. Click Create and copy the generated MCP server URL (e.g., https://api.truto.one/mcp/a1b2c3d4e5f6...).

Method 2: Via the REST API

For programmatic, scalable deployments - such as provisioning MCP servers automatically for your end users - you can call the Truto API.

The API generates a secure token, hashes it via HMAC for storage in Cloudflare KV, and returns a ready-to-use URL. The raw token is never stored directly.

curl -X POST https://api.truto.one/integrated-account/{integrated_account_id}/mcp \
  -H "Authorization: Bearer YOUR_TRUTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Torii Audit Agent Server",
    "config": {
      "methods": ["read", "write"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'

The response contains the exact URL you will feed into the LLM framework:

{
  "id": "mcp_token_abc123",
  "name": "Torii Audit Agent Server",
  "config": {
    "methods": ["read", "write"]
  },
  "expires_at": "2026-12-31T23:59:59.000Z",
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f67890"
}

Connecting the Torii MCP Server to ChatGPT

Once you have the Truto MCP URL, connecting it to ChatGPT takes seconds. The URL encodes the specific integrated account, meaning the server is entirely self-contained. No additional OAuth handshakes are required on the client side.

Method A: Via the ChatGPT UI

If you are using ChatGPT directly for internal IT operations, you can connect the server via the UI.

  1. In ChatGPT, click your profile and go to Settings.
  2. Navigate to Apps -> Advanced settings.
  3. Enable Developer mode (MCP support requires this flag).
  4. Under MCP servers or Custom connectors, click Add a new server.
  5. Give it a name like "Torii IT Operations".
  6. Paste the Truto MCP URL into the Server URL field and click Save.

ChatGPT will immediately ping the endpoint, execute the tools/list JSON-RPC handshake, and populate its context with the available Torii capabilities.

Method B: Via Manual Config File (SSE Transport)

If you are running a local agent, Claude Desktop, or a framework that requires a JSON configuration file, you can utilize the standard SSE transport wrapper.

Add the following to your configuration file (e.g., claude_desktop_config.json or your custom agent config):

{
  "mcpServers": {
    "torii-it-ops": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/a1b2c3d4e5f67890"
      ]
    }
  }
}

When the agent spins up, it will execute the npx command to bridge the Server-Sent Events transport to the Truto MCP endpoint.

Hero Tools for Torii SaaS Management

Truto dynamically translates Torii's API endpoints into snake_case MCP tools complete with deeply nested JSON schemas. Here are the highest-leverage tools available for your AI agents.

list_all_torii_users

Retrieves the full directory of users in the Torii organization. This tool returns crucial state fields including lifecycleStatus, isDeletedInIdentitySources, isExternal, and activeAppsCount. It is the foundation for any onboarding, offboarding, or license recovery workflow.

"Fetch a list of all Torii users. Filter the results down to users where lifecycleStatus is 'Suspended' but their activeAppsCount is greater than 0, then output their email addresses in a markdown table."

get_single_torii_user_by_id

Provides a deep dive into a specific identity. Once an agent flags a suspicious or offboarded user, it uses this tool to extract role definitions, creation times, and precise state details to inform the next automated action.

"Get the full user profile for the user ID 'usr_892b1a'. Summarize their current role and tell me exactly when their account was created."

list_all_torii_apps

Lists all discovered applications used within the organization. This tool exposes the application state, category, primary owner, and whether it is hidden. It is critical for shadow IT discovery and app rationalization initiatives.

"List all apps in Torii. Identify any applications categorized as 'File Sharing' that do not have a registered primaryOwner. Output the app IDs and names."

update_a_torii_app_by_id

Allows the AI agent to mutate application metadata. You can use this to update an app's state (e.g., moving it from 'Discovered' to 'Sanctioned') or to populate custom fields via Application Details.

"Update the Torii app with ID 'app_55421' and change its state to 'Sanctioned'. Ensure you preserve the existing tags and URLs in the request payload."

list_all_torii_contracts

Fetches all SaaS contracts managed within Torii. This exposes contract statuses, associated application IDs, and nested multi-currency fields. This is the primary tool for automated renewal tracking and vendor spend analysis.

"Retrieve all Torii contracts. Find any contracts where the status is 'Active' but the renewal date is within the next 45 days. Calculate the total cost of these upcoming renewals in USD."

list_all_torii_audit_logs

Accesses the admin audit logs, sorted by creation time. This returns the actor (performedByEmail), target organization, event type, and detailed properties. It allows an LLM to act as a security analyst, auditing configuration changes over time.

"Fetch the most recent Torii audit logs. Look for any log entries where the type involves 'Role Change' or 'Permission Escalation' in the last 7 days and describe what happened."

For the complete tool inventory, including application user mapping, file uploads, and workflow action executions, visit the Torii integration page.

Workflows in Action

When you combine these tools inside a reasoning model like ChatGPT, you unlock complex, multi-step IT operations. The LLM handles the orchestration, schema mapping, and data synthesis automatically. Here are two real-world examples.

Scenario 1: Shadow IT Discovery and Triage

IT teams struggle to keep up with employees adopting unsanctioned SaaS tools. An AI agent can proactively audit the environment, find unowned applications, and draft risk reports.

"Analyze our Torii instance for Shadow IT. Find all applications that are currently in the 'Discovered' state and lack a primary owner. For the top 5 most popular unowned apps (by active user count), fetch their details and write a short Slack message I can send to the security team to initiate an audit."

Step-by-Step Execution:

  1. The agent calls list_all_torii_apps to pull down the organization's app catalog.
  2. It filters the JSON response in memory, isolating objects where state equals 'Discovered' and primaryOwner is null.
  3. It identifies the 5 apps with the highest usage metrics.
  4. It calls get_single_torii_app_by_id for each of those 5 apps to retrieve extended metadata, category info, and descriptions.
  5. It synthesizes the data into a formatted Slack message.

Result: The IT admin receives a ready-to-send alert detailing the highest-risk unsanctioned applications without clicking through dozens of dashboards.

Scenario 2: Employee Offboarding Access Verification

When an employee leaves, verifying that their access has been revoked across the entire SaaS stack is tedious and error-prone. ChatGPT can audit the offboarding state and highlight lingering access.

"Check the offboarding status for jsmith@company.com. Verify that their Torii user profile is marked as suspended. Then, list all applications they still have active accounts in. If they are still active in any apps, list the App IDs so we can manually terminate them."

Step-by-Step Execution:

  1. The agent calls list_all_torii_users and filters for the email to retrieve the Torii id.
  2. It calls get_single_torii_user_by_id using that ID to verify that lifecycleStatus is 'Suspended'.
  3. It calls list_all_torii_user_applications passing the id_user as a query parameter.
  4. It iterates through the application list, checking the state and isUserRemovedFromApp fields.
  5. It outputs a summary report highlighting any app where the user retains an active seat.

Result: A definitive, cryptographically backed audit report proving whether the employee has been fully offboarded or where remediation is required.

Security and Access Control

Giving an AI agent access to your SaaS management platform requires strict security boundaries. Truto provides multiple mechanisms to lock down your Torii MCP servers at the infrastructure level, ensuring you are building SOC 2 and GDPR compliant AI agents.

  • Method Filtering: Limit the blast radius by configuring the server with methods: ["read"]. This drops all POST, PUT, PATCH, and DELETE operations during tool generation. The LLM physically cannot mutate data because the tools do not exist in its context.
  • Tag Filtering: Restrict access to specific functional areas. If Torii resources are tagged in Truto (e.g., ["audit"]), you can configure the MCP server to only expose tools matching those tags. This prevents an audit agent from accidentally reading financial contracts.
  • Time-To-Live (TTL): Set the expires_at property when generating the server. Truto uses Cloudflare KV expirations and Durable Object alarms to guarantee the server is destroyed at the specified time. This is perfect for granting temporary access to external contractors or temporary workflow runs.
  • Require API Token Auth: Enable require_api_token_auth: true to enforce a dual-layer security model. By default, possession of the MCP URL grants access. With this flag enabled, the client must also pass a valid Truto API token in the Authorization header, verifying their identity before the JSON-RPC call is processed.

Rethink Your IT Automation

Building a custom MCP server for Torii is a distraction from your core product or internal operations. Navigating multi-currency schemas, managing endpoint-specific rate limits, and dealing with dynamic custom fields require constant engineering maintenance.

By leveraging Truto's managed MCP infrastructure, you bypass the boilerplate entirely. You get dynamically generated, documentation-driven tools that update automatically as the upstream API evolves. Your engineers can focus on crafting intelligent agent workflows, rather than debugging token refreshes and pagination loops.

FAQ

Does Truto automatically retry Torii API requests if they hit rate limits?
No. Truto passes HTTP 429 errors directly to the caller and normalizes upstream rate limit info into standardized IETF headers. Your ChatGPT agent or client application must implement its own exponential backoff and retry logic.
Can I restrict ChatGPT to read-only access for Torii?
Yes. When creating the MCP server via Truto, you can pass a configuration object with method filtering (e.g., methods: ["read"]) to ensure the LLM can only query data, not modify or delete it.
How do I connect the Truto MCP server to ChatGPT?
You can connect it via the ChatGPT UI by enabling Developer Mode and adding a custom connector, or by using a manual config file with the @modelcontextprotocol/server-sse command.

More from our Blog