Skip to main content

MCP server for searching local browser history files. Also compatible with llm-tools.

Project description

Local Browser History MCP

An MCP server that allows searching local browser history files through a unified interface. Works with MCP-compatible clients and as a tool for the llm CLI tool.

The tool currently supports Chrome, Firefox, and Safari browser histories.

Installation

MCP Server (Claude Desktop, Claude Code, etc.)

Install with MCP support:

pip install llm-tools-browser-history

Quick start for Claude Desktop - add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "browser-history": {
      "command": "uvx",
      "args": [
        "--from",
        "llm-tools-browser-history",
        "browser-history-mcp",
      ]
    }
  }
}

Once configured, you can use the browser_history tool in conversations with Claude.

Note that the CLI supports additional options as needed:

browser-history-mcp --help

Query Parameter Whitelist

By default, query parameters are stripped from URLs to protect sensitive data (session IDs, auth tokens, etc.). A built-in whitelist preserves useful parameters like search terms and video IDs for well-known domains (Google q, YouTube v, etc.).

To supply your own whitelist, create a YAML file mapping domains to allowed parameter keys:

# my-whitelist.yaml
google.com:
  - q
  - tbm
youtube.com:
  - v
  - t
amazon.com:
  - k
  - field-keywords
github.com:
  - q

Then pass it via --qp-whitelist:

browser-history-mcp --qp-whitelist my-whitelist.yaml

Domain matching walks up subdomains: a URL on images.google.com will match the google.com rule if no images.google.com rule exists. Domains not in the whitelist have all query parameters stripped (the previous default behaviour).

The database schema includes a stripped_qp column that records the names (never values) of removed parameters, and a domain column for the URL's domain.

Debugging with --query

Use --query to run a single SQL query, print results, and exit without starting the MCP server:

browser-history-mcp --query "SELECT url, title, domain, stripped_qp FROM browser_history LIMIT 5"

Note: Safari browser history is blocked by TCC - you would need to explicitly allow access to your Safari data (I don't yet have instructions for this, but welcome contributions!)

llm CLI tool

Install for use with llm:

# install the plugin:
llm install llm-tools-browser-history

# see available plugins:
llm plugins

...
  {
    "name": "llm-tools-browser-history",
    "hooks": [
      "register_tools"
    ],
    "version": "0.1.0"
  },
...

Examples:

# Search for pages mentioning yosemite in title or URL
llm -T llm_time -T BrowserHistory "what pages about yosemite did I look up recently?"

# Limit to Firefox and Safari sources
llm -T llm_time -T 'BrowserHistory(["firefox","safari"])' "what pages about yosemite did I look up recently?"

llm -T BrowserHistory "show a table of how much I used each browser over the past year by month"

Security and Privacy

Warning: This tool has read-access to your entire browser history. You risk sending this highly sensitive personal data to third-party services (like OpenAI).

See the lethal trifecta article for more information about the risks of using tools like this with LLMs.

To mitigate the risks of data leakage:

  • Only runs queries against a copy of the target browser's history database (so any malicious modification has no effect).
  • Limits the number of results to no more than 100 records per tool use.
  • Does not return the entire browser history record. This tool will return a subset of fields (URL, title, visit date). Query parameters are filtered by a configurable whitelist (only safe keys like search terms are preserved; all others are stripped). Timestamps only include the date (not the time).

Dev setup

make setup
make test

pip install -e .

llm -T llm_time -T BrowserHistory --td "what pages about yosemite did I look up recently?"

Documentation

  • MCP Setup Guide - Setting up the MCP server for Claude Desktop, Claude Code, etc.

ADRs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_tools_browser_history-0.4.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_tools_browser_history-0.4.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file llm_tools_browser_history-0.4.1.tar.gz.

File metadata

  • Download URL: llm_tools_browser_history-0.4.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_tools_browser_history-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f98448261ff3008d055f0431ab7bf4d22d3428b94bbf073bbbee4f424b9499cb
MD5 c95b5f728972889ccfdcf94c14378ed8
BLAKE2b-256 4dd8ee2cfb2e7254a2e6e1351ff7d06940480866796fa07e6155b6d2276bd41c

See more details on using hashes here.

File details

Details for the file llm_tools_browser_history-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: llm_tools_browser_history-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_tools_browser_history-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a4cf36d8f50b9ef71eaa5b40db2dc6ad70ec44a64081b1d1910d5452f361efa
MD5 51c75f9a8863faf6624f2d7222c3b749
BLAKE2b-256 90cd403ae1344cc50faf4c97335b67e60c26b62a3a8a31d0003af1724eec32b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page