INSTALLATION.md•3.38 kB
# Setting Up Anki MCP Server with Claude
This guide will help you set up and use the Anki MCP Server to allow Claude or other MCP-compatible LLMs to create flashcards directly in your Anki app.
## Step 1: Install Anki and AnkiConnect
1. **Install Anki**:
- Download and install Anki from [the official website](https://apps.ankiweb.net/)
- Launch Anki and create an account or skip if you already have one
2. **Install the AnkiConnect add-on**:
- In Anki, go to `Tools > Add-ons > Get Add-ons...`
- Enter the code: `2055492159`
- Click OK and restart Anki when prompted
## Step 2: Set Up the Anki MCP Server
1. **Install Node.js**:
- Download and install Node.js from [the official website](https://nodejs.org/) (version 14 or later)
2. **Install the Anki MCP Server**:
```bash
# Clone the repository
git clone https://github.com/yourusername/anki-mcp-server.git
cd anki-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
```
## Step 3: Launch the Server
1. **Start Anki**:
- Make sure Anki is running with AnkiConnect installed
2. **Start the MCP Server**:
```bash
npm start
```
You should see output confirming the connection to Anki and listing available decks and note types.
## Step 4: Connect to Claude or Other LLM
### Using with Claude
If you're using Claude with MCP support:
1. Open Claude in your browser
2. Follow Claude's instructions for connecting external tools
3. Select the Anki MCP Server as one of your tools
4. You can now ask Claude to create flashcards for you in Anki
### Example Prompts for Claude
Once connected, you can ask Claude to:
- "Create a deck called 'Spanish Vocabulary' in Anki"
- "Make some flashcards about the planets in our solar system"
- "Convert these notes into Anki cards: [your notes here]"
- "Create flashcards for these important historical dates"
- "Make a set of programming concept cards for JavaScript"
## Using the Anki MCP Server Programmatically
If you want to access the server programmatically:
1. The server uses the Model Context Protocol
2. You can interact with it using any MCP client
3. Send tool execution requests to the server as specified in the MCP documentation
## Troubleshooting
- **Anki Not Detected**: Make sure Anki is running before starting the MCP server
- **Connection Failed**: Check that AnkiConnect is properly installed and enabled
- **Permission Dialogs**: AnkiConnect may show permission dialogs when operations are requested
- **Default Note Types**: Be aware of the available note types in your Anki installation
## Common Note Types in Anki
When creating cards, you'll need to specify a note type (model). Common built-in ones include:
- **Basic**: Front and Back fields
- **Basic (and reversed card)**: Front and Back fields, creates cards in both directions
- **Cloze**: Text field with cloze deletions (e.g., "The capital of France is {{c1::Paris}}")
## Advanced Configuration
You can customize the server's behavior by editing the configuration in `src/index.ts`:
```typescript
const config = {
// Anki Connect API URL
ankiConnectUrl: "http://localhost:8765",
// API version for Anki Connect
apiVersion: 6,
// Default deck name if none is specified
defaultDeckName: "Default",
};
```
For more detailed information, refer to the full README.md file.