HistoryMCP

HistoryMCP

Provides AI assistants access to browser history from SQLite databases, enabling reading and analysis of the last 100 visited URLs.

Category
访问服务器

README

HistoryMCP

A Model Context Protocol (MCP) tool that provides access to browser history data from SQLite databases. This tool allows AI assistants to read and analyze your browsing history through the MCP interface.

Features

  • Browser History Access: Read the last 100 visited URLs from your browser's SQLite history database
  • MCP Integration: Seamlessly integrates with MCP-compatible AI assistants
  • Cross-Platform: Works with any browser that stores history in SQLite format (Chrome, Firefox, Safari, etc.)

Installation

Prerequisites

  • Python 3.12 or higher
  • A browser history SQLite database file

Setup

  1. Clone or download this repository

  2. Install dependencies using uv (recommended):

    uv sync
    
  3. Set up your browser history database path:

    You need to set the SQLITE_PATH environment variable to point to your browser's history database:

    Chrome/Chromium:

    export SQLITE_PATH="$HOME/Library/Application Support/Google/Chrome/Default/History"
    

    Firefox:

    export SQLITE_PATH="$HOME/Library/Application Support/Firefox/Profiles/*.default/places.sqlite"
    

    Safari:

    export SQLITE_PATH="$HOME/Library/Safari/History.db"
    

    Note: You may need to copy the database file to a writable location first, as browsers often lock their database files.

Usage

Running the MCP Server

python main.py

The server runs on stdio transport, which is the standard for MCP tools.

Available Tools

read_history()

Returns the last 100 visited URLs from your browser history.

Returns:

  • List[Dict[str, str]]: A list of dictionaries containing:
    • "title": The title of the web page
    • "url": The URL of the web page

Example Response:

[
  {
    "title": "GitHub - Homepage",
    "url": "https://github.com"
  },
  {
    "title": "Stack Overflow - Programming Questions",
    "url": "https://stackoverflow.com"
  }
]

Integration with MCP Clients

To use this tool with an MCP client, add it to your MCP configuration:

{
  "mcpServers": {
    "history": {
      "command": "python",
      "args": ["/path/to/historyMCP/main.py"],
      "env": {
        "SQLITE_PATH": "/path/to/your/browser/history.db"
      }
    }
  }
}

Development

Project Structure

historyMCP/
├── main.py          # Main MCP server implementation
├── pyproject.toml   # Project configuration and dependencies
├── README.md        # This file
└── uv.lock          # Dependency lock file

Dependencies

  • mcp[cli]>=1.10.1: Model Context Protocol implementation
  • requests>=2.32.4: HTTP requests for web content fetching
  • httpx>=0.28.1: Modern HTTP client
  • pandas>=2.3.0: Data manipulation (for future features)

Adding New Features

The codebase is structured to easily add new tools. To add a new MCP tool:

  1. Create a new function with the @mcp.tool() decorator
  2. Define the function signature and return type
  3. Add appropriate documentation

Example:

@mcp.tool()
def search_history(query: str) -> List[Dict[str, str]]:
    """
    Search browser history for URLs containing the query
    
    Args:
        query: Search term to look for in URLs and titles
        
    Returns:
        List of matching history entries
    """
    # Implementation here
    pass

Security Considerations

⚠️ Important: This tool accesses your browser history, which may contain sensitive information. Consider the following:

  • Only use this tool with trusted MCP clients
  • Be aware that your browsing history will be shared with AI assistants
  • Consider using a separate browser profile for testing
  • Review the data being shared before using in production environments

Troubleshooting

Common Issues

  1. "Please set the SQLITE_PATH environment variable"

    • Make sure you've set the SQLITE_PATH environment variable correctly
    • Verify the path points to a valid SQLite database file
  2. "Database is locked"

    • Close your browser completely
    • Copy the database file to a temporary location
    • Update the SQLITE_PATH to point to the copied file
  3. "No such file or directory"

    • Check that the browser history database path is correct for your system
    • Ensure the file exists and is readable

Getting Help

If you encounter issues:

  1. Check that your Python version is 3.12 or higher
  2. Verify all dependencies are installed correctly
  3. Ensure the SQLite database path is correct and accessible
  4. Check that your browser is not currently running (to avoid database locks)

License

This project is open source. Please check the license file for more details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue for bugs and feature requests.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选