Keep/mcp-server/README.md
sepehr ddb67ba9e5 fix: unify theme system - fix theme switching persistence
- Unified localStorage key to 'theme-preference' across all components
- Fixed header.tsx using wrong localStorage key ('theme' instead of 'theme-preference')
- Added localStorage hybrid persistence for instant theme changes
- Removed router.refresh() which was causing stale data revert
- Replaced Blue theme with Sepia
- Consolidated auth() calls to prevent race conditions
- Updated UserSettingsData types to include all themes
2026-01-18 22:33:41 +01:00

346 lines
7.5 KiB
Markdown

# Keep Notes MCP Server
Model Context Protocol (MCP) server for integrating Keep Notes note-taking app with N8N, Cursor, and other automation tools.
## Installation
```bash
cd mcp-server
npm install
```
## Usage
### Quick Start (Windows)
Le plus simple pour démarrer le serveur MCP:
```powershell
# Exécuter depuis le dossier mcp-server
.\start-mcp.ps1
```
Ou le script batch:
```cmd
start-mcp.bat
```
Ces scripts vérifient automatiquement les prérequis et démarrent le serveur.
### Standalone Server (Cross-platform)
```bash
npm start
```
Ou directement:
```bash
node index.js
```
Pour le mode SSE (Server-Sent Events):
```bash
npm run start:sse
```
Voir [START-MCP.md](./START-MCP.md) pour le guide complet de démarrage.
### With Cursor MCP
Add to your Cursor MCP client configuration:
```json
{
"mcpServers": {
"keep-notes": {
"command": "node",
"args": ["D:/dev_new_pc/Keep/mcp-server/index.js"]
}
}
}
```
### With N8N
Configure the MCP node in N8N with the server details above.
## Available Tools
### Note Management
#### create_note
Create a new note in Keep Notes.
**Parameters:**
- `title` (string, optional): Note title
- `content` (string, required): Note content
- `color` (string, optional): Note color (default, red, orange, yellow, green, teal, blue, purple, pink, gray)
- `type` (string, optional): Note type (text or checklist)
- `checkItems` (array, optional): Checklist items
- `labels` (array, optional): Note labels/tags
- `isPinned` (boolean, optional): Pin the note
- `isArchived` (boolean, optional): Archive the note
- `images` (array, optional): Note images as base64 encoded strings
- `links` (array, optional): Note links
- `reminder` (string, optional): Reminder date/time (ISO 8601 format)
- `isReminderDone` (boolean, optional): Mark reminder as done
- `reminderRecurrence` (string, optional): Reminder recurrence (daily, weekly, monthly, yearly)
- `reminderLocation` (string, optional): Reminder location
- `isMarkdown` (boolean, optional): Enable markdown support
- `size` (string, optional): Note size (small, medium, large)
- `notebookId` (string, optional): Notebook ID to associate the note with
**Example:**
```json
{
"title": "Shopping List",
"content": "Buy groceries",
"color": "blue",
"type": "checklist",
"checkItems": [
{ "id": "1", "text": "Milk", "checked": false },
{ "id": "2", "text": "Bread", "checked": false }
],
"labels": ["shopping", "personal"],
"notebookId": "cuid123..."
}
```
#### get_notes
Get all notes from Keep Notes.
**Parameters:**
- `includeArchived` (boolean, optional): Include archived notes
- `search` (string, optional): Search query to filter notes
- `notebookId` (string, optional): Filter notes by notebook ID
#### get_note
Get a specific note by ID.
**Parameters:**
- `id` (string, required): Note ID
#### update_note
Update an existing note.
**Parameters:**
- `id` (string, required): Note ID
- All other fields from create_note are optional
#### delete_note
Delete a note by ID.
**Parameters:**
- `id` (string, required): Note ID
#### search_notes
Search notes by query.
**Parameters:**
- `query` (string, required): Search query
- `notebookId` (string, optional): Filter search by notebook ID
#### get_labels
Get all unique labels from notes (legacy method).
**Parameters:** None
#### toggle_pin
Toggle pin status of a note.
**Parameters:**
- `id` (string, required): Note ID
#### toggle_archive
Toggle archive status of a note.
**Parameters:**
- `id` (string, required): Note ID
### Notebook Management
#### create_notebook
Create a new notebook.
**Parameters:**
- `name` (string, required): Notebook name
- `icon` (string, optional): Notebook icon (emoji)
- `color` (string, optional): Notebook color (hex code)
- `order` (number, optional): Notebook order
#### get_notebooks
Get all notebooks.
**Parameters:** None
#### get_notebook
Get a specific notebook by ID with its notes.
**Parameters:**
- `id` (string, required): Notebook ID
#### update_notebook
Update an existing notebook.
**Parameters:**
- `id` (string, required): Notebook ID
- `name` (string, optional): Notebook name
- `icon` (string, optional): Notebook icon
- `color` (string, optional): Notebook color
- `order` (number, optional): Notebook order
#### delete_notebook
Delete a notebook by ID.
**Parameters:**
- `id` (string, required): Notebook ID
### Label Management
#### create_label
Create a new label.
**Parameters:**
- `name` (string, required): Label name
- `color` (string, optional): Label color (red, orange, yellow, green, teal, blue, purple, pink, gray)
- `notebookId` (string, required): Notebook ID to associate the label with
#### get_labels_detailed
Get all labels with details.
**Parameters:**
- `notebookId` (string, optional): Filter labels by notebook ID
#### update_label
Update an existing label.
**Parameters:**
- `id` (string, required): Label ID
- `name` (string, optional): Label name
- `color` (string, optional): Label color
#### delete_label
Delete a label by ID.
**Parameters:**
- `id` (string, required): Label ID
## N8N Integration Example
### Create a note from email
```json
{
"tool": "create_note",
"arguments": {
"title": "{{ $json.subject }}",
"content": "{{ $json.body }}",
"labels": ["email", "inbox"],
"notebookId": "cuid123..."
}
}
```
### Search notes
```json
{
"tool": "search_notes",
"arguments": {
"query": "meeting",
"notebookId": "cuid123..."
}
}
```
### Create a notebook
```json
{
"tool": "create_notebook",
"arguments": {
"name": "Work Projects",
"icon": "💼",
"color": "#3B82F6"
}
}
```
## Database
The MCP server connects to the same SQLite database as the Keep Notes web app located at:
`D:/dev_new_pc/Keep/keep-notes/prisma/dev.db`
## Prisma Schema Reference
The MCP server works with the following Prisma models:
### Note Model
- id: String (CUID)
- title: String?
- content: String
- color: String (default: "default")
- isPinned: Boolean
- isArchived: Boolean
- type: String (default: "text")
- checkItems: String? (JSON)
- labels: String? (JSON)
- images: String? (JSON)
- links: String? (JSON)
- reminder: DateTime?
- isReminderDone: Boolean
- reminderRecurrence: String?
- reminderLocation: String?
- isMarkdown: Boolean
- size: String (default: "small")
- notebookId: String?
- userId: String?
- order: Int
- createdAt: DateTime
- updatedAt: DateTime
### Notebook Model
- id: String (CUID)
- name: String
- icon: String?
- color: String?
- order: Int
- userId: String
- createdAt: DateTime
- updatedAt: DateTime
### Label Model
- id: String (CUID)
- name: String
- color: String (default: "gray")
- notebookId: String?
- userId: String?
- createdAt: DateTime
- updatedAt: DateTime
## N8N Workflows
Ce serveur MCP est accompagné de 6 workflows N8N prêts à l'emploi pour une intégration complète:
1. **Create Note with Classification** - Création de notes avec classification automatique par IA
2. **Search & Summary** - Recherche et résumé intelligent de notes
3. **Notebook Manager** - Gestion complète des notebooks (CRUD)
4. **Reminder Notifications** - Automatisation des rappels avec notifications
5. **Label Manager** - Gestion des labels avec suggestion IA
6. **Email to Note** - Conversion automatique d'emails en notes
Pour plus de détails, consultez [N8N-WORKFLOWS.md](./N8N-WORKFLOWS.md)
### Importation des Workflows
Chaque workflow peut être importé directement dans N8N via le fichier JSON correspondant:
```bash
# Exemple: Importer le workflow de création de notes
# Ouvrir N8N → Import from File → Sélectionner n8n-workflow-create-note.json
```
## License
MIT