Pocket Pick MCP Server

repository·main·Indexed 42 days ago

https://github.com/disler/pocket-pick

An MCP (Model Context Protocol) server that acts as a personal engineering knowledge base. It allows users to store, tag, and search code snippets, ideas, and patterns using a lightweight SQLite backend, making them accessible to AI assistants like Claude Code. Features include full-text search (FTS), regex and glob matching, and a CLI for managing items via unique IDs.

Tokens
7.7K
Snippets
26
Records
34
Agent score
52%

What's inside Pocket Pick

  1. Configure Unique IDs for Pocket Pick

    main

    When adding items, you must provide a unique ID. If an ID already exists, the operation will fail.

    Recommended ID Schemes:

    • Descriptive IDs: Use meaningful names like python-sort-algorithm or css-flexbox-cheatsheet.
    • Namespaced IDs: Use prefixes like py-, js-, or css- to categorize items.
    • UUID-style IDs: Use standard UUIDs if you prefer automatically generated unique identifiers.
  2. Manage IDs in Pocket Pick

    main

    Pocket Pick requires explicit ID management for all new items. Follow these rules to ensure successful additions:

    • Uniqueness: IDs must be unique across your entire database.
    • Descriptive Naming: Use semantic IDs (e.g., my-project-config) instead of random strings to make item recall easier.
    • Error Handling: If you attempt to add an item with an ID that is already in use, the server will return an error indicating a duplicate ID.
  3. Understand the Pocket Pick database schema

    main

    Pocket Pick uses a SQLite database to store knowledge. The primary table is POCKET_PICK and follows this structure:

    FieldTypeDescription
    idstrUnique identifier for the entry
    createddatetimeTimestamp of creation
    textstrThe actual content/snippet
    tagsstr[]An array of tags associated with the entry

    Note on Tags: Tags are automatically normalized: they are forced to lowercase, whitespace is trimmed, and spaces or underscores are replaced with dashes.

    CREATE TABLE if not exists POCKET_PICK {
        id: str,
        created: datetime,
        text: str,
        tags: str[],
    }
  4. Install Pocket Pick

    main

    To install Pocket Pick, ensure you have uv installed, then clone the repository and sync dependencies.

    # Clone the repository
    git clone https://github.com/indydevdan/pocket-pick.git
    cd pocket-pick
    
    # Install dependencies
    uv sync
    git clone https://github.com/indydevdan/pocket-pick.git
    cd pocket-pick
    uv sync
  5. Add Pocket Pick to Claude Code via CLI

    main

    Use the claude mcp add command to register the Pocket Pick server with Claude Code.

    If you are already in the pocket-pick directory:

    claude mcp add pocket-pick -- \
        uv --directory . \
        run mcp-server-pocket-pick

    Using a specific codebase path:

    claude mcp add pocket-pick -- \
        uv --directory /path/to/pocket-pick-codebase \
        run mcp-server-pocket-pick

    Using a custom database location:

    claude mcp add pocket-pick -- \
        uv --directory /path/to/pocket-pick-codebase \
        run mcp-server-pocket-pick --database ./database.db

    Verify installation:

    claude mcp list
  6. Validate the Pocket Pick MCP server

    main

    To ensure the MCP server is correctly installed and functioning, you can use the following validation steps:

    1. Run Tests: Use uv run pytest to execute the test suite.
    2. Check CLI Help: Run uv run mcp-server-pocket-pick --help to verify the command is recognized and the help menu displays correctly.
    uv run pytest
    uv run mcp-server-pocket-pick --help
  7. Configure Pocket Pick in Claude Code via .mcp.json

    main

    You can integrate Pocket Pick with Claude Code by adding a configuration to your project's .mcp.json file. This allows Claude Code to automatically detect the server when started in that directory.

    Standard Configuration:

    {
      "servers": {
        "pocket-pick": {
          "command": "uv",
          "args": ["--directory", "/path/to/pocket-pick", "run", "mcp-server-pocket-pick"]
        }
      }
    }

    Configuration with a custom database location:

    {
      "servers": {
        "pocket-pick": {
          "command": "uv",
          "args": ["--directory", "/path/to/pocket-pick", "run", "mcp-server-pocket-pick", "--database", "./custom-database.db"]
        }
      }
    }
  8. Manage Knowledge Base Items with Claude

    main

    Once configured, you can interact with your knowledge base using natural language prompts in Claude.

    Adding Items:

    • Directly: Add "claude mcp list" as a pocket pick item with ID "claude-mcp-list". tags: mcp, claude, code
    • From Clipboard: pbpaste and create a pocket pick item with ID "python-fib" and the following tags: python, algorithm, fibonacci
    • From a File: Add the contents of ~/Documents/code-snippets/fibonacci.py to pocket pick with ID "fib-algorithm" and tags: python, algorithm, fibonacci

    Retrieving and Searching:

    • List all: list all my pocket picks
    • Filter by tags: List pocket pick items with python and mcp tags
    • Search text: pocket pick find "python"
    • Get specific item: get the pocket pick item with ID 1234-5678-90ab-cdef
    • Remove item: remove the pocket pick item with ID 1234-5678-90ab-cdef

    Exporting and Backing Up:

    • Export to file: export the pocket pick item with ID 1234-5678-90ab-cdef to /Users/username/Documents/exported-snippet.py (Requires absolute path)
    • Backup database: backup the pocket pick database to ~/Documents/pocket-pick-backup.db
  9. Use the Pocket Pick CLI API

    main

    Pocket Pick provides a CLI for managing your personal knowledge base. You can add snippets, find them using various search modes, list entries or tags, and manage the database via backup and removal commands.

    Core Commands:

    • pocket add <text>: Store a new snippet. Use --tags to categorize it.
    • pocket find <text>: Search for snippets. Supports multiple --mode options (see Search Modes).
    • pocket list: List stored snippets. Filter by --tags or set a --limit.
    • pocket list-tags: List all unique tags used in the database.
    • pocket get <id>: Retrieve a specific snippet by its ID.
    • pocket remove <id>: Delete a snippet by its ID.
    • pocket backup <path>: Create a backup of the database at the specified absolute path.

    All commands accept an optional --db <path> argument to specify a custom SQLite database location. By default, it uses ~/.pocket_pick.db.

    # Add a snippet with tags
    pocket add "my code snippet" --tags tag1 tag2
    
    # Find snippets using a specific mode
    pocket find "search term" --mode fts --limit 5
    
    # List all tags
    pocket list-tags
    
    # Get a specific entry
    pocket get --id "some-uuid"
  10. Add items with custom IDs using pocket_add

    main

    When adding a new text-based item to your Pocket Pick knowledge base, you must now provide a unique id. This replaces the previous behavior of automatic UUID generation and allows for semantic, descriptive naming. If you attempt to use an ID that already exists in the database, the tool will return an error.

    Parameters:

    • id (string, required): A unique identifier for the item.
    • text (string, required): The content to be stored.
    • tags (list of strings, optional): Metadata tags for the item.
    • db_path (Path, optional): The path to the SQLite database.
    Add "claude mcp list" as a pocket pick item with ID "claude-mcp-list". tags: mcp, claude, code
  11. Add files with custom IDs using pocket_add_file

    main

    When adding the content of a file to your Pocket Pick knowledge base, you must provide a unique id. This allows you to reference file contents using meaningful identifiers.

    Parameters:

    • id (string, required): A unique identifier for the file content.
    • file_path (string, required): The path to the file to be added.
    • tags (list of strings, optional): Metadata tags for the item.
    • db_path (Path, optional): The path to the SQLite database.
  12. Use the `pocket_list_ids` tool

    main

    The pocket_list_ids command allows you to retrieve a lightweight list of all item IDs stored in your Pocket Pick database. This is useful for verifying if a specific ID exists or for quickly scanning available content without downloading full item details. You can optionally filter the results by tags or limit the number of IDs returned.

    Parameters

    • tags (optional): A list of strings to filter results to only include items containing these specific tags.
    • limit (optional): An integer specifying the maximum number of IDs to return. Defaults to 100.
    • db (optional): The file path to the database. Defaults to ~/.pocket_pick.db.
    # Example response
    python-sort-algorithm
    css-flexbox-cheatsheet
    docker-cheat-sheet
    api-design-patterns
    git-workflow