@chriscurrycc/memos-mcp 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,17 +14,18 @@ Enables AI assistants (Claude Code, Claude Desktop, Cursor, etc.) to read and wr
14
14
  - A running Memos instance
15
15
  - A Memos access token (Settings → Access Tokens)
16
16
 
17
- ### Claude Code
17
+ ### Environment Variables
18
18
 
19
- ```bash
20
- claude mcp add memos -- npx @chriscurrycc/memos-mcp
21
- ```
19
+ | Variable | Required | Description |
20
+ |----------|----------|-------------|
21
+ | `MEMOS_URL` | Yes | Your Memos instance URL |
22
+ | `MEMOS_TOKEN` | Yes | Memos access token |
23
+ | `MEMOS_DEFAULT_VISIBILITY` | No | Default visibility for new memos (`PRIVATE`, `PROTECTED`, `PUBLIC`). Defaults to `PRIVATE` |
22
24
 
23
- Then set environment variables:
25
+ ### Claude Code
24
26
 
25
27
  ```bash
26
- export MEMOS_URL=https://your-memos-instance.com
27
- export MEMOS_TOKEN=your-access-token
28
+ claude mcp add --scope user memos -e MEMOS_URL=https://your-memos-instance.com -e MEMOS_TOKEN=your-access-token -- npx -y @chriscurrycc/memos-mcp
28
29
  ```
29
30
 
30
31
  ### Claude Desktop
@@ -36,7 +37,7 @@ Add to your `claude_desktop_config.json`:
36
37
  "mcpServers": {
37
38
  "memos": {
38
39
  "command": "npx",
39
- "args": ["-y", "memos-mcp"],
40
+ "args": ["-y", "@chriscurrycc/memos-mcp"],
40
41
  "env": {
41
42
  "MEMOS_URL": "https://your-memos-instance.com",
42
43
  "MEMOS_TOKEN": "your-access-token"
@@ -48,14 +49,30 @@ Add to your `claude_desktop_config.json`:
48
49
 
49
50
  ### With 1Password (recommended)
50
51
 
51
- Use `op run` to inject the token securely — no plaintext secrets on disk:
52
+ Store your token securely in 1Password — no plaintext secrets on disk.
53
+
54
+ 1. Save the token to 1Password:
55
+
56
+ ```bash
57
+ op item create --category=apiCredential --title="memos-api" token=your-access-token "valid from[date]=2026-01-01" "expires[date]=2026-02-01"
58
+ ```
59
+
60
+ 2. Configure with `op run` to inject the token at runtime:
61
+
62
+ **Claude Code:**
63
+
64
+ ```bash
65
+ claude mcp add --scope user memos -e MEMOS_URL=https://your-memos-instance.com -e MEMOS_TOKEN=op://Personal/memos-api/token -- op run --no-masking -- npx -y @chriscurrycc/memos-mcp
66
+ ```
67
+
68
+ **Claude Desktop:**
52
69
 
53
70
  ```json
54
71
  {
55
72
  "mcpServers": {
56
73
  "memos": {
57
74
  "command": "op",
58
- "args": ["run", "--", "npx", "-y", "memos-mcp"],
75
+ "args": ["run", "--no-masking", "--", "npx", "-y", "@chriscurrycc/memos-mcp"],
59
76
  "env": {
60
77
  "MEMOS_URL": "https://your-memos-instance.com",
61
78
  "MEMOS_TOKEN": "op://Personal/memos-api/token"
@@ -71,71 +88,54 @@ Use `op run` to inject the token securely — no plaintext secrets on disk:
71
88
 
72
89
  | Tool | Description |
73
90
  |------|-------------|
74
- | `list_memos` | List memos with filtering and pagination |
75
- | `get_memo` | Get a single memo by ID |
76
- | `search_memos` | Search memos by keyword |
77
- | `create_memo` | Create a new memo |
78
- | `update_memo` | Update content, visibility, pin, or archive state |
91
+ | `list_memos` | Search and list memos with structured filters (keyword, tags, date range, visibility, pinned, content properties, etc.) |
92
+ | `get_memo` | Get a single memo by numeric ID or UID string |
93
+ | `create_memo` | Create a new memo with markdown content |
94
+ | `update_memo` | Update content, visibility, pin, archive state, with optional `preserveUpdateTime` |
79
95
  | `delete_memo` | Permanently delete a memo |
80
96
 
81
- ### Comments
82
-
83
- | Tool | Description |
84
- |------|-------------|
85
- | `list_memo_comments` | List comments on a memo |
86
- | `create_memo_comment` | Add a comment to a memo |
87
-
88
97
  ### Tags
89
98
 
90
99
  | Tool | Description |
91
100
  |------|-------------|
92
- | `list_pinned_tags` | List all pinned tags |
93
- | `list_tags_with_emoji` | List tags with their emojis |
94
- | `update_tag` | Update a tag's emoji or pinned status |
101
+ | `list_tags` | List tags with usage counts, hierarchy support, and pinned/emoji metadata |
102
+ | `update_tag` | Update a tag's pinned status or emoji |
103
+ | `rename_tag` | Rename a tag across all memos |
95
104
 
96
105
  ### Resources
97
106
 
98
107
  | Tool | Description |
99
108
  |------|-------------|
100
109
  | `list_resources` | List all resources (attachments) |
101
- | `get_resource` | Get a resource by ID |
110
+ | `upload_resource` | Upload a file (base64 encoded), with optional memo linking |
102
111
  | `delete_resource` | Delete a resource |
103
- | `link_resource_to_memo` | Link resources to a memo |
104
112
 
105
113
  ### Relations
106
114
 
107
115
  | Tool | Description |
108
116
  |------|-------------|
109
- | `list_memo_relations` | List memo relations |
110
- | `set_memo_relations` | Set relations (replaces all) |
111
- | `delete_memo_relation` | Remove a specific relation |
112
-
113
- ### Reactions
114
-
115
- | Tool | Description |
116
- |------|-------------|
117
- | `list_reactions` | List reactions on a memo |
118
- | `upsert_reaction` | Add a reaction emoji |
119
- | `delete_reaction` | Remove a reaction |
117
+ | `list_memo_relations` | List memo relations with recursive graph traversal (depth 1-5) |
118
+ | `set_memo_relations` | Add or remove REFERENCE relations between memos |
120
119
 
121
- ### Review (Spaced Repetition)
120
+ ### Review
122
121
 
123
122
  | Tool | Description |
124
123
  |------|-------------|
125
- | `list_review_memos` | Get memos due for review |
126
- | `get_random_memo` | Get a random memo |
127
- | `list_on_this_day_memos` | Memos created on this day in past years |
128
- | `get_time_travel_memos` | Memos from a random time period |
129
- | `record_review` | Record that memos have been reviewed |
130
- | `get_review_stats` | Get review statistics |
124
+ | `get_review_memos` | Get today's spaced-repetition review batch |
125
+ | `complete_review` | Mark the current review batch as completed |
126
+ | `get_on_this_day_memos` | Get memos created on this day in previous years, grouped by year |
127
+ | `update_review_setting` | Update review preferences (batch size, tag filters) |
131
128
 
132
129
  ## Prompts
133
130
 
134
131
  | Prompt | Description |
135
132
  |--------|-------------|
136
133
  | `capture` | Quick-save a thought as a memo |
137
- | `review` | Start a guided review session |
138
- | `daily_digest` | Summarize recent memo activity |
134
+ | `review` | Start a guided spaced-repetition review session |
135
+ | `on_this_day` | See memos from this day in previous years |
136
+ | `digest` | Summarize memo activity for a time period (today/week/month) |
137
+ | `tag_overview` | Review your tag system and organization |
138
+ | `relation_graph` | Explore the relation graph starting from a memo |
139
139
 
140
140
  ## Resources
141
141
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,SAoFhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,SA2KhD,CAAC"}
@@ -1,9 +1,12 @@
1
1
  import { z } from "zod";
2
2
  export const registerPrompts = (server) => {
3
- server.prompt("capture", "Quick-save a thought as a memo", {
4
- content: z.string().describe("The thought or note to capture"),
5
- tags: z.string().optional().describe("Comma-separated tags to add, e.g. 'idea,project'"),
6
- visibility: z.enum(["PRIVATE", "PROTECTED", "PUBLIC"]).default("PRIVATE").describe("Memo visibility"),
3
+ server.registerPrompt("capture", {
4
+ description: "Quick-save a thought as a memo",
5
+ argsSchema: {
6
+ content: z.string().describe("The thought or note to capture"),
7
+ tags: z.string().optional().describe("Comma-separated tags to add, e.g. 'idea,project'"),
8
+ visibility: z.enum(["PRIVATE", "PROTECTED", "PUBLIC"]).default("PRIVATE").describe("Memo visibility"),
9
+ },
7
10
  }, ({ content, tags, visibility }) => {
8
11
  let memoContent = content;
9
12
  if (tags) {
@@ -25,46 +28,118 @@ export const registerPrompts = (server) => {
25
28
  ],
26
29
  };
27
30
  });
28
- server.prompt("review", "Start a guided memo review session", {}, () => {
29
- return {
30
- messages: [
31
- {
32
- role: "user",
33
- content: {
34
- type: "text",
35
- text: `Start a memo review session:
36
- 1. Call list_review_memos to get memos due for review
37
- 2. If the session is already completed, let me know
38
- 3. Otherwise, present each memo one by one with its content
39
- 4. After presenting all memos, ask if I want to record the review
40
- 5. If yes, call record_review with the memo IDs and source REVIEW_SOURCE_REVIEW
41
- 6. Finally, show the updated review stats using get_review_stats`,
42
- },
31
+ server.registerPrompt("review", {
32
+ description: "Start a spaced-repetition review session (间隔回顾)",
33
+ }, () => ({
34
+ messages: [
35
+ {
36
+ role: "user",
37
+ content: {
38
+ type: "text",
39
+ text: `Start a memo review session:
40
+ 1. Call get_review_memos to get today's review batch
41
+ 2. If completed=true, let me know today's review is done and ask if I want to load a new batch (refresh=true)
42
+ 3. Otherwise, use get_memo to fetch full content for each memo and present them one by one
43
+ 4. After presenting all memos, call complete_review with the memo IDs to mark the batch as completed
44
+ 5. Congratulate me on completing the review`,
43
45
  },
44
- ],
46
+ },
47
+ ],
48
+ }));
49
+ server.registerPrompt("on_this_day", {
50
+ description: "See memos from this day in previous years (历史上的今天)",
51
+ }, () => ({
52
+ messages: [
53
+ {
54
+ role: "user",
55
+ content: {
56
+ type: "text",
57
+ text: `Show me my "On This Day" memories:
58
+ 1. Call get_on_this_day_memos to get memos from this day in previous years
59
+ 2. Present them grouped by year, starting from the most recent
60
+ 3. For each memo, use get_memo to show the full content
61
+ 4. Add a brief reflection on how my thoughts or interests have evolved over the years`,
62
+ },
63
+ },
64
+ ],
65
+ }));
66
+ server.registerPrompt("digest", {
67
+ description: "Summarize memo activity for a time period",
68
+ argsSchema: {
69
+ period: z.enum(["today", "week", "month"]).default("week").describe("Time period to summarize"),
70
+ },
71
+ }, ({ period }) => {
72
+ const periodMap = {
73
+ today: { days: 1, label: "today" },
74
+ week: { days: 7, label: "the past week" },
75
+ month: { days: 30, label: "the past month" },
45
76
  };
46
- });
47
- server.prompt("daily_digest", "Summarize recent memo activity", {}, () => {
77
+ const { days, label } = periodMap[period];
48
78
  return {
49
79
  messages: [
50
80
  {
51
81
  role: "user",
52
82
  content: {
53
83
  type: "text",
54
- text: `Create a daily digest of my memos:
55
- 1. Call list_memos with pageSize 50 to get recent memos
56
- 2. Call list_pinned_tags to see my important tags
84
+ text: `Create a digest of my memo activity for ${label}:
85
+ 1. Call list_memos with startDate set to ${days} days ago, pageSize=100 to get recent memos
86
+ 2. Call list_tags to see tag usage patterns
57
87
  3. Summarize:
58
- - How many memos were created/updated recently
59
- - Key themes and topics based on tags
88
+ - Total number of memos created/updated in this period
89
+ - Key themes and topics based on tags and content
60
90
  - Any pinned memos that might need attention
61
- - Any memos with incomplete tasks (if visible in properties)
62
- 4. Check list_on_this_day_memos for any "on this day" memories
63
- 5. Present everything in a concise daily briefing format`,
91
+ - Any memos with incomplete tasks (call list_memos with hasIncompleteTasks=true)
92
+ - Trends or patterns you notice
93
+ 4. Present as a concise briefing`,
64
94
  },
65
95
  },
66
96
  ],
67
97
  };
68
98
  });
99
+ server.registerPrompt("tag_overview", {
100
+ description: "Review your tag system and organization",
101
+ }, () => ({
102
+ messages: [
103
+ {
104
+ role: "user",
105
+ content: {
106
+ type: "text",
107
+ text: `Give me an overview of my tag system:
108
+ 1. Call list_tags to get all top-level tags with counts
109
+ 2. For tags with children (hasChildren=true), call list_tags with parent param to show the hierarchy
110
+ 3. Call list_tags with pinnedOnly=true to highlight my pinned tags
111
+ 4. Analyze and present:
112
+ - Tag hierarchy structure
113
+ - Most used vs rarely used tags
114
+ - Pinned tags and their usage
115
+ - Suggestions for cleanup (similar tags that could be merged, unused tags, etc.)`,
116
+ },
117
+ },
118
+ ],
119
+ }));
120
+ server.registerPrompt("relation_graph", {
121
+ description: "Explore the relation graph starting from a memo (关系图谱)",
122
+ argsSchema: {
123
+ memo: z.string().describe("Memo ID or UID to start from"),
124
+ },
125
+ }, ({ memo }) => ({
126
+ messages: [
127
+ {
128
+ role: "user",
129
+ content: {
130
+ type: "text",
131
+ text: `Explore the relation graph starting from memo ${memo}:
132
+ 1. Call get_memo to show the starting memo's content
133
+ 2. Call list_memo_relations with id="${memo}" and depth=5 to get the full relation graph
134
+ 3. For each connected memo, call get_memo to understand its content
135
+ 4. Present:
136
+ - A text-based visualization of the graph structure (which memos reference which)
137
+ - Brief summary of each connected memo
138
+ - The themes and topics that connect these memos
139
+ - Any interesting patterns or clusters in the graph`,
140
+ },
141
+ },
142
+ ],
143
+ }));
69
144
  };
70
145
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAiB,EAAE,EAAE;IACnD,MAAM,CAAC,MAAM,CACX,SAAS,EACT,gCAAgC,EAChC;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QAC9D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QACxF,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KACtG,EACD,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;QAChC,IAAI,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,OAAO,GAAG,IAAI;iBACjB,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;iBAC1B,IAAI,CAAC,GAAG,CAAC,CAAC;YACb,WAAW,GAAG,GAAG,WAAW,OAAO,OAAO,EAAE,CAAC;QAC/C,CAAC;QACD,OAA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C,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;SAC1D;KACF,EACD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,iDAAiD,IAAI;;uCAEhC,IAAI;;;;;;uDAMY;iBAC5C;aACF;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,EAAE,QAAQ,WAAW,SAuCvE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,EAAE,QAAQ,WAAW,SAsCvE,CAAC"}
@@ -1,18 +1,17 @@
1
1
  export const registerResources = (server, client) => {
2
- server.resource("memo", "memo://memos/{uid}", { description: "A memo by its UID", mimeType: "text/markdown" }, async (uri) => {
2
+ server.registerResource("memo", "memo://memos/{uid}", { description: "A memo by its UID", mimeType: "text/markdown" }, async (uri) => {
3
3
  const uid = uri.pathname.split("/").pop();
4
4
  if (!uid) {
5
5
  throw new Error("Invalid memo URI: missing UID");
6
6
  }
7
7
  const memo = await client.get(`/api/v1/memos:by-uid/${uid}`);
8
- // Format as markdown with YAML frontmatter
8
+ const id = memo.name?.match(/^memos\/(\d+)$/)?.[1];
9
9
  const frontmatter = [
10
10
  "---",
11
+ id ? `id: ${id}` : null,
11
12
  `uid: ${memo.uid}`,
12
- `name: ${memo.name}`,
13
- `creator: ${memo.creator}`,
14
13
  `visibility: ${memo.visibility}`,
15
- `pinned: ${memo.pinned}`,
14
+ memo.pinned ? `pinned: true` : null,
16
15
  `created: ${memo.createTime}`,
17
16
  `updated: ${memo.updateTime}`,
18
17
  memo.tags?.length ? `tags: [${memo.tags.join(", ")}]` : null,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAiB,EAAE,MAAmB,EAAE,EAAE;IAC1E,MAAM,CAAC,QAAQ,CACb,MAAM,EACN,oBAAoB,EACpB,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,EAC/D,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAO,wBAAwB,GAAG,EAAE,CAAC,CAAC;QAEnE,2CAA2C;QAC3C,MAAM,WAAW,GAAG;YAClB,KAAK;YACL,QAAQ,IAAI,CAAC,GAAG,EAAE;YAClB,SAAS,IAAI,CAAC,IAAI,EAAE;YACpB,YAAY,IAAI,CAAC,OAAO,EAAE;YAC1B,eAAe,IAAI,CAAC,UAAU,EAAE;YAChC,WAAW,IAAI,CAAC,MAAM,EAAE;YACxB,YAAY,IAAI,CAAC,UAAU,EAAE;YAC7B,YAAY,IAAI,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,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,IAAI,CAAC,UAAU,EAAE;YAChC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;YACnC,YAAY,IAAI,CAAC,UAAU,EAAE;YAC7B,YAAY,IAAI,CAAC,UAAU,EAAE;YAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;YAC5D,KAAK;SACN;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,OAAO;YACL,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,GAAG,CAAC,IAAI;oBACb,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE,GAAG,WAAW,OAAO,IAAI,CAAC,OAAO,EAAE;iBAC1C;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYpE,eAAO,MAAM,YAAY,iBAoCxB,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAapE,eAAO,MAAM,YAAY,iBAqCxB,CAAC"}
package/dist/server.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { MemosClient } from "./client.js";
3
3
  import { registerMemoTools } from "./tools/memos.js";
4
- import { registerCommentTools } from "./tools/comments.js";
5
4
  import { registerTagTools } from "./tools/tags.js";
6
5
  import { registerResourceTools } from "./tools/resources.js";
7
6
  import { registerRelationTools } from "./tools/relations.js";
8
- import { registerReactionTools } from "./tools/reactions.js";
9
7
  import { registerReviewTools } from "./tools/review.js";
10
8
  import { registerPrompts } from "./prompts/index.js";
11
9
  import { registerResources } from "./resources/index.js";
10
+ const VALID_VISIBILITIES = ["PRIVATE", "PROTECTED", "PUBLIC"];
12
11
  export const createServer = () => {
13
12
  const memosUrl = process.env.MEMOS_URL;
14
13
  const memosToken = process.env.MEMOS_TOKEN;
@@ -20,22 +19,22 @@ export const createServer = () => {
20
19
  console.error("Error: MEMOS_TOKEN environment variable is required");
21
20
  process.exit(1);
22
21
  }
22
+ const rawVisibility = process.env.MEMOS_DEFAULT_VISIBILITY?.toUpperCase();
23
+ const defaultVisibility = rawVisibility && VALID_VISIBILITIES.includes(rawVisibility)
24
+ ? rawVisibility
25
+ : "PRIVATE";
23
26
  const client = new MemosClient(memosUrl, memosToken);
24
27
  const server = new McpServer({
25
28
  name: "memos-mcp",
26
- version: "0.1.1",
29
+ version: "1.0.0",
27
30
  });
28
- // Register all tools
29
- registerMemoTools(server, client);
30
- registerCommentTools(server, client);
31
+ registerMemoTools(server, client, { defaultVisibility });
31
32
  registerTagTools(server, client);
32
33
  registerResourceTools(server, client);
33
34
  registerRelationTools(server, client);
34
- registerReactionTools(server, client);
35
35
  registerReviewTools(server, client);
36
- // Register prompts
37
36
  registerPrompts(server);
38
- // Register resources
37
+ // Register MCP resources
39
38
  registerResources(server, client);
40
39
  return server;
41
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,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,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,WAAW,EAAE,CAAC;IAC1E,MAAM,iBAAiB,GACrB,aAAa,IAAI,kBAAkB,CAAC,QAAQ,CAAC,aAA2B,CAAC;QACvE,CAAC,CAAE,aAA4B;QAC/B,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACzD,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,yBAAyB;IACzB,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,4 +1,9 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { MemosClient } from "../client.js";
3
- export declare const registerMemoTools: (server: McpServer, client: MemosClient) => void;
3
+ type Visibility = "PRIVATE" | "PROTECTED" | "PUBLIC";
4
+ interface MemoToolsOptions {
5
+ defaultVisibility: Visibility;
6
+ }
7
+ export declare const registerMemoTools: (server: McpServer, client: MemosClient, options: MemoToolsOptions) => void;
8
+ export {};
4
9
  //# sourceMappingURL=memos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memos.d.ts","sourceRoot":"","sources":["../../src/tools/memos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,EAAE,QAAQ,WAAW,SA0HvE,CAAC"}
1
+ {"version":3,"file":"memos.d.ts","sourceRoot":"","sources":["../../src/tools/memos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,KAAK,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAsFrD,UAAU,gBAAgB;IACxB,iBAAiB,EAAE,UAAU,CAAC;CAC/B;AAED,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,SAAS,EACjB,QAAQ,WAAW,EACnB,SAAS,gBAAgB,SA+J1B,CAAC"}