HistoryMCP
Provides AI assistants access to browser history from SQLite databases, enabling reading and analysis of the last 100 visited URLs.
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
-
Clone or download this repository
-
Install dependencies using uv (recommended):
uv sync -
Set up your browser history database path:
You need to set the
SQLITE_PATHenvironment 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 implementationrequests>=2.32.4: HTTP requests for web content fetchinghttpx>=0.28.1: Modern HTTP clientpandas>=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:
- Create a new function with the
@mcp.tool()decorator - Define the function signature and return type
- 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
-
"Please set the SQLITE_PATH environment variable"
- Make sure you've set the
SQLITE_PATHenvironment variable correctly - Verify the path points to a valid SQLite database file
- Make sure you've set the
-
"Database is locked"
- Close your browser completely
- Copy the database file to a temporary location
- Update the
SQLITE_PATHto point to the copied file
-
"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:
- Check that your Python version is 3.12 or higher
- Verify all dependencies are installed correctly
- Ensure the SQLite database path is correct and accessible
- 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.