Logo OmniFocus

OmniFocus

Cộng đồng
duquesnay

A professional MCP server for OmniFocus with smart caching and analytics to manage tasks and projects.

Nhà phát hànhduquesnay
Kho mãomnifocus-mcp
Ngôn ngữTypeScript
Bản fork
12
Sao
15
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    OmniFocus cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    15 sao và 12 bản fork từ kho mã được liên kết.

Model Context Protocol for OmniFocus (incl. advanced features)

Disclaimer: pardon the stiffness of the documentation and commits language, the project is fully coded via Claude Code, ao many messages are either as fun as an accounting report (with random emphasis of a car salesman here and there).

A professional Model Context Protocol (MCP) server for OmniFocus that provides advanced task management capabilities with smart caching and analytics. Built with TypeScript and full respect for OmniFocus's official OmniAutomation API.

Features

Core Capabilities

  • Smart Caching: TTL-based caching system for optimal performance
  • Type Safety: Full TypeScript support with comprehensive types
  • Official API Only: Uses only OmniAutomation scripts (no database hacking)
  • High Performance: Handles 1000+ tasks efficiently with intelligent caching

Available Tools

Task Operations (Read)

  • list_tasks - Advanced task filtering with smart caching
    • Filter by: completion status, flags, project, tags, dates, search terms
    • Supports inbox filtering and availability checks
    • Supports up to 1000 tasks with proper pagination metadata
    • Results cached for 30 seconds for lightning-fast repeated queries
  • get_task_count - Get count of tasks matching filters without data
    • Same filtering options as list_tasks
    • Returns count only for performance

Task Operations (Write)

  • create_task - Create new tasks in inbox
    • Set name, note, flagged status, due/defer dates
    • Tag assignment limited to existing tags
    • Returns temporary ID (JXA limitation)
  • update_task - Update existing tasks
    • Modify name, note, flagged status, dates
    • Limited tag management due to JXA
  • complete_task - Mark tasks as completed
  • delete_task - Remove tasks

Project Operations

  • list_projects - List and filter projects with caching
    • Filter by: status (active, on hold, dropped, completed), flags, folder
    • Results cached for 5 minutes
  • create_project - Create new projects with folder support
    • Automatically creates folders if they don't exist
    • Set name, note, dates, flags, and parent folder
  • update_project - Update project properties
    • Change name, note, status, dates, flags
    • Folder movement supported with limitations (JXA constraint)
  • complete_project - Mark projects as done
  • delete_project - Remove projects from OmniFocus

Coming Soon

  • Analytics tools (productivity stats, velocity tracking, overdue analysis)
  • Tag management
  • Bulk operations
  • Smart search with natural language
  • Recurring task analysis

Installation & Permissions

Prerequisites

  1. OmniFocus 3 or later installed on macOS
  2. Node.js 18+ installed
  3. Permission to access OmniFocus via automation (see Permissions Guide)

Installation Steps

bash
# Clone the repository
git clone https://github.com/yourusername/omnifocus-cache-by-windsurf.git
cd omnifocus-cache-by-windsurf

# Install dependencies
npm install

# Build the project
npm run build

# Run the server
npm start

Granting Permissions

The first time you use the MCP server, macOS will prompt you to grant permission to access OmniFocus. See the Permissions Guide for detailed instructions.

Configuration

Claude Desktop Setup

Add to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "omnifocus": {
      "command": "node",
      "args": ["/path/to/omnifocus-cache-by-windsurf/dist/index.js"],
      "env": {
        "LOG_LEVEL": "info"
      }
    }
  }
}

Environment Variables

  • LOG_LEVEL - Set logging level: error, warn, info, debug (default: info)

Usage Examples

List All Incomplete Tasks

typescript
{
  "tool": "list_tasks",
  "arguments": {
    "completed": false,
    "limit": 50
  }
}

Create a New Task with Project Assignment

typescript
// First, find the project ID
{
  "tool": "list_projects",
  "arguments": {
    "search": "Budget Planning"
  }
}
// Returns: { "projects": [{ "id": "jH8x2mKl9pQ", "name": "Budget Planning 2024", ... }] }

// Then create the task in that project
{
  "tool": "create_task",
  "arguments": {
    "name": "Review Q4 budget",
    "projectId": "jH8x2mKl9pQ",  // Use the ID from list_projects
    "dueDate": "2024-01-15T17:00:00Z",
    "flagged": true,
    "tags": ["finance", "urgent"],
    "estimatedMinutes": 30
  }
}

Move a Task Between Projects

typescript
// Move an existing task to a different project
{
  "tool": "update_task",
  "arguments": {
    "taskId": "abc123xyz",
    "projectId": "newProjectId"  // Or null to move to inbox
  }
}

Find Overdue Tasks

typescript
{
  "tool": "list_tasks",
  "arguments": {
    "completed": false,
    "dueBefore": "2024-01-01T00:00:00Z",
    "search": "budget"
  }
}

List Active Projects

typescript
{
  "tool": "list_projects",
  "arguments": {
    "status": ["active"],
    "flagged": true
  }
}

Create a Project with Folder

typescript
{
  "tool": "create_project",
  "arguments": {
    "name": "New Website Launch",
    "note": "Complete redesign and launch",
    "folder": "Work Projects",  // Creates folder if it doesn't exist
    "dueDate": "2024-03-31T17:00:00Z",
    "flagged": true
  }
}

Update Project (Including Folder)

typescript
// First, get the project ID from list_projects
{
  "tool": "list_projects",
  "arguments": {
    "search": "Website Launch"
  }
}

// Then update using the project ID
{
  "tool": "update_project",
  "arguments": {
    "projectId": "jH8x2mKl9pQ",  // Use the ID from list_projects
    "updates": {
      "folder": "Archive",  // Note: Folder movement has JXA limitations
      "status": "onHold",
      "note": "Postponed until Q2"
    }
  }
}

Troubleshooting

"Project not found" Errors with Numeric IDs

If you see errors like Project with ID '547' not found followed by a Claude Desktop bug warning:

  1. Use list_projects to get the correct full project ID:

    typescript
    {
      "tool": "list_projects",
      "arguments": {
        "search": "your project name"
      }
    }
  2. Copy the full alphanumeric ID (e.g., "az5Ieo4ip7K") from the results

  3. Use project names as an alternative:

    typescript
    {
      "tool": "update_task", 
      "arguments": {
        "taskId": "your-task-id",
        "projectId": null  // Move to inbox first
      }
    }

    Then manually assign in OmniFocus, or use project names in search filters instead.

Task Update Failures

  • Always get task IDs from list_tasks rather than guessing
  • Use list_projects to verify project IDs before assignment
  • Check that tasks exist and aren't in the trash

Architecture

Cache Strategy

The server implements intelligent caching with different TTLs for different data types:

  • Tasks: 30 seconds (frequently changing)
  • Projects: 5 minutes (less volatile)
  • Analytics: 1 hour (expensive computations)
  • Tags: 10 minutes (relatively stable)

Cache is automatically invalidated on write operations.

OmniAutomation Integration

All OmniFocus interactions use JavaScript for Automation (JXA) through OmniAutomation:

  • Scripts are wrapped for error handling
  • Parameters are safely escaped
  • Results are typed and validated
  • Batch operations are supported

Error Handling

The server provides detailed error messages with:

  • Specific error types (NotFound, Permission, Script execution)
  • Contextual information for debugging
  • Graceful degradation when possible

Development

Prerequisites

  • Node.js 18+
  • OmniFocus 3+ (Pro recommended)
  • macOS (required for OmniAutomation)

Scripts

bash
npm run build    # Build TypeScript
npm run dev      # Watch mode
npm run test     # Run tests
npm run lint     # Lint code
npm run typecheck # Type checking

Project Structure

src/
├── cache/          # Smart caching system
├── omnifocus/      # OmniAutomation integration
│   └── scripts/    # JXA script templates
├── tools/          # MCP tool implementations
├── utils/          # Logging and helpers
└── index.ts        # Server entry point

Performance

  • Handles 1000+ tasks with sub-second response times
  • Intelligent caching reduces OmniFocus API calls by 80%+
  • Concurrent script execution for batch operations
  • Memory-efficient with automatic cache cleanup

Security

  • No direct database access
  • Parameters are sanitized before script execution
  • Read-only operations by default
  • No sensitive data is logged

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

Future Improvements

High Priority Recommendations

  1. Fix Unit Test Suite: Several unit tests are failing due to incorrect assumptions about the codebase. Priority areas:

    • Update test expectations to match actual API response formats
    • Align mock objects with real implementation interfaces
    • Remove tests that verify incorrect behavior (e.g., expecting primaryKey to be a method when it's a property)
  2. Add ESLint Configuration: The project is missing an ESLint configuration file which prevents linting from running. Create an eslint.config.js that supports TypeScript and follows the project's coding standards.

  3. Improve Error Recovery: While the URL scheme fallback for permission-denied errors is a good start, consider:

    • Implementing retry logic with exponential backoff
    • Adding user-friendly error messages that suggest solutions
    • Creating a diagnostic tool to help users troubleshoot permission issues

License

MIT License - see LICENSE file for details

Testing

End-to-End Testing with Claude Desktop

To test the permission system with Claude Desktop:

  1. Revoke Permissions (to test error handling):

    • Open System Settings → Privacy & Security → Automation
    • Find "Claude" (or "Electron" if Claude isn't listed)
    • Uncheck the checkbox next to "OmniFocus"
  2. Test in Claude Desktop:

    • Ask Claude: "Can you list my OmniFocus tasks?"
    • You should see a helpful error message with instructions to grant permissions
  3. Grant Permissions:

    • Either click "OK" when the permission dialog appears
    • Or manually enable in System Settings as instructed
  4. Verify Success:

    • Ask Claude again to list your tasks
    • Tasks should now be displayed correctly

Testing During Development

bash
# Build and test the server
npm run build
npm test

# Test with MCP Inspector
npx @modelcontextprotocol/inspector dist/index.js

# Run integration tests
node tests/integration/test-as-claude-desktop.js

Technical Notes

Claude Desktop ID Parsing Bug

CRITICAL ISSUE: Claude Desktop has a confirmed bug where it extracts numeric portions from alphanumeric project IDs when calling MCP tools.

Example: When you provide project ID "az5Ieo4ip7K", Claude Desktop may pass only "547" to the tool, causing "Project not found" errors.

Symptoms:

  • Task updates fail with "Project not found" errors
  • Error messages show numeric IDs (like "547") instead of full alphanumeric IDs
  • Occurs even when full project IDs are provided in prompts

Mitigation:

  • Our error messages now detect this pattern and provide helpful guidance
  • Tool descriptions warn about using full alphanumeric IDs
  • Consider using project names instead of IDs when this bug affects your workflow

Related Issues: This is part of broader Claude Desktop parameter processing bugs documented in GitHub issues, including type conversion failures and JSON parsing errors.

ES Modules Requirement

This project uses ES modules (ESM) with .js extensions in import statements, which may seem unusual for TypeScript projects. This is required because:

  1. The MCP SDK (@modelcontextprotocol/sdk) is currently ESM-only
  2. There are known CommonJS compatibility issues (see GitHub issue #217)

Future Migration: Once the MCP SDK adds proper CommonJS support, this project should migrate to standard TypeScript/CommonJS to remove the need for .js extensions in imports.

Acknowledgments

Built with:

Dùng MCP OmniFocus với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối OmniFocus, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm OmniFocus làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của OmniFocus.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "omnifocus-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của OmniFocus, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của OmniFocus.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng OmniFocus giúp tôi làm việc này không?
OmniFocus
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng OmniFocus.

Câu hỏi thường gặp

Máy chủ MCP OmniFocus dùng để làm gì?

OmniFocus là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP OmniFocus với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng OmniFocus với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP OmniFocus với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối OmniFocus, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP OmniFocus với TypingMind?

OmniFocus hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP OmniFocus cung cấp những công cụ nào trong TypingMind?

OmniFocus cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP OmniFocus không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu OmniFocus yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇