mcp-samsara
Automation Squad - MCP for Samsara
Complete Samsara Fleet Management integration for Claude AI
21 tools | Expert knowledge built-in | Beta
๐ FREE WHILE IN BETA - Lock in your lifetime discount!
โ ๏ธ 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.
Related MCP server: fleetsync-mcp
๐ฏ 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
@automation-squad/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! ๐
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to control and monitor Tesla vehicles via natural language through the Tessie API, supporting battery, climate, security, charging, and more.611MIT
- FlicenseAqualityDmaintenanceEnables AI agents to query orders, manage routes, track drivers, and analyze delivery performance on the FleetSync last-mile delivery platform through natural language.18
- FlicenseAqualityCmaintenanceExposes a connected-vehicle OBD-II/telematics platform to AI agents, enabling vehicle health scoring, live data queries, DTC decoding, maintenance prediction, and gated remote commands via a pluggable data layer.9
- Flicense-qualityCmaintenanceExposes live Samsara fleet data via MCP tools for searching assets and retrieving GPS locations.
Related MCP Connectors
Read and update your Everway trips and itineraries from any MCP-compatible AI assistant.
Agentic scheduling & booking for field service: availability, jobs, customers, crews, fleet.
Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AutomationSquadOS/mcp-samsara'
If you have feedback or need assistance with the MCP directory API, please join our Discord server