@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 +47 -47
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +105 -30
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +4 -5
- package/dist/resources/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -9
- package/dist/server.js.map +1 -1
- package/dist/tools/memos.d.ts +6 -1
- package/dist/tools/memos.d.ts.map +1 -1
- package/dist/tools/memos.js +165 -54
- package/dist/tools/memos.js.map +1 -1
- package/dist/tools/relations.d.ts.map +1 -1
- package/dist/tools/relations.js +116 -31
- package/dist/tools/relations.js.map +1 -1
- package/dist/tools/resources.d.ts.map +1 -1
- package/dist/tools/resources.js +78 -17
- package/dist/tools/resources.js.map +1 -1
- package/dist/tools/review.d.ts.map +1 -1
- package/dist/tools/review.js +81 -52
- package/dist/tools/review.js.map +1 -1
- package/dist/tools/tags.d.ts.map +1 -1
- package/dist/tools/tags.js +136 -13
- package/dist/tools/tags.js.map +1 -1
- package/dist/tools/utils.d.ts +4 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +34 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
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
|
-
###
|
|
17
|
+
### Environment Variables
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
+
### Claude Code
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
|
|
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
|
-
|
|
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` |
|
|
75
|
-
| `get_memo` | Get a single memo by ID |
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
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
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
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
|
-
| `
|
|
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` |
|
|
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
|
|
120
|
+
### Review
|
|
122
121
|
|
|
123
122
|
| Tool | Description |
|
|
124
123
|
|------|-------------|
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
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
|
-
| `
|
|
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,
|
|
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"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const registerPrompts = (server) => {
|
|
3
|
-
server.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
55
|
-
1. Call list_memos with
|
|
56
|
-
2. Call
|
|
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
|
-
-
|
|
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 (
|
|
62
|
-
|
|
63
|
-
|
|
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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|
+
{"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"}
|
package/dist/resources/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
export const registerResources = (server, client) => {
|
|
2
|
-
server.
|
|
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
|
-
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot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;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"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,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.
|
|
29
|
+
version: "1.0.0",
|
|
27
30
|
});
|
|
28
|
-
|
|
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
|
};
|
package/dist/server.js.map
CHANGED
|
@@ -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,
|
|
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,MA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AAW;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"}
|
package/dist/tools/memos.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { MemosClient } from "../client.js";
|
|
3
|
-
|
|
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;
|
|
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"}
|