mcp-samsara
This server connects Claude AI to the Samsara Fleet Management API, enabling fleet management tasks like route planning/tracking, vehicle monitoring, driver compliance, webhooks, and contacts.
Vehicle management: list vehicles, get vehicle details, real-time locations, and vehicle statistics.
Route management: create, update, delete, retrieve, and optimize routes; stop IDs are preserved automatically to maintain tracking data.
Driver management: list/get drivers, Hours of Service (HOS) logs, and safety events.
Address & location management: create and list saved addresses for route reuse and geofencing.
Webhook integration: create, list, and delete webhooks for real-time Samsara event notifications.
Contact management: create and list contacts for route stops.
Built-in reliability: rate limiting, retries, error handling, and TMS integration via externalIds.
Automation Squad - MCP for Samsara
Complete Samsara Fleet Management integration for Claude AI
21 tools | Expert knowledge built-in | Beta
⚠️ Important Disclaimer
UNOFFICIAL INTEGRATION: This is an unofficial third-party MCP server. It is:
❌ NOT affiliated with, endorsed by, or sponsored by Samsara Inc.
❌ NOT an official Samsara product
✅ Built using Samsara's public API with your own API credentials
✅ Fully compliant with Samsara's API terms of service
Samsara® is a registered trademark of Samsara Inc.
See NOTICE for the full third-party disclaimer. Licence: MIT.
Related MCP server: Samsara Fleet MCP Server
🎯 What This Does
Connects Claude AI to the Samsara Fleet Management API with:
✅ 21 tools across vehicles, routes, drivers, addresses, webhooks and contacts
✅ Expert knowledge built into every tool description
✅ Automatic state preservation (stop IDs, route data)
✅ Smart rate limiting (won't hit API limits)
✅ Route optimization (built-in efficiency algorithms)
✅ Production best practices (error handling, retries)
Tools Included
Vehicle Management (4 tools)
List vehicles, get vehicle details, real-time locations, statistics
Route Management (6 tools) ⭐ Our specialty
Create, update, delete routes
Auto-preserve stop state (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
Address & Location (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
🚀 Quick Start
Prerequisites
Node.js 18+ installed
Samsara API Token (Get one here)
Claude Desktop or any MCP-compatible client
Installation
git clone https://github.com/AutomationSquadOS/mcp-samsara
cd mcp-samsara
npm install
npm run buildNote: the npm package
@automationsquad/mcp-samsarais not published yet, so clone-and-build is the only install path that works today. When it ships, annpxone-liner will replace the steps above.
Configuration
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"samsara": {
"command": "node",
"args": ["/absolute/path/to/mcp-samsara/build/index.js"],
"env": {
"SAMSARA_API_TOKEN": "your-api-token-here",
"SAMSARA_BASE_URL": "https://api.samsara.com"
}
}
}
}Replace /absolute/path/to/mcp-samsara with wherever you cloned the repo. The path must
be absolute — Claude Desktop does not resolve ~ or relative paths.
EU customers: Use https://api.eu.samsara.com for SAMSARA_BASE_URL
Restart Claude
Quit and reopen Claude Desktop. You should see the Samsara tools available!
💡 Example Usage
Create a route with optimization
Create a delivery route called "Morning Zone 1" with these stops:
1. Warehouse: 123 Main St, Springfield
2. Customer A: 456 Oak Ave, Springfield
3. Customer B: 789 Pine Rd, Springfield
4. Return to warehouse
Then optimize it for minimum distance.Claude will:
Create the route with proper addresses
Automatically optimize stop order
Preserve all stop IDs for tracking
Assign vehicle/driver if requested
Track vehicle locations
Show me real-time locations for all vehicles currently on routesMonitor driver compliance
Get HOS logs for driver John Smith for the past week and check for any violations🔥 What Makes This Better
vs. Building Direct API Integration
Feature | Direct API | This MCP |
Setup time | Days | Minutes |
Stop state preservation | Manual | Automatic |
Rate limiting | DIY | Built-in |
Error handling | Custom | Production-tested |
Route optimization | Build yourself | Included |
Best practices | Research needed | Built-in |
vs. Official MCP (if one existed)
Feature | Hypothetical Official | Automation Squad |
Tool count | ~8-12 basic | 21 |
API coverage | ~10% | Fleet, routes, drivers, HOS, webhooks |
Expert knowledge | ❌ | ✅ Built-in |
Route optimization | ❌ | ✅ Included |
State preservation | Manual | Automatic |
Updates | Sporadic | Continuous |
🛠️ Architecture
Rate Limiting
Conservative 5 requests/second with automatic throttling and retry logic.
Error Handling
Automatic retry on 429 (rate limit)
Clear error messages
Graceful degradation
State Preservation
Critical feature: When updating routes, we automatically:
Fetch existing route
Extract stop IDs
Preserve them in updates
Prevent data loss
This is a best practice that prevents losing arrival/departure times.
📚 Documentation
Environment Variables
Variable | Required | Default | Description |
| ✅ Yes | - | Your Samsara API token |
| No |
| API base URL (use EU endpoint if needed) |
Tool Naming Convention
All tools are prefixed with samsara_ for clarity:
samsara_list_vehiclessamsara_create_routesamsara_get_driver_hosetc.
🤝 TMS Integration
Use externalIds in routes/vehicles/drivers to link with your TMS:
{
"externalIds": {
"tmsOrderId": "ORD-12345",
"customerId": "CUST-789"
}
}Then query by external ID:
Find the route linked to TMS order ORD-12345🐛 Troubleshooting
"Error: SAMSARA_API_TOKEN environment variable is required"
Set your API token in the Claude config file (see Configuration above).
"Samsara API error (401): Unauthorized"
Your API token is invalid or expired. Generate a new one in Samsara dashboard.
"Samsara API error (429): Too Many Requests"
The MCP will automatically retry. If you see this often, you may have other integrations hitting the API.
Tools not showing in Claude
Check config file syntax (valid JSON)
Restart Claude completely (quit and reopen)
Check Claude logs for errors
📦 What's Included
mcp-samsara/
├── src/
│ └── index.ts # Main MCP server
├── build/ # Compiled JavaScript
├── package.json # NPM package config
├── tsconfig.json # TypeScript config
├── README.md # This file
└── LICENSE # MIT License🔐 Security
Your credentials stay local - API token is stored on your machine
No data collection - We don't see your Samsara data
Open source - Review the code yourself
No phone-home - MCP runs entirely locally
📈 Roadmap
Add more tools (dispatch, assets, tags)
Support for batch operations
Enhanced optimization algorithms
Multi-route optimization
Fuel cost calculations
Compliance reporting tools
🎓 Learn More
💬 Support
Beta Users:
Join the Automation Squad community
Email: rob@matrix.digital
GitHub Issues: Report a bug
📝 License
MIT License - See LICENSE file for details
🙏 Credits
Built with ❤️ by Automation Squad
Not affiliated with Samsara Inc. This is an independent integration using Samsara's public API.
⭐ More from Automation Squad
Docs, install steps and what this server does not do: automationsquad.com/mcp/samsara
The AI Five — five things worth knowing about AI and automation, weekly. Subscribe free →
Ready to automate your fleet management? Let's go! 🚀
Available Tools
21 toolssamsara_create_addressC
Create a saved address/location in Samsara for reuse in routes
Inputs: name (required), latitude, longitude, externalIds, +1 more.
samsara_create_contactC
Create a contact (person at a stop location) for route management
Inputs: firstName (required), email, phone, lastName, +1 more.
samsara_create_routeA
Create a new route with stops. IMPORTANT: Each stop needs address (with lat/long or formatted address), optional arrival/departure times, and names. Use externalIds to link with your TMS.
Inputs: name (required), stops (required), driverId, startTime, +2 more.
samsara_create_webhookB
Create a webhook to receive real-time notifications from Samsara (route updates, vehicle events, etc.)
Inputs: url (required), eventTypes (required), secret.
samsara_delete_routeC
Delete a route permanently
Inputs: routeId (required).
samsara_delete_webhookC
Delete a webhook subscription
Inputs: webhookId (required).
samsara_get_driverC
Get detailed information about a specific driver
Inputs: driverId (required).
samsara_get_driver_hosC
Get Hours of Service (HOS) logs for a driver. Essential for compliance tracking.
Inputs: endTime (required), driverId (required), startTime (required).
samsara_get_driver_safety_eventsC
Get safety events (harsh braking, acceleration, speeding, etc.) for a driver
Inputs: endTime (required), driverId (required), startTime (required).
samsara_get_routeA
Get detailed information about a specific route including all stops, assigned vehicle/driver, and status
Inputs: routeId (required).
samsara_get_vehicleB
Get detailed information about a specific vehicle by ID
Inputs: vehicleId (required).
samsara_get_vehicle_locationsA
Get real-time or recent locations for vehicles. Uses the feed API pattern for efficient streaming of location data.
Inputs: after, vehicleIds.
samsara_get_vehicle_statsB
Get vehicle statistics including odometer, engine hours, and fuel usage over a time range
Inputs: endTime (required), startTime (required), vehicleIds (required).
samsara_list_addressesB
List all saved addresses
Inputs: after, limit.
samsara_list_contactsD
List all contacts
Inputs: limit.
samsara_list_driversC
List all drivers in the organization with their details and external IDs
Inputs: after, limit.
samsara_list_routesA
List all routes. Routes contain ordered stops with addresses, times, and status tracking.
Inputs: after, limit.
samsara_list_vehiclesA
List all vehicles in the fleet. Returns vehicle details including ID, name, VIN, make, model, and external IDs for TMS integration.
Inputs: after, limit.
samsara_list_webhooksB
List all configured webhooks
Inputs: no named parameters.
samsara_optimize_routeB
Optimize route stop order to minimize distance/time. This is a value-add feature that reorders stops for efficiency while preserving all stop data and IDs.
Inputs: routeId (required), optimizationGoal.
samsara_update_routeA
Update a route. CRITICAL BEST PRACTICE: This tool automatically preserves stop IDs to maintain arrival/departure time tracking. You can update name, vehicle, driver, status, or modify stops. When updating stops, the tool fetches existing stop IDs and preserves them.
Inputs: routeId (required), name, stops, status, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools have distinct purposes (vehicles, routes, drivers, addresses, webhooks, contacts). However, samsara_list_vehicles and samsara_get_vehicle could be confused by an agent as simply different granularities of the same resource, which is acceptable. No major overlapping ambiguity.
All tools follow a consistent samsara_{verb}_{noun} pattern with clear CRUD verbs (list, get, create, update, delete) and one value-add verb (optimize). The naming is predictable and uniform, making it easy for an agent to infer tool purpose.
21 tools covers a fleet management domain (vehicles, routes, drivers, HOS, safety, addresses, webhooks, contacts) reasonably well. It is on the higher side but each tool serves a clear function. Slightly over 15 but not excessive for the scope.
The toolset provides good CRUD coverage for routes, addresses, webhooks, and contacts, plus read-only access for vehicles and drivers with HOS and safety. Missing update/delete for drivers and vehicles, and no update for addresses/contacts, but the core fleet workflows (routing, driver monitoring) are well-covered.
Maintenance
Related MCP Connectors
Tesla Fleet API for AI: send navigation destinations, read battery and location, run car commands.
AI for your car: check charge, start climate, lock/unlock, open trunk via Tesla Fleet API. OAuth.
Read-only access to your Drivara fleet — jobs, drivers, vehicles, fuel, profit & analytics.
Plan last-mile deliveries from your AI assistant. Turns orders from spreadsheets, URLs, or pasted text into optimized delivery routes. It geocodes addresses, flags locations that need confirmation, and assigns stops across your fleet while respecting vehicle capacity, delivery time windows, and stop limits. Manage vehicles and depots, review route maps, and plan anything from a small delivery run to thousands of stops. Connect with your Vepathos account using OAuth.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables AI agents to query orders, manage routes, track drivers, and analyze delivery performance on the FleetSync last-mile delivery platform through natural language.18-
- FlicenseNot gradedqualityCmaintenanceExposes live Samsara fleet data via MCP tools for searching assets and retrieving GPS locations.-
- AlicenseNot gradedqualityDmaintenanceIntegrates with Tesla Fleet API and TeslaMate API to control vehicles, monitor energy (Powerwall/Solar), manage charging, and analyze driving data, with generative UI and skill workflows.5MIT
- AlicenseNot gradedqualityBmaintenanceProvides real-time freight tracking and load visibility for logistics and AI agents: create loads, get live GPS positions, trip stats, and confirm deliveries via geofenced statuses.1MIT