mcp-sling

mcp-sling

Enables interaction with the Sling scheduling and workforce management platform, allowing users to manage shifts, users, calendars, and reports through natural language.

Category
访问服务器

README

MCP Sling Server

Model Context Protocol (MCP) server for the Sling API - a comprehensive scheduling and workforce management platform.

Quick Start: New to this? See QUICK_START.md for a 5-minute setup guide!

Features

This MCP server provides tools to interact with all major Sling API endpoints:

Calendar & Scheduling

  • get_calendar - Retrieve calendar and shift data for users
  • create_shift - Create new shifts for employees
  • get_timesheets - View timesheet data and actual hours worked
  • update_timesheet - Modify timesheet entries

User Management

  • get_users - List all users in your organization
  • create_user - Add new users
  • update_user - Modify user information

Organization Management

  • get_organization - View organization details
  • get_organization_by_id - Get specific organization info
  • switch_organization - Switch between organizations
  • get_groups - List organizational groups

Reporting & Analytics

  • get_reports - Access various reports (labor, schedule, attendance)
  • create_sales_record - Record sales data for analytics
  • get_tags - Retrieve available tags for categorization

Settings

  • update_settings - Modify organization or user settings

Advanced

  • sling_api_call - Make custom API calls to any Sling endpoint

Installation

  1. Clone this repository:
git clone <repository-url>
cd mcp-sling
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Get your Sling authorization token:

IMPORTANT: Due to CAPTCHA requirements on the Sling login endpoint, you need to obtain your authorization token from your browser.

Follow the detailed guide: TOKEN_GUIDE.md

  1. Create a .env file with your token:
cp .env.example .env

Edit .env and add your token:

SLING_TOKEN=your-token-from-browser
SLING_SERVER=api

Configuration

Environment Variables

Recommended approach (avoids CAPTCHA):

  • SLING_TOKEN (required) - Your Sling authorization token from browser
  • SLING_SERVER (optional) - API server to use (default: "api", use "test-api" for staging)

Alternative (requires CAPTCHA - not recommended):

  • SLING_EMAIL - Your Sling account email
  • SLING_PASSWORD - Your Sling account password
  • Note: Currently not working due to CAPTCHA requirement on /account/login endpoint

Claude Desktop Configuration

Add this to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

Recommended: Using token

{
  "mcpServers": {
    "sling": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-sling/dist/index.js"],
      "env": {
        "SLING_TOKEN": "your-token-from-browser"
      }
    }
  }
}

Alternative: Using .env file

{
  "mcpServers": {
    "sling": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-sling/dist/index.js"]
    }
  }
}

(Requires .env file with SLING_TOKEN configured)

Usage Examples

Once configured, you can use the Sling tools through Claude. Here are some example queries:

Get All Users

Can you get the list of all users in my Sling organization?

View Calendar

Show me the calendar for user ID 12345 in organization 67890 for dates 2024-01-15

Create a Shift

Create a shift for user 12345 starting at 2024-01-20T09:00:00Z and ending at 2024-01-20T17:00:00Z for the "Cashier" position

Get Reports

Get the labor report for the period from 2024-01-01 to 2024-01-31

Custom API Call

Make a GET request to /custom/endpoint with params {"filter": "active"}

Authentication

This server handles authentication automatically using your configured credentials. The authentication flow:

  1. On first request, the server logs in to Sling using your email/password
  2. The authentication token is cached and reused for subsequent requests
  3. If a token expires (401 error), the server automatically refreshes it
  4. Tokens are typically valid for 1 hour

Note: The Sling API uses email/password authentication as documented in their official examples.

About CAPTCHA

Important Update: As of November 2024, Sling has added CAPTCHA protection to the /account/login API endpoint. This means direct email/password authentication no longer works without solving a CAPTCHA challenge.

Solution: Use a pre-obtained authorization token from your browser instead. See TOKEN_GUIDE.md for detailed instructions.

Why this approach works:

  • Tokens obtained from browser sessions don't require CAPTCHA
  • Tokens typically remain valid for weeks or months
  • You only need to get a new token when it expires or you change your password
  • This is the recommended approach until Sling provides an alternative API authentication method

API Documentation

For detailed information about the Sling API endpoints and data formats, refer to:

Development

Build

npm run build

Watch Mode

npm run watch

Run Development Server

npm run dev

Test Authentication

To verify your credentials work before using with Claude:

node test-auth.js

This will attempt to authenticate and show detailed debug information.

Permissions

Your API access level matches your Sling user permissions:

  • Admin tokens - Full access to all organization data
  • Employee tokens - Limited to that user's information only

Troubleshooting

"No authorization token received from Sling API"

The server now includes detailed debug logging. Check your MCP server logs (Claude Desktop Developer Console) for:

  • Response status code
  • Response headers
  • Response body

This will help identify where the token should be.

Quick fixes:

  1. Verify credentials in .env are correct (no extra quotes/spaces)
  2. Test login with curl:
    curl -i -X POST https://api.getsling.com/account/login \
      -H "Content-Type: application/json" \
      -d '{"email":"your@email.com","password":"password"}'
    
  3. Look for authorization: header in the response

For detailed troubleshooting steps, see TROUBLESHOOTING.md

Authentication Issues

  • Verify your email and password are correct in .env
  • Check that you can log in to Sling web app with these credentials
  • Ensure you're using the correct server (api vs test-api)
  • Make sure you're not using OAuth provider credentials (Google/Facebook)

API Errors

  • Check the error message for specific details
  • Verify your user has permission to access the requested resource
  • Ensure date formats are in ISO 8601 format (e.g., "2024-01-20T09:00:00Z")

Connection Issues

  • Verify you have internet connectivity
  • Check if api.getsling.com is accessible
  • Try using SLING_SERVER=test-api for the staging environment

Debugging

The server logs detailed authentication information to stderr:

  • All response headers from Sling API
  • Response body content
  • Token extraction attempts

View these logs in:

  • Claude Desktop: Help → Developer Tools → Console
  • Terminal: stderr output from the MCP server process

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues with:

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选