Files
Momento/mcp-server/N8N-EXAMPLES.md
Antigravity a139f92686
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 16s
feat(mcp): update server with hierarchy support, batch operations, and tree view
2026-05-10 19:12:55 +00:00

622 lines
10 KiB
Markdown

# N8N Examples — Memento MCP Server
Practical, copy-paste-ready N8N workflow snippets for every Memento MCP tool.
All examples assume an MCP Client node configured with Streamable HTTP and `x-api-key` authentication.
## Note Types
| `type` value | Description |
|--------------|-------------|
| `richtext` | Rich text editor — **default** |
| `markdown` | Markdown rendered (preferred over deprecated `isMarkdown`) |
| `text` | Plain text |
| `checklist` | Interactive checklist with `checkItems` |
> **Note**: `isMarkdown: true` is deprecated. Use `"type": "markdown"` instead.
---
## Notes
### Create a simple text note
```json
{
"tool": "create_note",
"arguments": {
"title": "Quick idea",
"content": "Explore serverless architecture for the new API gateway.",
"color": "yellow",
"labels": ["idea", "architecture"]
}
}
```
### Create a pinned markdown note
```json
{
"tool": "create_note",
"arguments": {
"title": "Project README",
"content": "# My Project\n\nThis is the main documentation.\n\n## Getting Started\n\n```bash\nnpm install\nnpm run dev\n```",
"isMarkdown": true,
"isPinned": true,
"color": "blue",
"size": "large"
}
}
```
### Create a checklist note
```json
{
"tool": "create_note",
"arguments": {
"title": "Weekly tasks",
"content": "Tasks for this week",
"type": "checklist",
"checkItems": [
{ "id": "1", "text": "Review pull requests", "checked": false },
{ "id": "2", "text": "Update deployment docs", "checked": false },
{ "id": "3", "text": "Team standup notes", "checked": true }
],
"color": "teal"
}
}
```
### Create a note with a reminder
```json
{
"tool": "create_note",
"arguments": {
"title": "Dentist appointment",
"content": "Dr. Martin — 10:30 AM. Bring insurance card.",
"reminder": "2025-06-15T10:00:00.000Z",
"reminderRecurrence": "yearly",
"color": "red",
"labels": ["health", "personal"]
}
}
```
### Create a note in a specific notebook
```json
{
"tool": "create_note",
"arguments": {
"title": "Sprint planning notes",
"content": "**Goal**: Ship user authentication by Friday.\n\n- Design review at 2PM\n- Backend API ready by Wednesday",
"isMarkdown": true,
"notebookId": "{{ $json.notebookId }}",
"labels": ["sprint", "planning"],
"color": "purple"
}
}
```
### Create a note with external links
```json
{
"tool": "create_note",
"arguments": {
"title": "Research resources",
"content": "Curated links for the ML paper review.",
"links": [
"https://arxiv.org/abs/2304.15004",
"https://huggingface.co/papers",
"https://paperswithcode.com"
],
"labels": ["research", "ml"],
"color": "green"
}
}
```
### Get all notes (lightweight)
```json
{
"tool": "get_notes",
"arguments": {
"limit": 50
}
}
```
### Get notes from a specific notebook
```json
{
"tool": "get_notes",
"arguments": {
"notebookId": "{{ $json.notebookId }}",
"limit": 100
}
}
```
### Get unfiled notes (Inbox)
```json
{
"tool": "get_notes",
"arguments": {
"notebookId": "inbox",
"limit": 50
}
}
```
### Get all notes including archived
```json
{
"tool": "get_notes",
"arguments": {
"includeArchived": true,
"limit": 200,
"fullDetails": true
}
}
```
### Get a single note by ID
```json
{
"tool": "get_note",
"arguments": {
"id": "{{ $json.noteId }}"
}
}
```
### Search notes by keyword
```json
{
"tool": "search_notes",
"arguments": {
"query": "deployment kubernetes"
}
}
```
### Search in a specific notebook
```json
{
"tool": "search_notes",
"arguments": {
"query": "{{ $json.searchTerm }}",
"notebookId": "{{ $json.notebookId }}",
"includeArchived": false
}
}
```
### Update a note's content
```json
{
"tool": "update_note",
"arguments": {
"id": "{{ $json.noteId }}",
"content": "{{ $json.newContent }}",
"color": "green"
}
}
```
### Mark a checklist item as done
```json
{
"tool": "update_note",
"arguments": {
"id": "{{ $json.noteId }}",
"checkItems": [
{ "id": "1", "text": "Review pull requests", "checked": true },
{ "id": "2", "text": "Update deployment docs", "checked": false }
]
}
}
```
### Add labels to an existing note
```json
{
"tool": "update_note",
"arguments": {
"id": "{{ $json.noteId }}",
"labels": ["ai-generated", "reviewed", "{{ $json.category }}"]
}
}
```
### Mark a reminder as done
```json
{
"tool": "update_note",
"arguments": {
"id": "{{ $json.noteId }}",
"isReminderDone": true
}
}
```
### Move a note to a notebook
```json
{
"tool": "move_note",
"arguments": {
"id": "{{ $json.noteId }}",
"notebookId": "{{ $json.targetNotebookId }}"
}
}
```
### Move a note to Inbox (no notebook)
```json
{
"tool": "move_note",
"arguments": {
"id": "{{ $json.noteId }}",
"notebookId": null
}
}
```
### Pin a note
```json
{
"tool": "toggle_pin",
"arguments": {
"id": "{{ $json.noteId }}"
}
}
```
### Archive a note
```json
{
"tool": "toggle_archive",
"arguments": {
"id": "{{ $json.noteId }}"
}
}
```
### Delete a note permanently
```json
{
"tool": "delete_note",
"arguments": {
"id": "{{ $json.noteId }}"
}
}
```
### Export all notes as JSON backup
```json
{
"tool": "export_notes",
"arguments": {}
}
```
### Import notes from a JSON backup
```json
{
"tool": "import_notes",
"arguments": {
"data": "{{ $json.exportPayload }}"
}
}
```
---
## Notebooks
### Create a notebook
```json
{
"tool": "create_notebook",
"arguments": {
"name": "Work Projects",
"icon": "💼",
"color": "#3B82F6"
}
}
```
### Create a notebook for a team/topic
```json
{
"tool": "create_notebook",
"arguments": {
"name": "Machine Learning Research",
"icon": "🤖",
"color": "#8B5CF6"
}
}
```
### List all notebooks
```json
{
"tool": "get_notebooks",
"arguments": {}
}
```
### Get a notebook with its notes
```json
{
"tool": "get_notebook",
"arguments": {
"id": "{{ $json.notebookId }}"
}
}
```
### Rename a notebook
```json
{
"tool": "update_notebook",
"arguments": {
"id": "{{ $json.notebookId }}",
"name": "Q3 2025 Projects",
"color": "#10B981"
}
}
```
### Reorder notebooks
```json
{
"tool": "reorder_notebooks",
"arguments": {
"notebookIds": [
"{{ $json.ids[0] }}",
"{{ $json.ids[1] }}",
"{{ $json.ids[2] }}"
]
}
}
```
### Create a sub-notebook (hierarchical)
```json
{
"tool": "create_notebook",
"arguments": {
"name": "Project Alpha",
"icon": "🚀",
"color": "#10B981",
"parentId": "{{ $json.parentNotebookId }}"
}
}
```
### Get notebook hierarchy (tree view)
```json
{
"tool": "get_notebook_hierarchy",
"arguments": {}
}
```
### Delete a notebook (notes go to Inbox)
```json
{
"tool": "delete_notebook",
"arguments": {
"id": "{{ $json.notebookId }}"
}
}
```
---
## Batch Operations
### Batch move notes to a notebook
```json
{
"tool": "batch_move_notes",
"arguments": {
"ids": ["{{ $json.noteId1 }}", "{{ $json.noteId2 }}", "{{ $json.noteId3 }}"],
"notebookId": "{{ $json.targetNotebookId }}"
}
}
```
### Batch delete notes
```json
{
"tool": "batch_delete_notes",
"arguments": {
"ids": ["{{ $json.noteId1 }}", "{{ $json.noteId2 }}"]
}
}
```
---
## Labels
### Create a label inside a notebook
```json
{
"tool": "create_label",
"arguments": {
"name": "urgent",
"color": "red",
"notebookId": "{{ $json.notebookId }}"
}
}
```
### Create common project labels
```json
{
"tool": "create_label",
"arguments": {
"name": "in-progress",
"color": "orange",
"notebookId": "{{ $json.notebookId }}"
}
}
```
```json
{
"tool": "create_label",
"arguments": {
"name": "done",
"color": "green",
"notebookId": "{{ $json.notebookId }}"
}
}
```
### List labels in a notebook
```json
{
"tool": "get_labels",
"arguments": {
"notebookId": "{{ $json.notebookId }}"
}
}
```
### List all labels (global)
```json
{
"tool": "get_labels",
"arguments": {}
}
```
### Rename a label
```json
{
"tool": "update_label",
"arguments": {
"id": "{{ $json.labelId }}",
"name": "high-priority",
"color": "red"
}
}
```
### Delete a label
```json
{
"tool": "delete_label",
"arguments": {
"id": "{{ $json.labelId }}"
}
}
```
---
## Reminders
### Get all due reminders (for cron automation)
```json
{
"tool": "get_due_reminders",
"arguments": {}
}
```
> **Tip**: Schedule this every 30 minutes with a cron trigger (`0 */30 * * * *`), then loop over results and send notifications via Slack, Telegram, or email.
---
## Common Workflow Patterns
### Pattern: Email → Note
1. **Email Trigger (IMAP)** — fires on new email
2. **MCP Client**`create_note`
```json
{
"title": "{{ $json.subject }}",
"content": "**From**: {{ $json.from }}\n\n{{ $json.text }}",
"labels": ["email"],
"color": "blue",
"isMarkdown": true
}
```
### Pattern: Reminder Notifications
1. **Schedule Trigger** — every 30 minutes
2. **MCP Client** → `get_due_reminders`
3. **IF** — results not empty
4. **Loop over items** → send Slack/Telegram message per reminder
5. **MCP Client** → `update_note` with `isReminderDone: true`
### Pattern: AI Summarization
1. **MCP Client** → `search_notes` with a topic query
2. **OpenAI / Anthropic node** — summarize the returned notes
3. **MCP Client** → `create_note` with the summary as content, labeled `ai-summary`
### Pattern: Daily Digest
1. **Schedule Trigger** — every day at 8 AM
2. **MCP Client** → `get_notes` with `limit: 20` (most recent)
3. **AI node** — generate a brief digest
4. **Email / Slack node** — send the digest
5. *(Optional)* **MCP Client** → `create_note` to archive the digest
### Pattern: Webhook → Structured Note
1. **Webhook Trigger** — receives JSON payload (e.g., from a form or CI/CD pipeline)
2. **Code node** — format the payload into markdown
3. **MCP Client** → `create_note`
```json
{
"title": "Build #{{ $json.buildNumber }} — {{ $json.status }}",
"content": "{{ $node['Code'].json.markdown }}",
"isMarkdown": true,
"color": "{{ $json.status === 'success' ? 'green' : 'red' }}",
"labels": ["ci-cd", "{{ $json.repo }}"]
}
```