@spacholski1225/anki-connect-mcp 1.0.1 → 1.0.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/README.md +124 -4
- package/dist/methods/anki.js +2 -5
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -100,16 +100,39 @@ To use this MCP server with Claude Desktop, add the following configuration to y
|
|
|
100
100
|
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
101
101
|
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
102
102
|
|
|
103
|
-
**Configuration:**
|
|
103
|
+
**Configuration Options:**
|
|
104
|
+
|
|
105
|
+
#### Option 1: Using Node.js (Local Installation)
|
|
104
106
|
```json
|
|
105
107
|
{
|
|
106
108
|
"mcpServers": {
|
|
107
109
|
"anki-connect": {
|
|
108
110
|
"command": "node",
|
|
109
111
|
"args": [
|
|
110
|
-
"dist
|
|
112
|
+
"C:\\Sources\\anki-connect-mcp\\dist\\index.js"
|
|
113
|
+
],
|
|
114
|
+
"env": {},
|
|
115
|
+
"disabled": false,
|
|
116
|
+
"alwaysAllow": [
|
|
117
|
+
"deck_names",
|
|
118
|
+
"cards_info",
|
|
119
|
+
"deck_names_and_ids",
|
|
120
|
+
"gui_deck_browser"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Option 2: Using npx (NPM Package)
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"anki-connect": {
|
|
132
|
+
"command": "npx",
|
|
133
|
+
"args": [
|
|
134
|
+
"@spacholski1225/anki-connect-mcp"
|
|
111
135
|
],
|
|
112
|
-
"cwd": "/path/to/your/mcp-server",
|
|
113
136
|
"env": {},
|
|
114
137
|
"disabled": false,
|
|
115
138
|
"alwaysAllow": [
|
|
@@ -123,10 +146,68 @@ To use this MCP server with Claude Desktop, add the following configuration to y
|
|
|
123
146
|
}
|
|
124
147
|
```
|
|
125
148
|
|
|
149
|
+
#### Option 3: Using Docker
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"anki-connect": {
|
|
154
|
+
"command": "docker",
|
|
155
|
+
"args": [
|
|
156
|
+
"run",
|
|
157
|
+
"--rm",
|
|
158
|
+
"-i",
|
|
159
|
+
"--network=host",
|
|
160
|
+
"-e", "ANKI_CONNECT_URL=http://host.docker.internal:8765",
|
|
161
|
+
"spacholski/anki-connect-mcp:latest"
|
|
162
|
+
],
|
|
163
|
+
"env": {},
|
|
164
|
+
"disabled": false,
|
|
165
|
+
"alwaysAllow": [
|
|
166
|
+
"deck_names",
|
|
167
|
+
"cards_info",
|
|
168
|
+
"deck_names_and_ids",
|
|
169
|
+
"gui_deck_browser"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Docker-Specific AnkiConnect Configuration:**
|
|
177
|
+
|
|
178
|
+
When using the Docker option, you **must** configure AnkiConnect with specific settings to allow Docker container access:
|
|
179
|
+
|
|
180
|
+
1. Go to **Tools** → **Add-ons** in Anki
|
|
181
|
+
2. Select **AnkiConnect** and click **Config**
|
|
182
|
+
3. Update the configuration with the following settings:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"apiKey": null,
|
|
187
|
+
"apiLogPath": null,
|
|
188
|
+
"ignoreOriginList": [],
|
|
189
|
+
"webBindAddress": "0.0.0.0",
|
|
190
|
+
"webBindPort": 8765,
|
|
191
|
+
"webCorsOriginList": [
|
|
192
|
+
"http://localhost",
|
|
193
|
+
"http://host.docker.internal",
|
|
194
|
+
"http://host.docker.internal:3000"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Key Docker Configuration Points:**
|
|
200
|
+
- **`webBindAddress: "0.0.0.0"`** - Allows AnkiConnect to accept connections from any IP address (required for Docker containers)
|
|
201
|
+
- **`webCorsOriginList`** - Must include `"http://host.docker.internal"` and related origins to allow cross-origin requests from Docker containers
|
|
202
|
+
- Restart Anki after making these configuration changes
|
|
203
|
+
|
|
126
204
|
**Important Notes:**
|
|
127
|
-
- Replace
|
|
205
|
+
- **For Node.js option**: Replace the path in `args` with the actual path to your built `index.js` file
|
|
206
|
+
- **For npx option**: Uses the published NPM package `@spacholski1225/anki-connect-mcp` - no local installation required
|
|
207
|
+
- **For Docker option**: Uses the pre-built Docker image `spacholski/anki-connect-mcp:latest`
|
|
128
208
|
- The `alwaysAllow` array contains tools that won't require confirmation each time
|
|
129
209
|
- Make sure Anki is running with AnkiConnect enabled before using the MCP server
|
|
210
|
+
- For Docker option, the `--network=host` flag allows the container to access AnkiConnect on the host machine
|
|
130
211
|
|
|
131
212
|
### Other MCP Clients
|
|
132
213
|
|
|
@@ -170,6 +251,45 @@ src/
|
|
|
170
251
|
- `npm start` - Run the compiled MCP server
|
|
171
252
|
- `npm test` - Run tests (not implemented yet)
|
|
172
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
|
+
|
|
173
293
|
## Troubleshooting
|
|
174
294
|
|
|
175
295
|
### Common Issues
|
package/dist/methods/anki.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
|
|
2
|
+
// Use environment variable with fallback to default
|
|
3
|
+
const BASE_URL = process.env.ANKI_CONNECT_URL || 'http://localhost:8765';
|
|
3
4
|
const api = axios.create({
|
|
4
5
|
baseURL: BASE_URL,
|
|
5
6
|
timeout: 5000,
|
|
@@ -10,13 +11,9 @@ const api = axios.create({
|
|
|
10
11
|
export async function callAnkiConnect(request) {
|
|
11
12
|
try {
|
|
12
13
|
const response = await api.post('/', request);
|
|
13
|
-
console.log('Request:', request);
|
|
14
|
-
console.log('===RESPONSE===');
|
|
15
|
-
console.log(response.data);
|
|
16
14
|
return response.data;
|
|
17
15
|
}
|
|
18
16
|
catch (error) {
|
|
19
|
-
console.log('Anki Connect Error:', error);
|
|
20
17
|
throw error;
|
|
21
18
|
}
|
|
22
19
|
}
|
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.2",
|
|
4
4
|
"description": "MCP server for Anki Connect integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/spacholski1225/anki-connect-mcp.git"
|
|
17
17
|
},
|
|
18
|
-
"keywords": [
|
|
18
|
+
"keywords": [
|
|
19
|
+
"mcp",
|
|
20
|
+
"anki",
|
|
21
|
+
"server",
|
|
22
|
+
"connect"
|
|
23
|
+
],
|
|
19
24
|
"author": "spacholski1225",
|
|
20
25
|
"license": "MIT",
|
|
21
26
|
"type": "module",
|