agentleFS
haldhald/things-mcp/CLAUDE.md

things-mcp

CLAUDE.md632 starsChanged 23 days agoMITView on GitHub

The project includes a comprehensive unit test suite covering URL scheme construction and data formatting functions. Test coverage includes: - All URL construction functions (add, update, show, search) - Authentication token handling - Data formatting for todos, projects, areas, and tags - Error handling and edge cases - Mock external dependencies (Things.py, shell commands) This is a Model Context Protocol (MCP) server that bridges Claude Desktop with the Things 3 task management app on macOS. The architecture consists of:

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All URL construction functions (add, update, show, search)

    line 41
  2. Distinctive:

    Search and tag operations

    line 55
  3. Very specific:

    Write operations use the Things URL scheme API, except Area create/update which use AppleScript (osascript)

    line 83
  4. Very specific:

    Read tools return a ToolResult (human-readable text + structured_content).

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Commands

Development Setup

# Install dependencies (uses uv package manager)
uv sync

# Run the MCP server (stdio transport, default)
uv run things-mcp

# Run with HTTP transport
THINGS_MCP_TRANSPORT=http uv run things-mcp

Testing

The project includes a comprehensive unit test suite covering URL scheme construction and data formatting functions.

# Install test dependencies
uv sync --extra test

# Run all tests
uv run pytest

# Run tests with verbose output
uv run pytest -v

# Run specific test file
uv run pytest tests/test_url_scheme.py

# Run tests matching a pattern
uv run pytest -k "test_format"

Test coverage includes:

  • All URL construction functions (add, update, show, search)
  • Authentication token handling
  • Data formatting for todos, projects, areas, and tags
  • Error handling and edge cases
  • Mock external dependencies (Things.py, shell commands)

Architecture Overview

This is a Model Context Protocol (MCP) server that bridges Claude Desktop with the Things 3 task management app on macOS. The architecture consists of:

  1. src/things_mcp/server.py - Main MCP server implementation using FastMCP (3.x)
    • Defines all MCP tools for interacting with Things (26 tools)
    • List views (inbox, today, upcoming, etc.)
    • CRUD operations for todos/projects/areas (Areas have create/read/update — no delete by design; see below)
    • Search and tag operations
    • Things URL scheme integration
    • Implements Someday project filtering to match Things UI behavior
    • Pagination + structured responses: the 16 list/search read tools accept optional limit/offset and return a FastMCP ToolResult carrying both a human-readable text channel and a structured_content envelope {items, count, total, offset, limit}. Two helpers drive this: _paginate_format (text) and _paginate_result (wraps text + JSON-safe structured data); _error_result wraps early-return/validation errors. get_tag_usage intentionally stays a plain string.
  2. src/things_mcp/url_scheme.py - Things URL scheme + AppleScript implementation
    • Constructs Things URLs for various operations
    • Uses shell script with open -g to execute URLs without bringing Things to foreground
    • Handles authentication tokens for update operations
    • add_area/update_area use AppleScript (osascript) since the Things URL scheme has no area commands; all user-supplied strings are escaped (\ then ") before being embedded in the AppleScript string literal to prevent injection, and osascript is invoked with an argv list (no shell)
  3. src/things_mcp/formatters.py - Data formatting utilities
    • Converts Things database objects to human-readable text
    • Handles nested data (projects within areas, checklist items, etc.)
  4. tests/ - Unit test suite (192 tests)
    • conftest.py - Pytest fixtures and mock data
    • _helpers.py - tool_text() reads the text channel from a ToolResult (or a plain-string result) so text assertions work across both return shapes
    • test_url_scheme.py - Tests for URL construction
    • test_formatters.py - Tests for data formatting
    • test_things_server.py - Tests for server tools (incl. pagination + structured-content shape)
    • test_things_server_headings.py - Tests for heading functionality
    • test_someday_filtering.py - Tests for Someday project filtering
    • test_mcp_server_filtering.py - Integration tests for MCP server filtering

Key Implementation Details

  • Uses things.py library for reading Things SQLite database
  • Write operations use the Things URL scheme API, except Area create/update which use AppleScript (osascript)
  • FastMCP (3.x) provides the MCP protocol implementation
  • Read tools return a ToolResult (human-readable text + structured_content); write/report tools and error paths return plain strings
  • Error handling for invalid UUIDs and missing parameters; pagination args validated by _validate_pagination
  • Supports filtering and including nested items via parameters
  • Someday Project Filtering: Tasks from Someday projects are filtered out of Today, Upcoming, and Anytime views to match the Things UI behavior and reduce clutter
  • Unit tests mock all external dependencies (Things.py, shell commands)
  • Pytest configuration in pyproject.toml with async support
  • Supports both stdio (default) and HTTP transport modes

Things URL Scheme Authentication

For update operations, the server automatically fetches and includes the auth-token from things.py. This allows updating existing items without user intervention.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.