lineworks-mcp-server
v1.3.0
Published
MCP server for Line Works API (Calendar, Directory, User) with OAuth 2.0 authentication
Maintainers
Readme
Line Works MCP Server
A Model Context Protocol (MCP) server implementation for Line Works APIs (Calendar, Directory, User) with OAuth 2.0 authentication. This server allows you to interact with Line Works through natural language using MCP-compatible tools like Claude Desktop or Cursor.
Quick Start: See QUICKSTART.md for a 5-minute setup guide.
Features
- OAuth 2.0 Authentication: Secure authentication flow with token management
- Automatic Token Refresh: Handles token expiration and refresh automatically
- Calendar API: Full calendar and event management
- Directory API: Access user information and organization structure
- User API: Get user details by email or ID
- Natural Language Interface: Use with Claude Desktop or Cursor for conversational API access
Prerequisites
- Line Works Developer Account and App Registration
- Node.js 18+ installed
- MCP-compatible client (Claude Desktop, Cursor, etc.)
Quick Start
1. Clone and Setup
# Clone the repository
git clone <repository-url>
cd lineworks-mcp-server
# Make sure you're in the project root directory
# You should see package.json, tsconfig.json, etc.
pwd # Should show: /path/to/lineworks-mcp-server
# If setup.sh is in root directory, move it to scripts/
[ -f setup.sh ] && mv setup.sh scripts/
# Option 1: Use the automated setup script
npm run setup
# Option 2: Manual setup
npm install
cp .env.example .env
npm run build
# Validate your setup (optional but recommended)
npm run validate2. Create Line Works App
- Go to Line Works Developers Console
- Create a new app or use existing one
- Add OAuth 2.0 settings:
- Redirect URI:
http://localhost:3000/callback(⚠️ Must match EXACTLY) - Scopes: Select
calendar,user, anddirectoryscopes
- Redirect URI:
- Note down your Client ID and Client Secret
Important: Redirect URI Setup
- For local testing, use exactly:
http://localhost:3000/callback - No trailing slashes
- Use
httpnothttpsfor localhost - If port 3000 is busy, you can change it:
- Update redirect URI in Line Works console to new port
- Set
OAUTH_SERVER_PORT=8080in your.envfile - Update
LINEWORKS_REDIRECT_URIto match
3. Configure Environment Variables
Create a .env file in the project root:
LINEWORKS_CLIENT_ID=your-client-id
LINEWORKS_CLIENT_SECRET=your-client-secret
LINEWORKS_REDIRECT_URI=http://localhost:3000/callback4. Build the Server
npm run build5. Configure MCP Client
For Claude Desktop
Add to your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"lineworks-api": {
"command": "node",
"args": ["/path/to/lineworks-mcp-server/build/index.js"],
"env": {
"LINEWORKS_CLIENT_ID": "your-client-id",
"LINEWORKS_CLIENT_SECRET": "your-client-secret"
}
}
}
}For Cursor
Add to your Cursor settings:
{
"mcp.servers": {
"lineworks-api": {
"command": "node",
"args": ["/path/to/lineworks-mcp-server/build/index.js"],
"env": {
"LINEWORKS_CLIENT_ID": "your-client-id",
"LINEWORKS_CLIENT_SECRET": "your-client-secret"
}
}
}
}Usage
First Time Authentication
- Start your MCP client (Claude Desktop or Cursor)
- Use the authenticate command:
"Please authenticate with Line Works" - A browser window will open for OAuth authentication
- Log in to Line Works and authorize the app
- The token will be saved locally for future use
Available Commands
All commands can be used through natural language. Here are some examples:
User/Directory Management
"Get user info for [email protected]"
"Show me all users in the organization"
"List organization units"
"Show members of the sales department"Calendar Management
"Show me all my calendars"
"Create a new calendar called 'Team Meetings' with color #FF5733"
"Update my 'Personal' calendar description"
"Delete the calendar with ID 'cal_123'"Event Management
"Show me all events in my main calendar for this week"
"Create a meeting tomorrow at 2 PM for 1 hour titled 'Project Review'"
"Update the event 'Team Standup' to start at 10 AM instead"
"Delete the event with ID 'evt_456'"
"RSVP yes to the meeting invitation"Note: When creating events, the data is automatically wrapped in the required eventComponents array format.
Free/Busy Check
"Check if [email protected] is free tomorrow from 2-3 PM"
"Find free time slots for [email protected] and [email protected] this week"API Tools Reference
The server implements the following tools:
Authentication
- authenticate - Initiate OAuth 2.0 authentication
Calendar APIs
- get_user_default_calendar - Get user's default calendar
- get_calendar_list - Get all calendars for a user
- get_calendar - Get specific calendar details
- create_calendar - Create a new calendar
- update_calendar - Update calendar information
- delete_calendar - Delete a calendar
- get_event_list - Get events from a calendar
- get_event - Get specific event details
- create_event - Create a new event
- update_event - Update event information
- delete_event - Delete an event
- respond_to_event - RSVP to an event invitation
- get_freebusy - Check free/busy times for users
Directory/User APIs
- get_user_by_email - Get user information by email address
- get_user_by_id - Get user information by user ID
- get_user_list - Get list of users in the organization
- get_organization_units - Get list of organization units
- get_org_unit_members - Get members of a specific organization unit
Project Structure
lineworks-mcp-server/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript (generated)
├── .env # Environment variables (create this)
├── .lineworks_token.json # OAuth token storage (auto-generated)
├── package.json
├── tsconfig.json
└── README.mdToken Management
- Tokens are stored in
.lineworks_token.jsonin the project root - The server automatically refreshes expired tokens
- Delete this file to force re-authentication
Troubleshooting
Setup Issues
If you encounter issues during setup:
Verify you're in the correct directory:
pwd # Should show: /path/to/lineworks-mcp-server ls # Should show: package.json, src/, README.md, etc.Run the validation script:
./validate-setup.shCommon issues:
- Wrong directory: Always run from project root
- Missing .env file: Copy from .env.example
- Port in use: Change OAUTH_SERVER_PORT in .env
- Build errors: Check Node.js version (18+ required)
Authentication Issues
- Ensure your redirect URI matches exactly:
http://localhost:3000/callback - Check that the calendar scope is enabled in your Line Works app
- Verify CLIENT_ID and CLIENT_SECRET are correct
API Errors
- Check the user ID format - it should be the Line Works user ID
- Ensure you have proper permissions for the requested operation
- Verify the calendar/event IDs are correct
MCP Connection Issues
- Ensure the server path in your MCP client config is absolute
- Check that Node.js is in your system PATH
- Review the MCP client logs for detailed error messages
Security Notes
- Never commit
.envor.lineworks_token.jsonfiles - Keep your CLIENT_SECRET secure
- Use HTTPS in production environments
- Consider implementing additional security measures for production use
Development
Available Scripts
# Setup and validation
npm run setup # Run initial setup
npm run validate # Validate your setup
npm run help # Show common commands
# Development
npm run dev # Run in development mode with auto-reload
npm start # Run production build
npm run build # Build TypeScript to JavaScript
# Testing
tsx examples/test-calendar-operations.ts # Run example test scriptProject Structure
- [ ] Add support for recurring events
- [ ] Implement calendar sharing and permissions
- [ ] Add support for event attachments
- [ ] Implement webhook support for real-time updates
- [ ] Add multi-tenant support for hosted deployment
Contributing
Contributions are welcome! Please submit pull requests with:
- Clear description of changes
- Updated documentation
- Test coverage for new features
License
MIT License - see LICENSE file for details
