bear-read-only-mcp-gateway
Facilitates secure, read-only access to Bear notes via an MCP endpoint. This service enables AI models to query, retrieve, and search your private collection of Bear entries exclusively through retrieval operations, guaranteeing data integrity and non-modification.
Author

bart6114
Quick Info
Actions
Tags
Bear Note Access Protocol Server (Read-Only)
This Model Context Protocol (MCP) module acts as a dedicated bridge, allowing advanced AI systems such as Claude to interface with and extract information from your locally stored Bear application data. The core mechanism involves establishing a direct, read-only connection to the underlying Bear SQLite structure, providing robust data safety by preventing any write, edit, or deletion operations.
Rapid Deployment
Method A: Instant Execution (Recommended)
Use npx for immediate setup and execution:
npx github:bart6114/my-bear-mcp-server
Method B: Local Source Installation
For development or manual control:
# Obtain the source code
git clone https://github.com/bart6114/my-bear-mcp-server.git
cd my-bear-mcp-server
# Dependency setup
npm install
# Compile and launch the service
npm run build
npm start
Prerequisites
- Operating System: macOS required (due to Bear's storage location).
- Runtime Environment: Node.js version 18 or newer.
Configuration for AI Clients
To enable AI assistants to recognize and utilize this service, place the following configuration snippet into your client's settings file.
For Claude Desktop Application
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"bear": {
"command": "npx",
"args": ["github:bart6114/my-bear-mcp-server"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
For Claude VS Code Extension
Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json:
{
"mcpServers": {
"bear": {
"command": "npx",
"args": ["github:bart6114/my-bear-mcp-server"],
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
Exposed Retrieval Functions
The gateway exposes the following non-destructive data access operations:
fetch_note_by_identifier
Retrieves content using the note's canonical title or unique internal identifier.
catalog_notes_by_keyword
Executes full-text searches across all notes based on specified terms or associated metadata.
list_all_user_tags
Generates a comprehensive inventory of every tag currently defined within the Bear ecosystem.
retrieve_notes_by_label
Fetches a list of entries associated with a specific user-defined tag.
Interaction Examples
AI prompts leverage these functions to organize and locate information:
Locating Topics
"I need the AI to search my notes for documents discussing 'agile methodology' and 'sprint planning'."
Can you find all my notes about "project management"?
Fetching Specific Content
"Direct the assistant to load the note titled 'Monthly Review: Q1 2025'."
Show me my note titled "Meeting Notes - March 2025"
Tag Inventory Check
"Query the system to report every tag I currently utilize."
What tags do I have in my Bear notes?
Filtering by Category
"Display all notes categorized under the 'professional' label."
Show me all notes with the #work tag
Customizing Data Path
If your Bear database resides outside the default location, specify the path during execution:
npx github:bart6114/my-bear-mcp-server --db-path /path/to/your/database.sqlite
Security and Implementation Guarantees
Immutable Data Access Enforcement
This server strictly adheres to a read-only operational paradigm. Connection to the SQLite instance utilizes a mandatory read-only flag enforced by the underlying driver:
// Source excerpt from src/bear-db.ts
this.db = new Database(dbPath, { readonly: true });
This critical setting ensures the following: - All database transactions are fundamentally restricted to retrieval (SELECT). - There is zero possibility of data mutation (writing, modifying, or purging notes). - Any attempt by the driver to execute a write command results in an immediate connection failure.
All functionalities exposed through this gateway are purely for data extraction.
Licensing Information
This software is distributed under the terms of the MIT License. Consult the LICENSE file for complete details.
==================================================================================================== WIKIPEDIA: XMLHttpRequest (XHR) is an API in the form of a JavaScript object whose methods transmit HTTP requests from a web browser to a web server. The methods allow a browser-based application to send requests to the server after page loading is complete, and receive information back. XMLHttpRequest is a component of Ajax programming. Prior to Ajax, hyperlinks and form submissions were the primary mechanisms for interacting with the server, often replacing the current page with another one.
== History == The concept behind XMLHttpRequest was conceived in 2000 by the developers of Microsoft Outlook. The concept was then implemented within the Internet Explorer 5 browser (1999). However, the original syntax did not use the XMLHttpRequest identifier. Instead, the developers used the identifiers ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of Internet Explorer 7 (2006), all browsers support the XMLHttpRequest identifier. The XMLHttpRequest identifier is now the de facto standard in all the major browsers, including Mozilla's Gecko layout engine (2002), Safari 1.2 (2004) and Opera 8.0 (2005).
=== Standards === The World Wide Web Consortium (W3C) published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C published the Working Draft Level 2 specification. Level 2 added methods to monitor event progress, allow cross-site requests, and handle byte streams. At the end of 2011, the Level 2 specification was absorbed into the original specification. At the end of 2012, the WHATWG took over development and maintains a living document using Web IDL.
== Usage == Generally, sending a request with XMLHttpRequest has several programming steps.
Create an XMLHttpRequest object by calling a constructor: Call the "open" method to specify the request type, identify the relevant resource, and select synchronous or asynchronous operation: For an asynchronous request, set a listener that will be notified when the request's state changes: Initiate the request by calling the "send" method: Respond to state changes in the event listener. If the server sends response data, by default it is captured in the "responseText" property. When the object stops processing the response, it changes to state 4, the "done" state. Aside from these general steps, XMLHttpRequest has many options to control how the request is sent and how the response is processed. Custom header fields can be added to the request to indicate how the server should fulfill it, and data can be uploaded to the server by providing it in the "send" call. The response can be parsed from the JSON format into a readily usable JavaScript object, or processed gradually as it arrives rather than waiting for the entire text. The request can be aborted prematurely or set to fail if not completed in a specified amount of time.
== Cross-domain requests ==
In the early development of the World Wide Web, it was found possible to brea
