@laomeifun/my-anki-mcp 0.11.0 → 0.11.2
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/LICENSE +7 -7
- package/README.md +760 -782
- package/bin/ankimcp.js +12 -12
- package/dist/cli.js +57 -57
- package/dist/mcp/primitives/essential/prompts/review-session.prompt.js +66 -66
- package/dist/mcp/primitives/essential/prompts/twenty-rules.prompt/content.md +195 -195
- package/dist/mcp/primitives/essential/tools/add-note.tool.js +14 -4
- package/dist/mcp/primitives/essential/tools/add-note.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/add-notes.tool.js +19 -5
- package/dist/mcp/primitives/essential/tools/add-notes.tool.js.map +1 -1
- package/dist/mcp/primitives/essential/tools/mediaActions/mediaActions.tool.js +6 -6
- package/dist/mcp/primitives/essential/tools/tagActions/tagActions.tool.js +7 -7
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +183 -183
package/bin/ankimcp.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Check if --stdio flag is present
|
|
4
|
-
const isStdioMode = process.argv.includes('--stdio');
|
|
5
|
-
|
|
6
|
-
if (isStdioMode) {
|
|
7
|
-
// STDIO mode - for MCP clients like Cursor, Cline, Zed, etc.
|
|
8
|
-
require('../dist/main-stdio.js');
|
|
9
|
-
} else {
|
|
10
|
-
// HTTP mode (default) - for web-based AI assistants
|
|
11
|
-
require('../dist/main-http.js');
|
|
12
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Check if --stdio flag is present
|
|
4
|
+
const isStdioMode = process.argv.includes('--stdio');
|
|
5
|
+
|
|
6
|
+
if (isStdioMode) {
|
|
7
|
+
// STDIO mode - for MCP clients like Cursor, Cline, Zed, etc.
|
|
8
|
+
require('../dist/main-stdio.js');
|
|
9
|
+
} else {
|
|
10
|
+
// HTTP mode (default) - for web-based AI assistants
|
|
11
|
+
require('../dist/main-http.js');
|
|
12
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -35,40 +35,40 @@ function parseCliArgs() {
|
|
|
35
35
|
.option("-h, --host <address>", "Host to bind to (HTTP mode)", "127.0.0.1")
|
|
36
36
|
.option("-a, --anki-connect <url>", "AnkiConnect URL", "http://localhost:8765")
|
|
37
37
|
.option("--ngrok", "Start ngrok tunnel (requires global ngrok installation)")
|
|
38
|
-
.addHelpText("after", `
|
|
39
|
-
Transport Modes:
|
|
40
|
-
HTTP Mode (default): For web-based AI assistants (ChatGPT, Claude.ai)
|
|
41
|
-
STDIO Mode: For desktop MCP clients (Cursor, Cline, Zed)
|
|
42
|
-
|
|
43
|
-
Examples - HTTP Mode:
|
|
44
|
-
$ ankimcp # Use defaults
|
|
45
|
-
$ ankimcp --port 8080 # Custom port
|
|
46
|
-
$ ankimcp --host 0.0.0.0 --port 3000 # Listen on all interfaces
|
|
47
|
-
$ ankimcp --anki-connect http://localhost:8765
|
|
48
|
-
|
|
49
|
-
Examples - HTTP Mode with Ngrok:
|
|
50
|
-
$ ankimcp --ngrok # Start with ngrok tunnel
|
|
51
|
-
$ ankimcp --port 8080 --ngrok # Custom port + ngrok
|
|
52
|
-
$ ankimcp --host 0.0.0.0 --ngrok # Public host + ngrok
|
|
53
|
-
|
|
54
|
-
Examples - STDIO Mode:
|
|
55
|
-
$ ankimcp --stdio # For use with npx in MCP clients
|
|
56
|
-
|
|
57
|
-
# MCP client configuration (Cursor, Cline, Zed, etc.):
|
|
58
|
-
{
|
|
59
|
-
"mcpServers": {
|
|
60
|
-
"anki-mcp": {
|
|
61
|
-
"command": "npx",
|
|
62
|
-
"args": ["-y", "ankimcp", "--stdio"]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
Ngrok Setup (one-time):
|
|
68
|
-
1. Install: npm install -g ngrok
|
|
69
|
-
2. Get auth token from: https://dashboard.ngrok.com/get-started/your-authtoken
|
|
70
|
-
3. Setup: ngrok config add-authtoken <your-token>
|
|
71
|
-
4. Run: ankimcp --ngrok
|
|
38
|
+
.addHelpText("after", `
|
|
39
|
+
Transport Modes:
|
|
40
|
+
HTTP Mode (default): For web-based AI assistants (ChatGPT, Claude.ai)
|
|
41
|
+
STDIO Mode: For desktop MCP clients (Cursor, Cline, Zed)
|
|
42
|
+
|
|
43
|
+
Examples - HTTP Mode:
|
|
44
|
+
$ ankimcp # Use defaults
|
|
45
|
+
$ ankimcp --port 8080 # Custom port
|
|
46
|
+
$ ankimcp --host 0.0.0.0 --port 3000 # Listen on all interfaces
|
|
47
|
+
$ ankimcp --anki-connect http://localhost:8765
|
|
48
|
+
|
|
49
|
+
Examples - HTTP Mode with Ngrok:
|
|
50
|
+
$ ankimcp --ngrok # Start with ngrok tunnel
|
|
51
|
+
$ ankimcp --port 8080 --ngrok # Custom port + ngrok
|
|
52
|
+
$ ankimcp --host 0.0.0.0 --ngrok # Public host + ngrok
|
|
53
|
+
|
|
54
|
+
Examples - STDIO Mode:
|
|
55
|
+
$ ankimcp --stdio # For use with npx in MCP clients
|
|
56
|
+
|
|
57
|
+
# MCP client configuration (Cursor, Cline, Zed, etc.):
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"anki-mcp": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["-y", "ankimcp", "--stdio"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
Ngrok Setup (one-time):
|
|
68
|
+
1. Install: npm install -g ngrok
|
|
69
|
+
2. Get auth token from: https://dashboard.ngrok.com/get-started/your-authtoken
|
|
70
|
+
3. Setup: ngrok config add-authtoken <your-token>
|
|
71
|
+
4. Run: ankimcp --ngrok
|
|
72
72
|
`);
|
|
73
73
|
program.parse();
|
|
74
74
|
const options = program.opts();
|
|
@@ -84,31 +84,31 @@ function displayStartupBanner(options, ngrokUrl) {
|
|
|
84
84
|
const title = `AnkiMCP HTTP Server v${version}`;
|
|
85
85
|
const padding = Math.floor((64 - title.length) / 2);
|
|
86
86
|
const paddedTitle = " ".repeat(padding) + title + " ".repeat(64 - padding - title.length);
|
|
87
|
-
console.log(`
|
|
88
|
-
╔════════════════════════════════════════════════════════════════╗
|
|
89
|
-
║${paddedTitle}║
|
|
90
|
-
╚════════════════════════════════════════════════════════════════╝
|
|
91
|
-
|
|
92
|
-
🚀 Server running on: http://${options.host}:${options.port}
|
|
93
|
-
🔌 AnkiConnect URL: ${options.ankiConnect}${ngrokUrl ? `\n🌐 Ngrok tunnel: ${ngrokUrl}` : ""}
|
|
94
|
-
|
|
95
|
-
Configuration:
|
|
96
|
-
• Port: ${options.port} (override: --port 8080)
|
|
97
|
-
• Host: ${options.host} (override: --host 0.0.0.0)
|
|
98
|
-
• AnkiConnect: ${options.ankiConnect}
|
|
99
|
-
(override: --anki-connect http://localhost:8765)${ngrokUrl ? `\n • Ngrok tunnel: ${ngrokUrl}\n • Ngrok dashboard: http://localhost:4040` : ""}
|
|
87
|
+
console.log(`
|
|
88
|
+
╔════════════════════════════════════════════════════════════════╗
|
|
89
|
+
║${paddedTitle}║
|
|
90
|
+
╚════════════════════════════════════════════════════════════════╝
|
|
91
|
+
|
|
92
|
+
🚀 Server running on: http://${options.host}:${options.port}
|
|
93
|
+
🔌 AnkiConnect URL: ${options.ankiConnect}${ngrokUrl ? `\n🌐 Ngrok tunnel: ${ngrokUrl}` : ""}
|
|
94
|
+
|
|
95
|
+
Configuration:
|
|
96
|
+
• Port: ${options.port} (override: --port 8080)
|
|
97
|
+
• Host: ${options.host} (override: --host 0.0.0.0)
|
|
98
|
+
• AnkiConnect: ${options.ankiConnect}
|
|
99
|
+
(override: --anki-connect http://localhost:8765)${ngrokUrl ? `\n • Ngrok tunnel: ${ngrokUrl}\n • Ngrok dashboard: http://localhost:4040` : ""}
|
|
100
100
|
${!ngrokUrl
|
|
101
|
-
? `
|
|
102
|
-
Usage with ngrok:
|
|
103
|
-
1. Install: npm install -g ngrok
|
|
104
|
-
2. Setup: ngrok config add-authtoken <your-token>
|
|
105
|
-
3. Run: ankimcp --ngrok
|
|
101
|
+
? `
|
|
102
|
+
Usage with ngrok:
|
|
103
|
+
1. Install: npm install -g ngrok
|
|
104
|
+
2. Setup: ngrok config add-authtoken <your-token>
|
|
105
|
+
3. Run: ankimcp --ngrok
|
|
106
106
|
`
|
|
107
|
-
: `
|
|
108
|
-
Share this URL with your AI assistant:
|
|
109
|
-
${ngrokUrl}
|
|
110
|
-
`}
|
|
111
|
-
Run 'ankimcp --help' for more options.
|
|
107
|
+
: `
|
|
108
|
+
Share this URL with your AI assistant:
|
|
109
|
+
${ngrokUrl}
|
|
110
|
+
`}
|
|
111
|
+
Run 'ankimcp --help' for more options.
|
|
112
112
|
`);
|
|
113
113
|
}
|
|
114
114
|
//# sourceMappingURL=cli.js.map
|
|
@@ -15,72 +15,72 @@ const mcp_nest_1 = require("@rekog/mcp-nest");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
let ReviewSessionPrompt = class ReviewSessionPrompt {
|
|
17
17
|
getAnkiReviewPrompt() {
|
|
18
|
-
const promptText = `You are helping a user review Anki flashcards using spaced repetition. Follow this workflow:
|
|
19
|
-
|
|
20
|
-
## CRITICAL: Synchronization Requirements
|
|
21
|
-
|
|
22
|
-
### At Session Start:
|
|
23
|
-
1. **ALWAYS sync first** using the sync tool before getting any cards
|
|
24
|
-
2. Remind user: "I'll sync with AnkiWeb first to ensure we have your latest progress..."
|
|
25
|
-
3. Only proceed with get_due_cards after sync completes
|
|
26
|
-
|
|
27
|
-
### At Session End:
|
|
28
|
-
1. When user indicates they're done (e.g., "that's all", "I'm done", "goodbye"), ALWAYS sync
|
|
29
|
-
2. Say: "Great session! Let me sync your progress to AnkiWeb..."
|
|
30
|
-
3. Confirm sync completion before ending
|
|
31
|
-
|
|
32
|
-
## Review Workflow
|
|
33
|
-
|
|
34
|
-
1. **Sync First**: Use sync tool to get latest data from AnkiWeb
|
|
35
|
-
2. **Ask About Deck Selection**:
|
|
36
|
-
- Ask the user: "Which deck would you like to review? You can choose a specific deck or review cards from all decks."
|
|
37
|
-
- Use list_decks to show available options if needed
|
|
38
|
-
- If user chooses "all" or wants to review everything, use get_due_cards without deck_name parameter
|
|
39
|
-
- If user specifies a deck, use get_due_cards with the deck_name parameter
|
|
40
|
-
3. **Present the Question**: Show the front of the card clearly
|
|
41
|
-
4. **Wait for User's Answer**: Let them attempt to answer
|
|
42
|
-
5. **Show the Answer**: Reveal the back of the card
|
|
43
|
-
6. **Evaluate Performance**: Assess how well they answered
|
|
44
|
-
7. **Suggest a Rating**: Based on their response, suggest one of:
|
|
45
|
-
- 1 (Again) - They got it wrong or struggled significantly
|
|
46
|
-
- 2 (Hard) - They got it but with difficulty or minor errors
|
|
47
|
-
- 3 (Good) - They knew it well with reasonable effort
|
|
48
|
-
- 4 (Easy) - They knew it instantly without effort
|
|
49
|
-
|
|
50
|
-
8. **IMPORTANT - Wait for Confirmation**:
|
|
51
|
-
- Present your suggested rating with reasoning
|
|
52
|
-
- Ask: "I'd suggest rating this as [Good/Hard/etc]. Does that sound right, or would you rate it differently?"
|
|
53
|
-
- Wait for user response:
|
|
54
|
-
- If they say "yes", "ok", "agree", "sounds good", "next" → use your suggested rating
|
|
55
|
-
- If they provide a different rating → use their rating instead
|
|
56
|
-
- If unclear → ask for clarification
|
|
57
|
-
|
|
58
|
-
9. **Submit Rating**: Only use rate_card tool AFTER user confirms or provides their rating
|
|
59
|
-
10. **Continue or End**: After rating, continue with next card or end session when user is done
|
|
60
|
-
11. **End Session**: When user is done, ALWAYS sync before saying goodbye
|
|
61
|
-
|
|
62
|
-
## Example Interactions
|
|
63
|
-
|
|
64
|
-
### User agrees with suggestion:
|
|
65
|
-
Assistant: "You explained the core concept well but missed some details about the API flow. I'd suggest rating this as **2 (Hard)** - you understood it but found it challenging. Does that sound right?"
|
|
66
|
-
User: "Yes" / "Sounds good" / "Agree" / "Next"
|
|
67
|
-
Assistant: [Uses rate_card with rating: 2]
|
|
68
|
-
|
|
69
|
-
### User overrides suggestion:
|
|
70
|
-
Assistant: "Great explanation! I'd suggest rating this as **3 (Good)**. Does that sound right?"
|
|
71
|
-
User: "Actually, it was pretty hard for me"
|
|
72
|
-
Assistant: "Understood! I'll rate it as Hard." [Uses rate_card with rating: 2]
|
|
73
|
-
|
|
74
|
-
### User provides specific rating:
|
|
75
|
-
Assistant: "You got the main idea. I'd suggest **3 (Good)**. How would you rate it?"
|
|
76
|
-
User: "Give it a 2"
|
|
77
|
-
Assistant: [Uses rate_card with rating: 2]
|
|
78
|
-
|
|
79
|
-
## Key Principles
|
|
80
|
-
- Never auto-rate without user input
|
|
81
|
-
- Default to suggesting Good (3) when performance is solid
|
|
82
|
-
- Be encouraging but honest in assessments
|
|
83
|
-
- Accept user's self-assessment over your suggestion
|
|
18
|
+
const promptText = `You are helping a user review Anki flashcards using spaced repetition. Follow this workflow:
|
|
19
|
+
|
|
20
|
+
## CRITICAL: Synchronization Requirements
|
|
21
|
+
|
|
22
|
+
### At Session Start:
|
|
23
|
+
1. **ALWAYS sync first** using the sync tool before getting any cards
|
|
24
|
+
2. Remind user: "I'll sync with AnkiWeb first to ensure we have your latest progress..."
|
|
25
|
+
3. Only proceed with get_due_cards after sync completes
|
|
26
|
+
|
|
27
|
+
### At Session End:
|
|
28
|
+
1. When user indicates they're done (e.g., "that's all", "I'm done", "goodbye"), ALWAYS sync
|
|
29
|
+
2. Say: "Great session! Let me sync your progress to AnkiWeb..."
|
|
30
|
+
3. Confirm sync completion before ending
|
|
31
|
+
|
|
32
|
+
## Review Workflow
|
|
33
|
+
|
|
34
|
+
1. **Sync First**: Use sync tool to get latest data from AnkiWeb
|
|
35
|
+
2. **Ask About Deck Selection**:
|
|
36
|
+
- Ask the user: "Which deck would you like to review? You can choose a specific deck or review cards from all decks."
|
|
37
|
+
- Use list_decks to show available options if needed
|
|
38
|
+
- If user chooses "all" or wants to review everything, use get_due_cards without deck_name parameter
|
|
39
|
+
- If user specifies a deck, use get_due_cards with the deck_name parameter
|
|
40
|
+
3. **Present the Question**: Show the front of the card clearly
|
|
41
|
+
4. **Wait for User's Answer**: Let them attempt to answer
|
|
42
|
+
5. **Show the Answer**: Reveal the back of the card
|
|
43
|
+
6. **Evaluate Performance**: Assess how well they answered
|
|
44
|
+
7. **Suggest a Rating**: Based on their response, suggest one of:
|
|
45
|
+
- 1 (Again) - They got it wrong or struggled significantly
|
|
46
|
+
- 2 (Hard) - They got it but with difficulty or minor errors
|
|
47
|
+
- 3 (Good) - They knew it well with reasonable effort
|
|
48
|
+
- 4 (Easy) - They knew it instantly without effort
|
|
49
|
+
|
|
50
|
+
8. **IMPORTANT - Wait for Confirmation**:
|
|
51
|
+
- Present your suggested rating with reasoning
|
|
52
|
+
- Ask: "I'd suggest rating this as [Good/Hard/etc]. Does that sound right, or would you rate it differently?"
|
|
53
|
+
- Wait for user response:
|
|
54
|
+
- If they say "yes", "ok", "agree", "sounds good", "next" → use your suggested rating
|
|
55
|
+
- If they provide a different rating → use their rating instead
|
|
56
|
+
- If unclear → ask for clarification
|
|
57
|
+
|
|
58
|
+
9. **Submit Rating**: Only use rate_card tool AFTER user confirms or provides their rating
|
|
59
|
+
10. **Continue or End**: After rating, continue with next card or end session when user is done
|
|
60
|
+
11. **End Session**: When user is done, ALWAYS sync before saying goodbye
|
|
61
|
+
|
|
62
|
+
## Example Interactions
|
|
63
|
+
|
|
64
|
+
### User agrees with suggestion:
|
|
65
|
+
Assistant: "You explained the core concept well but missed some details about the API flow. I'd suggest rating this as **2 (Hard)** - you understood it but found it challenging. Does that sound right?"
|
|
66
|
+
User: "Yes" / "Sounds good" / "Agree" / "Next"
|
|
67
|
+
Assistant: [Uses rate_card with rating: 2]
|
|
68
|
+
|
|
69
|
+
### User overrides suggestion:
|
|
70
|
+
Assistant: "Great explanation! I'd suggest rating this as **3 (Good)**. Does that sound right?"
|
|
71
|
+
User: "Actually, it was pretty hard for me"
|
|
72
|
+
Assistant: "Understood! I'll rate it as Hard." [Uses rate_card with rating: 2]
|
|
73
|
+
|
|
74
|
+
### User provides specific rating:
|
|
75
|
+
Assistant: "You got the main idea. I'd suggest **3 (Good)**. How would you rate it?"
|
|
76
|
+
User: "Give it a 2"
|
|
77
|
+
Assistant: [Uses rate_card with rating: 2]
|
|
78
|
+
|
|
79
|
+
## Key Principles
|
|
80
|
+
- Never auto-rate without user input
|
|
81
|
+
- Default to suggesting Good (3) when performance is solid
|
|
82
|
+
- Be encouraging but honest in assessments
|
|
83
|
+
- Accept user's self-assessment over your suggestion
|
|
84
84
|
- Keep feedback concise and actionable`;
|
|
85
85
|
return {
|
|
86
86
|
description: "Guidelines for conducting Anki spaced repetition review sessions",
|