MCP server for Teamleader Focus CRM API — 112 tools covering contacts, companies, deals, tickets, invoices, subscriptions, meetings, projects, time tracking, files, notes, and smart cache-first task resolution.
Package Exports
@tailormade/teamleader-focus-mcp
@tailormade/teamleader-focus-mcp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tailormade/teamleader-focus-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Teamleader Focus MCP
A Model Context Protocol (MCP) server that wraps the Teamleader Focus CRM API. Gives AI assistants (Claude Code, Claude Desktop, Cursor, etc.) the ability to manage contacts, companies, deals, tasks, events, invoices, time tracking, and projects — including a smart task resolution workflow for automated time logging.
Inspired by globodai-group/mcp-teamleader. Rewritten and extended with full API coverage, time tracking, projects v2, and smart cache-first task resolution.
Features
Contacts — List, get, create, update
Companies — List, get, create
Deals — List, get, create, update
Tasks — List, create (legacy task API)
Events — List, get, create calendar events
Invoices — List, get, create draft invoices
Time Tracking — List, add, update, delete, start/stop timers
Projects v2 — List, get, create, update projects, groups (phases), and tasks
Smart Resolution — Cache-first Company > Project > Group > Task navigation
OAuth2 — Automatic token refresh with rotation support
OAuth2 Refresh Token (auto-rotated, persisted to ~/.teamleader-tokens.json). If omitted, only teamleader_login is available — use it to obtain tokens via browser.
Full task tree written by teamleader_load_tasks (contains all IDs)
~/.teamleader-tokens.json
Persisted OAuth2 tokens (auto-managed)
Available Tools
Contacts
Tool
Description
teamleader_list_contacts
List contacts with optional filtering by term, tags, or updated_since
teamleader_get_contact
Get full details of a specific contact by ID
teamleader_create_contact
Create a new contact (first name, last name, email, phone, tags, language)
teamleader_update_contact
Update an existing contact
teamleader_delete_contact
Delete a contact
teamleader_link_contact_to_company
Link a contact to a company (with optional position/decision_maker)
teamleader_unlink_contact_from_company
Unlink a contact from a company
teamleader_update_contact_company_link
Update position or decision_maker on an existing link
teamleader_tag_contact
Add tags to a contact
teamleader_untag_contact
Remove tags from a contact
Companies
Tool
Description
teamleader_list_companies
List companies with filtering by term, tags, or VAT number
teamleader_get_company
Get full details of a specific company by ID
teamleader_create_company
Create a new company (name, email, phone, VAT, website, tags)
teamleader_update_company
Update an existing company
Deals
Tool
Description
teamleader_list_deals
List deals with filtering by term, phase, or responsible user
teamleader_get_deal
Get full details of a specific deal by ID
teamleader_create_deal
Create a new deal (title, customer, phase, value, probability)
teamleader_update_deal
Update an existing deal (title, value, dates, responsible user)
teamleader_delete_deal
Delete a deal
teamleader_lose_deal
Mark a deal as lost (optional reason_id + extra_info)
teamleader_win_deal
Mark a deal as won
teamleader_move_deal
Move a deal to a different phase
teamleader_list_lost_reasons
List available lost reasons (for deals.lose)
teamleader_list_deal_phases
List deal phases (for deals.move/create)
teamleader_list_deal_sources
List deal sources (for deals.create)
teamleader_list_deal_pipelines
List deal pipelines
Tasks (standalone)
Tool
Description
teamleader_list_tasks
List tasks with optional filtering and pagination
teamleader_create_task
Create a new task
teamleader_get_task
Get full details of a specific task by ID
teamleader_update_task
Update task title, description, due date, or assignee
teamleader_delete_task
Delete a task
teamleader_complete_task
Mark a task as completed
teamleader_reopen_task
Reopen a completed task
teamleader_schedule_task
Schedule a task as a calendar event
Events
Tool
Description
teamleader_list_events
List calendar events with optional date range filter
teamleader_get_event
Get full details of a specific event by ID
teamleader_create_event
Create a new calendar event (title, activity type, start/end, attendees)
Meetings
Tool
Description
teamleader_list_meetings
List meetings with filter by employee, date range, or term
teamleader_get_meeting
Get full details of a specific meeting
teamleader_schedule_meeting
Schedule a new meeting with attendees and optional customer/deal
teamleader_update_meeting
Update meeting details
teamleader_complete_meeting
Mark a meeting as done
teamleader_delete_meeting
Delete a meeting
teamleader_create_meeting_report
Create a report attached to a contact, company, or deal
Invoices
Tool
Description
teamleader_list_invoices
List invoices with filtering by status, date range, or department
teamleader_get_invoice
Get full details of a specific invoice by ID
teamleader_create_invoice
Create a new draft invoice with line items
teamleader_book_invoice
Book a draft invoice (→ outstanding)
teamleader_send_invoice
Send invoice via email
teamleader_send_invoice_peppol
Send invoice via Peppol e-invoicing
teamleader_delete_invoice
Delete a draft invoice
teamleader_update_invoice
Update a draft invoice
teamleader_update_booked_invoice
Update limited fields on a booked invoice
teamleader_register_payment
Register a payment on an invoice
teamleader_remove_payments
Remove all payments from an invoice
teamleader_copy_invoice
Copy an invoice to a new draft
teamleader_credit_invoice
Create a full credit note
teamleader_credit_invoice_partially
Create a partial credit note
teamleader_download_invoice
Get a temporary download URL (PDF/UBL)
teamleader_list_mail_templates
List mail templates (for invoice sending)
teamleader_list_payment_methods
List payment methods (for registering payments)
Tickets
Tool
Description
teamleader_list_tickets
List tickets with filter by customer, project, or status
teamleader_get_ticket
Get full details of a specific ticket
teamleader_create_ticket
Create a new ticket (subject, customer, team, assignee)
teamleader_update_ticket
Update ticket subject, description, status, or assignee
teamleader_list_ticket_messages
List messages on a ticket (filter by type or date)
teamleader_get_ticket_message
Get a single message by ID
teamleader_reply_ticket
Add a customer-visible reply to a ticket
teamleader_internal_message_ticket
Add an internal/private message to a ticket
Time Tracking
Tool
Description
teamleader_list_timetracking
List time entries filtered by user, date range, or subject
teamleader_get_timetracking
Get details of a specific time entry by ID
teamleader_add_timetracking
Add a new time entry (user, work type, start/end, subject)
teamleader_update_timetracking
Update an existing time entry
teamleader_delete_timetracking
Delete a time entry
teamleader_start_timer
Start a running timer (one active timer per user)
teamleader_stop_timer
Stop the current running timer
teamleader_get_current_timer
Get the currently running timer
teamleader_update_timer
Update a running timer (work type, subject, description)
teamleader_resume_timetracking
Start a new timer from an existing time entry
Projects v2
Tool
Description
teamleader_list_projects_v2
List projects with filtering by status, company, or search term
teamleader_get_project_v2
Get full details of a specific project by ID
teamleader_create_project_v2
Create a new project with customer, dates, and responsible user
teamleader_update_project_v2
Update an existing project
teamleader_close_project_v2
Close a project
teamleader_reopen_project_v2
Reopen a closed project
teamleader_delete_project_v2
Delete a project
teamleader_duplicate_project_v2
Duplicate a project to a new draft
teamleader_add_project_customer
Add a customer (company/contact) to a project
teamleader_remove_project_customer
Remove a customer from a project
teamleader_add_project_deal
Link a deal to a project
teamleader_remove_project_deal
Unlink a deal from a project
teamleader_add_project_owner
Add an owner/member to a project
teamleader_remove_project_owner
Remove an owner/member from a project
teamleader_assign_project
Assign a user or team to a project
teamleader_unassign_project
Unassign a user or team from a project
teamleader_list_project_groups
List project groups (phases/milestones) for a project
teamleader_create_project_group
Create a new group (phase) within a project
teamleader_update_project_group
Update a project group title, description, or dates
teamleader_list_project_tasks_v2
List tasks by project or project group
teamleader_create_project_task_v2
Create a task within a project or group
teamleader_complete_project_task
Mark a project task as complete
teamleader_reopen_project_task
Reopen a completed project task
teamleader_delete_project_task
Delete a project task
teamleader_remove_task_from_group
Remove a task from its group
Users
Tool
Description
teamleader_list_users
List all users in the account
teamleader_get_user
Get full details of a specific user by ID
Departments
Tool
Description
teamleader_list_departments
List all departments
teamleader_get_department
Get full details of a specific department
Files
Tool
Description
teamleader_list_files
List files attached to a contact, company, deal, invoice, project, or ticket
teamleader_get_file
Get file metadata (name, size, mime type, uploader)
teamleader_download_file
Get a temporary download URL for a file
teamleader_delete_file
Delete a file
teamleader_upload_file
Upload a file to an entity (two-step: get URL, then upload)
Notes
Tool
Description
teamleader_list_notes
List notes for a contact, company, deal, or project
teamleader_create_note
Create a note on a contact, company, deal, or project
teamleader_update_note
Update an existing note by ID
Lookup Lists
Tool
Description
teamleader_list_activity_types
List activity types (needed for events.create)
teamleader_list_tax_rates
List tax rates (needed for invoice line items)
teamleader_list_payment_terms
List payment terms (needed for invoices)
teamleader_list_ticket_statuses
List ticket statuses (needed for tickets.update)
teamleader_list_products
List products (for invoice line items)
teamleader_list_product_categories
List product categories
teamleader_list_work_types
List work types (for time tracking)
teamleader_list_teams
List teams (needed for tickets)
teamleader_list_tags
List all tags used in the account
teamleader_list_expenses
List expense entries with optional filters
Smart Resolution (Cache-first)
These tools implement the recommended workflow for time logging. They maintain a local cache to avoid repeated API calls.
Tool
Description
teamleader_find_task
Navigate Company > Project > Group > Task hierarchy interactively. Numbered selection when multiple options. Tasks auto-created if not found.
teamleader_log_time
Register time for a task. Resolves from cache. Supports deduplication and overlap detection.
teamleader_load_tasks
Load and display the full Project > Group > Task tree for a company. Cache-first (30 min TTL). Writes YAML with all IDs.
teamleader_task_action
Maintenance actions on tasks: close, create, move a time entry, or delete a project group.
teamleader_cache_stats
Show cache statistics and all cached tasks.
teamleader_clear_cache
Clear the entire local cache (forces fresh API lookups on next call).
Authentication
Tool
Description
teamleader_login
Start OAuth login flow — opens browser for Teamleader authorization, captures callback on localhost:19836, exchanges code for tokens, persists to ~/.teamleader-tokens.json. Use for initial setup or expired refresh token recovery.
Recommended Workflow: Time Logging
Option A — Interactive (first use or unknown task)
1. teamleader_find_task(company_name="Acme", group_name="Sprint 12", task_name="Bug fix login")
→ resolves company > project > group > task, caches result
2. teamleader_log_time(company_name="Acme", task_name="Bug fix login", started_on="09:00", ended_on="11:30")
→ reads from cache, logs time entry, checks for duplicates
Option B — Load tree first (recommended for sessions with many log entries)
1. teamleader_load_tasks(company_name="Acme")
→ fetches full tree, writes ~/.teamleader-tasks-acme.yaml, shows summary
2. teamleader_load_tasks(company_name="Acme", visual=true)
→ shows numbered ASCII tree
Company: Acme Corp
=== Project Alpha ===
[Sprint 12]
1. Bug fix login (to_do)
2. Add unit tests (in_progress)
3. teamleader_load_tasks(company_name="Acme", task_selection=1)
→ caches task #1 for direct use
4. teamleader_log_time(company_name="Acme", task_name="Bug fix login", started_on="09:00", ended_on="11:30")
→ resolves from cache, logs time
Option C — Direct task_id (fastest, when ID is already known)
Two-step process: call files.upload to get a pre-signed URL, then POST binary directly to that URL (no auth needed for step 2)
General
All API calls use POST with JSON body
Base URL: https://api.focus.teamleader.eu
Pagination uses page.number and page.size
File Structure
src/
api/
auth.ts — OAuth2 token management (auto-rotate, persist to ~/.teamleader-tokens.json)
client.ts — HTTP client (all POST requests)
cache.ts — Cache types, TTL constants, CRUD functions, task tree operations
tools/
resolve.ts — Smart tools: find_task, log_time, load_tasks, task_action, cache_stats, clear_cache
contacts.ts — Contact tools
companies.ts — Company tools
deals.ts — Deal tools
tasks.ts — Legacy task tools
events.ts — Event tools
invoices.ts — Invoice tools
timetracking.ts — Time tracking + timers tools
projects.ts — Projects v2 tools
index.ts — MCP server entry point, tool registration
docs/
api/ — Full Teamleader Focus API docs (187 pages, scraped from developer.focus.teamleader.eu)
find-task-business-logic.md — Detailed business logic for smart resolution tools
tasks/ — CodingMachine task queue (planned tool additions)
Development
# Installnpminstall# Build (TypeScript → dist/)npm run build
# Type check onlynpm run typecheck
# Dev mode (watch)npm run dev
# Test with MCP inspector
npx @modelcontextprotocol/inspector node dist/index.js