Motion MCP Server
# Motion MCP Server
A production-ready MCP (Model Context Protocol) Server that integrates with Motion (usemotion.com) task management platform. This server enables AI assistants to manage projects and tasks through Motion's API while maintaining local context in `.claude/motion/` directory using markdown files.
## Features
### π― **Core Functionality**
- **Full Motion API Integration**: Projects, tasks, workspaces, users, comments
- **Local Storage**: Markdown-based task files with YAML frontmatter
- **Bidirectional Sync**: Keep local and remote data in sync with conflict resolution
- **Rate Limited**: Respects Motion's API limits (12/min individual, 120/min team)
### π€ **AI-Powered Features**
- **Task Enrichment**: AI-enhanced descriptions and acceptance criteria
- **Goal Breakdown**: Convert high-level goals into actionable task lists
- **Workflow Planning**: Generate comprehensive project plans
- **Status Reports**: Automated progress summaries
### π **MCP Resources**
- **Project Overviews**: Real-time project status and metrics
- **Task Files**: Individual task details as markdown resources
- **Documentation**: Project docs accessible through MCP
- **AI Prompts**: Templates for task planning and reporting
## Installation
### Prerequisites
- Node.js 18+ and npm
- Motion account with API key
- Claude Desktop (for MCP integration)
### Setup
1. **Clone and Install**
```bash
git clone https://github.com/idxstudios/use-motion-mcp-server.git
cd use-motion-mcp-server
npm install
```
2. **Configure Environment**
```bash
# Copy example environment file
cp .env.example .env
# Edit .env with your Motion API key
MOTION_API_KEY=your_motion_api_key_here
MOTION_IS_TEAM_ACCOUNT=false # true for team accounts
```
3. **Build the Server**
```bash
# Generate OpenAPI routes first (required for first build)
make openapi
# Full build with OpenAPI generation + TypeScript compilation
make build
# OR for TypeScript compilation only (after OpenAPI generated)
npm run build
```
4. **Configure Claude Desktop**
Edit your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"motion": {
"command": "node",
"args": ["/absolute/path/to/motion-mcp-server/dist/server/index.js"],
"env": {
"MOTION_API_KEY": "your-motion-api-key"
}
}
}
}
```
## Architecture
The server follows a **Domain Controllers β App (Commands/Queries) β Services** pattern with Functional/Reactive Programming (FRP) principles:
```
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
βDomain ControllersβββββΆβ App Layer βββββΆβ Services β
β (MCP Handlers) β β Commands/Queriesβ β Motion/Storage β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
```
### ποΈ **Directory Structure**
```
src/
βββ api/mcp/v1-routes/ # Generated OpenAPI code
β βββ models/ # Generated TypeScript interfaces
β βββ routes/ # Generated controller interfaces
β βββ tools.ts # Generated MCP tool schemas
βββ api/mcp/v1-controllers/# Domain controller implementations
β βββ project-controller.ts
β βββ task-controller.ts
β βββ workflow-controller.ts
β βββ sync-controller.ts
β βββ context-controller.ts
β βββ docs-controller.ts
βββ app/ # Business logic layer
β βββ motion/ # Motion API commands & queries
β βββ projects/ # Project commands & queries
β βββ tasks/ # Task commands & queries
β βββ workflow/ # Workflow planning
β βββ sync/ # Synchronization logic
β βββ context/ # Context management
β βββ docs/ # Documentation generation
βββ services/ # External service integrations
β βββ motion-service.ts # Motion API client
β βββ storage/ # Local file management
β βββ ai/ # AI enhancements
βββ setup/ # Configuration and DI
β βββ dependencies.ts # Dependency injection
βββ server/index.ts # MCP server entry point
```
### π§ **OpenAPI-Based Code Generation**
Tools and interfaces are generated from YAML schemas:
- Define tools in `schemas/mcp/v1/mcp-tools.yaml`
- Custom Handlebars templates in `schemas/api-gen/server/`
- Generated code in `src/api/mcp/v1-routes/`
- Run `make openapi` to regenerate
## Available Tools
### π **Project Management**
- `motion.project.list` - List all projects with pagination
- `motion.project.create` - Create new projects
- `motion.project.bind` - Bind project to local storage
- `motion.project.sync` - Sync project with Motion
### β
**Task Operations**
- `motion.task.create` - Create tasks (with AI enrichment)
- `motion.task.list` - List and filter tasks
- `motion.task.search` - Search tasks in local storage
- `motion.task.update` - Update task properties
- `motion.task.complete` - Mark tasks as completed
### π€ **AI Features**
- `motion.task.enrich` - AI-enhance task descriptions
- `motion.task.batch_create` - Create multiple tasks from goals
- `motion.task.analyze` - Analyze task complexity
- `motion.workflow.plan` - Generate comprehensive plans
### π **Sync & Context**
- `motion.sync.all` - Sync all bound projects
- `motion.sync.check` - Check sync status
- `motion.context.save` - Save project context for AI
- `motion.context.load` - Load project context
### π **Documentation**
- `motion.docs.create` - Generate project documentation
- `motion.docs.update` - Update existing docs
- `motion.status.report` - Generate status reports
### π’ **Workspace Management**
- `motion.workspace.list` - List all available workspaces
- `motion.workspace.set_default` - Set default workspace for new projects
- `motion.workspace.get_settings` - Get workspace-specific settings
- `motion.workspace.update_settings` - Update workspace preferences
## Local Storage Structure
The server maintains local context in `.claude/motion/`:
```
.claude/motion/
βββ workspace-settings/
β βββ default.json # Default workspace configuration
β βββ [workspace-id].json # Workspace-specific settings
βββ [project-id]/
βββ meta.json # Project metadata
βββ tasks/
β βββ [task-id].md # Task files with YAML frontmatter
βββ docs/
βββ *.md # Project documentation
```
### Task File Format
```markdown
---
id: task_123
projectId: proj_456
status: In Progress
priority: HIGH
duration: 120
# ... other metadata
---
# Task Title
## Description
Detailed task description...
## Acceptance Criteria
- [ ] Criteria 1
- [ ] Criteria 2
```
### Workspace Settings Format
```json
{
"workspaceId": "workspace_123",
"defaultProjectId": "project_456",
"defaultPriority": "MEDIUM",
"defaultDuration": 60,
"aiProvider": "openai"
}
```
## Development
### π οΈ **Build Commands (Make)**
```bash
make help # Show all available commands
make install # Install dependencies
make build # Build the project
make test # Run tests
make lint # Run linter
make dev # Start development server
make check # Run all quality checks
make docker-build # Build Docker image
```
### π **Testing**
```bash
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test files
npm test -- --testPathPattern=tasks
```
### π **Monitoring**
The server includes comprehensive error handling and logging:
- Request/response logging
- Rate limit monitoring
- Sync conflict detection
- Validation error reporting
## Docker Deployment
### Build and Run
```bash
# Build image
make docker-build
# Run container
docker run -it --rm \
-v "${PWD}/.claude:/app/.claude" \
-e MOTION_API_KEY="your-api-key" \
motion-mcp-server
```
### Docker Compose
```yaml
version: '3.8'
services:
motion-mcp:
build: .
volumes:
- ./.claude:/app/.claude
environment:
- MOTION_API_KEY=${MOTION_API_KEY}
- MOTION_IS_TEAM_ACCOUNT=false
```
## Configuration
### Environment Variables
```bash
MOTION_API_KEY= # Required: Your Motion API key
MOTION_IS_TEAM_ACCOUNT= # Rate limit configuration
MOTION_BASE_URL= # Motion API base URL
REQUEST_TIMEOUT= # API request timeout (ms)
CLAUDE_DATA_DIR= # Local storage directory
LOG_LEVEL= # Logging verbosity
```
### Rate Limiting
The server automatically detects account type and applies appropriate limits:
- **Individual accounts**: 12 requests/minute
- **Team accounts**: 120 requests/minute
## Troubleshooting
### Common Issues
#### β **"Motion API key not found"**
```bash
# Check environment variables
echo $MOTION_API_KEY
# Verify .env file
cat .env
```
#### β **"Project not bound locally"**
```bash
# First bind the project
# Use motion.project.bind tool in Claude
```
#### β **Rate limit exceeded**
```bash
# Check if team account flag is correct
MOTION_IS_TEAM_ACCOUNT=true # For team accounts
```
### Debug Mode
```bash
# Enable debug logging
export LOG_LEVEL=debug
npm start
```
## API Reference
The server implements all major Motion API endpoints:
- [Projects API](https://docs.usemotion.com/api-reference/projects/)
- [Tasks API](https://docs.usemotion.com/api-reference/tasks/)
- [Workspaces API](https://docs.usemotion.com/api-reference/workspaces/)
- [Users API](https://docs.usemotion.com/api-reference/users/)
- [Comments API](https://docs.usemotion.com/api-reference/comments/)
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run quality checks: `make check`
6. Submit a pull request
### Code Style
- TypeScript with strict mode
- Functional/Reactive Programming patterns
- Immutable data structures
- Pure functions without side effects
## License
MIT License - see LICENSE file for details.
## Support
- π [Motion API Documentation](https://docs.usemotion.com/)
- π§ [MCP Specification](https://spec.modelcontextprotocol.io/)
- π [Report Issues](https://github.com/idxstudios/use-motion-mcp-server/issues)
---
**Built with β€οΈ for the Claude ecosystem**TDQS
Scored across 25 tools
Most tools map cleanly to a resource+action combination, but a few boundaries blur: motion.task.list vs motion.task.search (all tasks vs local storage), and the three sync-related tools (motion.project.sync, motion.sync.all, motion.sync.check) could be confused. The AI-oriented trio (motion.task.enrich, motion.task.analyze, motion.workflow.plan) also has soft boundaries, though descriptions clarify intent.
Every tool follows the motion.<domain>.<action> pattern, with global ops (motion.sync.all, motion.status.report) fitting the same convention. Action verbs are consistently snake_case and descriptive, so the pattern generalizes predictably across tasks, projects, docs, context, and workspaces.
25 tools is on the heavy edge for what is essentially a task/project manager. The workspace, sync, and docs clusters each add a handful of low-frequency administrative operations, so the surface feels somewhat sprawling rather than tightly scoped.
Tasks have decent lifecycle support (create, batch_create, list, search, update, complete, move) but no delete or get-by-id. Projects lack update/archive/delete entirely, and docs have create/update but no list or delete. These are notable gaps that will force agents to work around missing lifecycle operations.