Skip to main content
Glama
README.md
# 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

C2.3/5.0

Scored across 25 tools

Disambiguation4/5

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.

Naming Consistency5/5

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.

Tool Count3/5

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.

Completeness3/5

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.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues