@spacholski1225/anki-connect-mcp 1.0.4 → 1.0.6
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 +25 -96
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A Model Context Protocol (MCP) server that provides seamless integration with Anki through the AnkiConnect add-on. This server enables AI assistants and other MCP clients to interact with your Anki flashcard collection programmatically.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## What is Anki Connect?
|
|
6
8
|
|
|
7
9
|
[AnkiConnect](https://ankiweb.net/shared/info/2055492159) is a powerful Anki add-on that exposes Anki's functionality through a REST API. It allows external applications to:
|
|
@@ -22,35 +24,35 @@ The Model Context Protocol is a standardized way for AI assistants to connect to
|
|
|
22
24
|
This MCP server provides comprehensive access to AnkiConnect functionality through the following tools:
|
|
23
25
|
|
|
24
26
|
### Flashcard Management
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
27
|
+
- `create_flashcard()` - Create new flashcards with front and back content
|
|
28
|
+
- `add_note()` - Add notes with custom fields and tags
|
|
29
|
+
- `add_notes()` - Bulk add multiple notes
|
|
30
|
+
- `update_note_fields()` - Update existing note fields
|
|
31
|
+
- `find_notes()` - Search for notes using Anki's query syntax
|
|
30
32
|
|
|
31
33
|
### Deck Management
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
34
|
+
- `deck_names()` - Get all deck names
|
|
35
|
+
- `deck_names_and_ids()` - Get deck names with their IDs
|
|
36
|
+
- `change_deck()` - Move cards between decks
|
|
37
|
+
- `delete_decks()` - Delete decks and optionally their cards
|
|
38
|
+
- `get_deck_config()` - Retrieve deck configuration settings
|
|
37
39
|
|
|
38
40
|
### Card Operations
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
41
|
+
- `find_cards()` - Search for cards
|
|
42
|
+
- `cards_info()` - Get detailed card information
|
|
43
|
+
- `suspend()` / `unsuspend()` - Suspend/unsuspend cards
|
|
44
|
+
- `are_suspended()` / `are_due()` - Check card status
|
|
43
45
|
|
|
44
46
|
### GUI Control
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
47
|
+
- `gui_deck_browser()` - Open deck browser
|
|
48
|
+
- `gui_deck_review()` - Start deck review
|
|
49
|
+
- `gui_browse()` - Open card browser with search
|
|
50
|
+
- `gui_add_cards()` - Open add cards dialog
|
|
49
51
|
|
|
50
52
|
### Utility Tools
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
53
|
+
- `version()` - Get AnkiConnect version
|
|
54
|
+
- `get_tags()` - Retrieve all tags
|
|
55
|
+
- `multi()` - Execute multiple AnkiConnect requests in batch
|
|
54
56
|
|
|
55
57
|
## Prerequisites
|
|
56
58
|
|
|
@@ -125,6 +127,8 @@ To use this MCP server with Claude Desktop, add the following configuration to y
|
|
|
125
127
|
```
|
|
126
128
|
|
|
127
129
|
#### Option 2: Using npx (NPM Package)
|
|
130
|
+
|
|
131
|
+
**Then configure your MCP client:**
|
|
128
132
|
```json
|
|
129
133
|
{
|
|
130
134
|
"mcpServers": {
|
|
@@ -209,13 +213,6 @@ When using the Docker option, you **must** configure AnkiConnect with specific s
|
|
|
209
213
|
- Make sure Anki is running with AnkiConnect enabled before using the MCP server
|
|
210
214
|
- For Docker option, the `--network=host` flag allows the container to access AnkiConnect on the host machine
|
|
211
215
|
|
|
212
|
-
### Other MCP Clients
|
|
213
|
-
|
|
214
|
-
For other MCP clients, use the following connection details:
|
|
215
|
-
- **Transport**: stdio
|
|
216
|
-
- **Command**: `node dist/index.js`
|
|
217
|
-
- **Working Directory**: Path to this repository
|
|
218
|
-
|
|
219
216
|
## Usage Examples
|
|
220
217
|
|
|
221
218
|
Once configured with an MCP client like Claude Desktop, you can interact with your Anki collection naturally:
|
|
@@ -226,70 +223,6 @@ Once configured with an MCP client like Claude Desktop, you can interact with yo
|
|
|
226
223
|
- *"Suspend all cards in the 'Difficult Words' deck"*
|
|
227
224
|
- *"Open the deck browser in Anki"*
|
|
228
225
|
|
|
229
|
-
## Development
|
|
230
|
-
|
|
231
|
-
### Project Structure
|
|
232
|
-
|
|
233
|
-
```
|
|
234
|
-
src/
|
|
235
|
-
├── index.ts # Main MCP server setup and tool definitions
|
|
236
|
-
├── methods/
|
|
237
|
-
│ └── anki.ts # AnkiConnect API communication
|
|
238
|
-
├── tools/ # Tool implementations
|
|
239
|
-
│ ├── cards.ts # Card-related operations
|
|
240
|
-
│ ├── decks.ts # Deck management
|
|
241
|
-
│ ├── misc.ts # Utility functions and GUI controls
|
|
242
|
-
│ ├── models.ts # Note type operations
|
|
243
|
-
│ └── notes.ts # Note management
|
|
244
|
-
└── types/ # TypeScript type definitions
|
|
245
|
-
└── anki/ # AnkiConnect API types
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Available Scripts
|
|
249
|
-
|
|
250
|
-
- `npm run build` - Compile TypeScript to JavaScript
|
|
251
|
-
- `npm start` - Run the compiled MCP server
|
|
252
|
-
- `npm test` - Run tests (not implemented yet)
|
|
253
|
-
|
|
254
|
-
## Docker Deployment
|
|
255
|
-
|
|
256
|
-
### Building and Running with Docker
|
|
257
|
-
|
|
258
|
-
1. **Build the Docker image**:
|
|
259
|
-
```bash
|
|
260
|
-
docker build -t anki-connect-mcp .
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
2. **Run with default settings** (connects to AnkiConnect on localhost:8765):
|
|
264
|
-
```bash
|
|
265
|
-
docker run -d --name anki-connect-mcp anki-connect-mcp
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
3. **Run with custom AnkiConnect URL**:
|
|
269
|
-
```bash
|
|
270
|
-
docker run -d --name anki-connect-mcp -e ANKI_CONNECT_URL=http://custom-host:8765 anki-connect-mcp
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Using Docker Compose
|
|
274
|
-
|
|
275
|
-
1. **Start the service**:
|
|
276
|
-
```bash
|
|
277
|
-
docker-compose up -d
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
2. **Stop the service**:
|
|
281
|
-
```bash
|
|
282
|
-
docker-compose down
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Environment Variables
|
|
286
|
-
|
|
287
|
-
- `ANKI_CONNECT_URL`: The URL where AnkiConnect is running (default: `http://localhost:8765`)
|
|
288
|
-
|
|
289
|
-
### Docker Configuration for MCP Clients
|
|
290
|
-
|
|
291
|
-
When using Docker, update your MCP client configuration to use the containerized version. The exact configuration depends on your setup, but you may need to adjust network settings to allow the MCP client to communicate with the Docker container.
|
|
292
|
-
|
|
293
226
|
## Troubleshooting
|
|
294
227
|
|
|
295
228
|
### Common Issues
|
|
@@ -299,10 +232,6 @@ When using Docker, update your MCP client configuration to use the containerized
|
|
|
299
232
|
3. **Permission errors**: Ensure the MCP server has proper file system permissions
|
|
300
233
|
4. **Tool not found**: Verify the MCP client configuration and restart the client
|
|
301
234
|
|
|
302
|
-
### Debug Mode
|
|
303
|
-
|
|
304
|
-
To enable debug logging, check the console output when running the MCP server. All AnkiConnect requests and responses are logged for troubleshooting.
|
|
305
|
-
|
|
306
235
|
## Contributing
|
|
307
236
|
|
|
308
237
|
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spacholski1225/anki-connect-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "MCP server for Anki Connect integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
46
|
+
"@spacholski1225/anki-connect-mcp": "^1.0.4",
|
|
46
47
|
"axios": "^1.9.0"
|
|
47
48
|
}
|
|
48
49
|
}
|