Purpose
mcp-samsara is an unofficial third-party MCP (Model Context Protocol) server used to connect MCP-compatible clients such as Claude AI to the Samsara fleet management API. It is aimed at users who need to manage fleet operations with the help of an AI assistant, providing capabilities for operations such as vehicles, routes, drivers, addresses, Webhooks, and contacts.
Main Capabilities
This integration provides a total of 21 tools, divided into the following categories:
- Vehicle management (4 tools): list vehicles, get vehicle details, real-time location, statistics.
- Route management (6 tools): create, update, delete routes; automatically preserve stop status (critical for time tracking); route optimization (minimize distance/time); list and get route details.
- Driver management (4 tools): list drivers, get driver details, hours of service (HOS) compliance tracking, safety event monitoring.
- Addresses and locations (2 tools): create and manage saved addresses, geofence integration.
- Webhook integration (3 tools): real-time event notifications, route updates, vehicle events, etc.
- Contact management (2 tools): create and manage contacts for route stops.
In addition, expert knowledge is built into each tool description, with automatic state preservation (stop IDs, route data), intelligent rate limiting (avoid triggering API limits), route optimization (built-in efficiency algorithms), and production best practices (error handling, retries).
Usage
Prerequisites: Node.js 18+, Samsara API Token, Claude Desktop or any MCP-compatible client.
Note: The npm package @automationsquad/mcp-samsara has not yet been published, so the only currently available installation path is to clone the repository and build it. Once it is published, a one-line npx command will be available to replace the above steps.
Configuration method: Add the server to the Claude Desktop configuration file. The macOS path is ~/Library/Application Support/Claude/claude_desktop_config.json, and the Windows path is %APPDATA%\Claude\claude_desktop_config.json. You need to replace /absolute/path/to/mcp-samsara with the actual location of the cloned repository. The path must be an absolute path; Claude Desktop does not resolve ~ or relative paths. EU customers should use https://api.eu.samsara.com as SAMSARA_BASE_URL. After configuring, quit and reopen Claude Desktop to see the Samsara tools.
Tool naming convention: all tools are prefixed with samsara_, for example samsara_list_vehicles, samsara_create_route, samsara_get_driver_hos.
TMS integration: you can use externalIds in routes/vehicles/drivers to associate with a TMS, then query by external ID.
Use cases
- Create and optimize delivery routes through an AI assistant, automatically preserving stop IDs to track arrival/departure times.
- Track vehicle locations in real time, and monitor driver hours-of-service compliance and safety events.
- Manage saved addresses and geofences, and configure Webhooks to receive real-time event notifications.
- Integrate with TMS systems through externalIds.
Limitations
- This is an unofficial integration, not affiliated with, endorsed by, or sponsored by Samsara Inc., and is not an official Samsara product.
- It uses Samsara's public API and the user's own API credentials, and is subject to the Samsara API Terms of Service.
- The npm package is currently unpublished; you can only clone and build it to install.
- The rate limit is a conservative 5 requests per second, with automatic throttling and retry logic; 429s are retried automatically.
- API tokens are stored locally, no data is collected, and there is no call home.
- The project is in Beta.
Architecture and error handling
It uses a conservative 5 requests per second, with automatic throttling and retry logic; 429s (rate limits) are retried automatically; it provides clear error messages and graceful degradation. State preservation is a key feature: when updating a route, it automatically fetches the existing route, extracts stop IDs, preserves them in the update, prevents data loss, and avoids losing arrival/departure times.
Troubleshooting
- If you see "Error: SAMSARA_API_TOKEN environment variable is required": set the API token in the Claude configuration file.
- If you see "Samsara API error (401): Unauthorized": the API token is invalid or expired; generate a new token in the Samsara dashboard.
- If you see "Samsara API error (429): Too Many Requests": the MCP will retry automatically; if it occurs frequently, other integrations may be accessing the API.
- Tools do not appear in Claude: check the configuration file syntax (valid JSON), fully restart Claude (quit and reopen), and check the Claude logs for errors.
Security and privacy
Credentials remain local, and API tokens are stored on the user's machine; no data is collected; it is open source, so you can review the code yourself; there is no call home, and the MCP runs entirely locally.
Future plans
Add more tools (dispatch, assets, tags), support batch operations, enhance optimization algorithms, multi-route optimization, fuel cost calculation, and compliance reporting tools.
License: MIT.