Connect Samsara to Claude: Analyze Industrial Assets and Sensors
Learn how to build a managed MCP server to connect Claude to Samsara's API. Automate IoT sensor analysis, fleet tracking, and safety compliance without writing boilerplate.
If your team needs to connect Samsara to Claude to automate fleet logistics, monitor industrial IoT sensors, or audit driver safety compliance, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's LLM tool calls and Samsara's highly complex REST APIs. 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 ChatGPT, check out our guide on connecting Samsara to ChatGPT or explore our broader architectural overview on connecting Samsara to AI Agents.
Giving a Large Language Model (LLM) read and write access to a specialized industrial data platform like Samsara is an engineering challenge. You must handle legacy versus beta API endpoints, map massive time-series JSON schemas to MCP tool definitions, and deal with strict pagination for IoT telemetry. Every time Samsara deprecates a legacy equipment endpoint in favor of its newer V2 APIs, 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 Samsara, connect it natively to Claude, and execute complex industrial asset workflows using natural language.
The Engineering Reality of the Samsara 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 specialized hardware and logistics APIs is painful. Samsara is built to manage everything from dashboard cameras and tachographs to cold-chain temperature sensors and Hours of Service (HOS) compliance rules.
If you decide to build a custom Samsara MCP server, here are the specific integration challenges you will face:
API Fragmentation and Legacy Debt
Samsara's API surface is heavily fragmented. Many critical endpoints are still running on their legacy architecture (e.g., /v1/fleet/locations), while others have migrated to the beta or V2 industrial APIs. An LLM has no context on which API version to use for a specific asset. You must build an abstraction layer that presents a unified set of operations to Claude, hiding the underlying endpoint fragmentation. If Claude tries to query a V1 endpoint using a V2 UUID format, the request will fail.
Time-Series Telemetry and Streaming Feeds
Unlike a CRM where you fetch a single record, industrial IoT relies on continuous data streams and time-series telemetry. Polling endpoints like list_all_samsara_data_points_histories requires strict adherence to startTime and endTime window constraints. Additionally, Samsara relies on cursor-based pagination for high-frequency data. If your MCP server doesn't instruct the LLM on exactly how to pass the next_cursor back to the API unchanged, the model will hallucinate query parameters and fail to paginate through large sensor histories.
Transparent Rate Limiting
Samsara enforces strict API rate limits to protect its real-time telemetry systems. It is critical to understand that Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Samsara API returns an HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller (in this case, your Claude client or orchestration layer) is strictly responsible for interpreting these headers and executing its own retry and backoff logic. Do not assume the integration layer will absorb these limits for you.
Generating the Samsara MCP Server
To bridge Claude and Samsara, we will generate a managed MCP server using Truto. This server is dynamically derived from Samsara's API documentation, meaning no manual tool coding is required. You can generate the server via the Truto UI or programmatically via the API.
Method 1: Via the Truto UI
For teams moving fast, you can generate an MCP server directly from your connected Samsara account.
- Log into Truto and navigate to your Integrated Accounts.
- Select your connected Samsara account.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration (e.g., read-only methods, specific tags like
fleetorsafety). - Copy the generated MCP server URL (e.g.,
https://api.truto.one/mcp/abc123def456...).
Method 2: Via the Truto API
For platform engineers building multi-tenant AI agents, you can provision Samsara MCP servers programmatically for each of your customers. Make a POST request to /integrated-account/:id/mcp.
const response = await fetch('https://api.truto.one/integrated-account/<samsara_account_id>/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TRUTO_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "Samsara Safety Agent MCP",
config: {
methods: ["read"], // Restrict Claude to read-only operations
tags: ["safety", "compliance", "telemetry"]
},
expires_at: "2025-12-31T23:59:59Z"
})
});
const mcpServer = await response.json();
console.log(mcpServer.url);
// Pass this URL to your MCP clientConnecting the MCP Server to Claude
Once you have your secure Truto MCP URL, you need to register it with Claude. This allows Claude to instantly discover the Samsara schemas and invoke them as tools.
Option A: Via the Claude Desktop UI
If you are using Claude Desktop or an enterprise workspace that supports visual connector configuration:
- Open Claude and navigate to Settings -> Integrations -> Add MCP Server.
- Name your connection (e.g., "Samsara Production Fleet").
- Paste the Truto MCP server URL you generated earlier.
- Click Add. Claude will perform a handshake, validating the available tools, and immediately equip your model with Samsara capabilities.
Option B: Via the JSON Configuration File
If you are deploying Claude Desktop locally or managing configuration via code, edit your claude_desktop_config.json file. You will use the official @modelcontextprotocol/server-sse package to connect to Truto's remote endpoint.
{
"mcpServers": {
"samsara-fleet-ops": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/YOUR_SECURE_TOKEN_HERE"
]
}
}
}Restart Claude Desktop. The model will initialize the connection via Server-Sent Events (SSE) and parse the dynamic tool definitions.
sequenceDiagram
participant Claude as Claude Desktop
participant Truto as Truto MCP Server
participant Samsara as Samsara API
Claude->>Truto: POST /initialize (Handshake)
Truto-->>Claude: Returns 2024-11-05 Protocol & Capabilities
Claude->>Truto: POST /tools/list
Truto-->>Claude: Array of Samsara schemas (Generated from docs)
Claude->>Truto: POST /tools/call (e.g., list_all_samsara_assets)
Truto->>Samsara: Execute API request with normalized auth
Samsara-->>Truto: JSON Response
Truto-->>Claude: JSON-RPC 2.0 ResultSecurity and Access Control
Exposing industrial control systems and fleet data to an LLM requires strict boundary setting. Truto's MCP architecture provides several zero-code controls to limit what Claude can access:
- Method Filtering: By passing
methods: ["read"]during server creation, you completely remove mutating operations (create, update, delete) from the tools list. Claude literally cannot hallucinate acreate_a_samsara_assetcommand because the tool ceases to exist for that session. - Tag Filtering: Group tools functionally. Passing
tags: ["safety"]limits the server to only expose endpoints related to safety events, driver scoring, and harsh braking, hiding sensitive payroll or HR tech endpoints. - Authentication Layering: Enabling the
require_api_token_authflag forces the client to pass a valid Truto API token in addition to the standard URL token. This prevents unauthorized execution if the MCP URL is accidentally leaked in a configuration file. - Ephemeral Servers: Set an
expires_attimestamp to create temporary MCP servers. Once the timestamp passes, the routing layer instantly rejects all requests, ensuring transient agents do not leave behind zombie access vectors.
Hero Tools for Samsara Workflows
Truto automatically translates Samsara's endpoints into LLM-friendly tools. Here are the highest-leverage tools your agents will use to orchestrate industrial data.
list_all_samsara_assets_locations
This tool retrieves the last known location for all tracked assets (vehicles, trailers, and heavy equipment). It returns GPS coordinates, heading, and speed, which is critical for real-time dispatch and logistics routing.
"Claude, pull the current locations of all our assets. Cross-reference the coordinates to find any heavy equipment currently located outside of the designated 'Zone B' geofence."
list_all_samsara_safety_events
Retrieves safety events generated by AI dashcams and vehicle telemetry, including harsh braking, speeding, and distracted driving. Essential for generating driver coaching summaries.
"Fetch all safety events from the past 48 hours for our long-haul fleet. Summarize any incidents tagged with 'distracted driving' and list the associated driver IDs so we can schedule coaching sessions."
list_all_samsara_data_points_histories
Queries historical time-series data for specific IoT sensors. Use this tool to track ambient temperature in cold-chain trailers, humidity in storage silos, or engine diagnostics over a specific time window.
"Query the data points history for the temperature sensors on Trailer 402 over the last 12 hours. Identify any periods where the ambient temperature rose above 38 degrees Fahrenheit."
list_all_samsara_hos_logs
Retrieves Hours of Service (HOS) duty status logs for drivers. This is the cornerstone of ELD (Electronic Logging Device) compliance, ensuring drivers do not violate FMCSA rest requirements.
"Review the HOS logs for the West Coast driver group from yesterday. Flag any drivers who exceeded their 11-hour driving limit or failed to log their mandatory 30-minute break."
list_all_samsara_preventive_upcomings
Lists upcoming preventive maintenance schedules, enriched with live telemetry (current engine hours, current odometer). This allows AI agents to automatically triage and prioritize shop schedules before a breakdown occurs.
"Check the upcoming preventive maintenance schedules. Find any vehicles that are within 500 miles of needing an oil change based on their live odometer readings, and draft an email to the shop manager."
get_single_samsara_vision_run_by_id
Fetches the results of a specific machine vision inspection run from a Samsara industrial camera. Useful for quality assurance on manufacturing lines or facility security monitoring.
"Get the vision run data for camera CAM-092 from this morning. Did the inspection results flag any barcode read failures on the outbound conveyor belt?"
To view the complete schema definitions and the hundreds of other available operations, check out the Samsara integration page.
Workflows in Action
Connecting Claude to Samsara transforms the LLM from a passive text generator into an active logistics and safety orchestrator. Here is how specific operational personas can utilize this architecture.
1. Cold Chain Logistics Auditing
Temperature excursions during transit lead to spoiled goods and massive liability. A logistics coordinator can use Claude to autonomously audit cold chain compliance before signing off on a delivery.
"Review the temperature history for Trailer 88 during its transit from Chicago to Denver (from 08:00 AM yesterday to 02:00 PM today). Verify that the temperature never exceeded 36°F. If it did, note the exact timestamp and duration of the excursion."
Execution steps:
- Claude calls
list_all_samsara_assetsto resolve "Trailer 88" to its internal Samsara asset ID. - It then calls
list_all_samsara_data_points_histories, passing the asset ID, the converted UNIX timestamps for the requested window, and specifying the temperature sensor type. - The LLM analyzes the returned array of time-series readings, mapping the data points against the 36°F threshold.
- Result: Claude provides a definitive compliance report, pinpointing a 45-minute window where the temperature spiked to 41°F, allowing the coordinator to reject the shipment or file an insurance claim.
2. Autonomous Safety Coaching Triage
Fleet safety managers are buried in dashcam footage and telemetry alerts. They can instruct Claude to act as a preliminary safety analyst to prep for driver 1-on-1s.
"Analyze yesterday's safety events for all active drivers. Identify anyone with more than two harsh braking incidents or any distracted driving flags. Correlate those events with their HOS logs to see if the incidents happened near the end of a long shift."
Execution steps:
- Claude invokes
list_all_samsara_safety_eventsfiltered by the previous 24 hours. - The model filters the JSON response for
harsh_brakinganddistracted_drivingtags, isolating the offendingdriverIds. - Claude calls
list_all_samsara_hos_logsfor those specific drivers to pull their duty status durations. - Result: Claude outputs a triage list: "Driver John Doe had 3 harsh braking events. Cross-referencing HOS logs, these occurred during hour 10 of his driving shift, indicating high fatigue. Recommend immediate coaching on fatigue management."
3. Predictive Maintenance Scheduling
Shop managers can use Claude to bridge the gap between live vehicle telemetry and actual maintenance work orders.
"Check our preventive maintenance queue. Which heavy-duty trucks are projected to hit their engine-hour service limits this week based on their current usage? Generate a prioritized list for the garage."
Execution steps:
- Claude calls
list_all_samsara_preventive_upcomings. - The model inspects the
dueInEngineHoursandcurrentEngineHoursfields returned in the payload for each asset. - It compares these telemetry figures against the assigned schedule intervals to determine immediate risk.
- Result: The shop manager receives a clean, prioritized list of exactly which assets need to be pulled off the road, maximizing uptime and preventing catastrophic engine failures.
Wrapping Up
Integrating AI agents with Samsara fundamentally changes how you manage industrial assets. By routing Claude through a managed Truto MCP server, you eliminate the need to write custom pagination logic, handle messy API migrations, or build time-series data normalizers from scratch. Truto dynamically curates the toolset from the latest Samsara documentation, ensuring your AI agents have real-time, schema-accurate access to everything from location tracking to cold-chain sensors. This architecture allows your engineering team to focus on building advanced logistics logic, rather than maintaining point-to-point integration code.
FAQ
- How does the MCP server handle Samsara API rate limits?
- Truto passes upstream HTTP 429 rate limit errors directly to the caller and normalizes the rate limit data into standard IETF headers. The MCP client or orchestration layer is responsible for implementing retry and backoff logic.
- Can I restrict Claude to read-only access for Samsara?
- Yes. By configuring the MCP server with the `methods: ["read"]` filter during creation, Truto will completely remove mutating tools (like create, update, or delete) from the available tools list, ensuring Claude can only read data.
- How does Truto handle Samsara's time-series pagination?
- Truto automatically parses Samsara's documentation to generate tools that include `limit` and `next_cursor` properties. The MCP server provides specific instructions in the tool description, ensuring the LLM passes the cursor values back exactly as required for continuous data feeds.
- Does Truto support Samsara's Beta and V2 APIs?
- Yes. Truto's integration dynamically generates MCP tools based on the defined resources and documentation, giving LLMs seamless access to both legacy and newer V2 industrial endpoints without requiring you to maintain multiple API versions.