Anki MCP

Anki MCP

Anki MCP

Category
访问服务器

README

🧠 Anki MCP

NPM Package yanki-connect License: MIT

Transform your Anki flashcard experience with AI! This MCP (Model Context Protocol) server bridges your Anki flashcard collection with AI assistants like Claude, enabling natural conversations about your study materials.

🚀 What Can You Do?

Imagine having an AI tutor that knows your entire flashcard collection and can:

📚 Interactive Learning

  • "Quiz me on Japanese vocabulary I haven't seen in 3 days"
  • "Test me on challenging cards from my medical deck"
  • "Show me cards I've been struggling with recently"

Smart Content Creation

  • "Create flashcards about photosynthesis with diagrams"
  • "Turn this PDF chapter into spaced repetition cards"
  • "Generate cloze deletion cards from my lecture notes"

🔍 Powerful Analytics

  • "Which topics am I struggling with most?"
  • "Show me my study patterns for the last month"
  • "What's my retention rate for different card types?"

🎯 Bulk Operations

  • "Tag all my chemistry cards with 'exam-prep'"
  • "Move cards with low retention to an intensive review deck"
  • "Find and fix duplicate cards across my decks"

🎯 Features

  • Full Anki Integration: Complete access to decks, cards, notes, and statistics via all 115 AnkiConnect API methods
  • Conversational Interface: Natural language commands through your AI assistant
  • Bulk Operations: Efficiently manage thousands of cards at once
  • Real-time Statistics: Get insights into your learning progress
  • Media Support: Handle images, audio, and other media in your cards
  • Advanced Querying: Find cards using complex search criteria
  • Type Safety: Fully typed API with comprehensive error handling

🛠 Technical Stack

  • Node.js: Runtime environment (18+ required)
  • TypeScript: Type safety and developer experience
  • MCP SDK: Model Context Protocol implementation
  • yanki-connect: 🙏 Fully-typed, isomorphic AnkiConnect API client
  • tsup: Fast TypeScript bundler
  • PNPM: Efficient package manager

Special thanks to the yanki-connect library for providing the robust AnkiConnect interface that powers this integration!

📋 Prerequisites

1. Install Anki

Download and install Anki if you haven't already.

2. Install AnkiConnect Plugin

  1. Open Anki
  2. Go to ToolsAdd-ons
  3. Click Get Add-ons...
  4. Enter code: 2055492159
  5. Restart Anki

📋 Version Requirements: This server requires AnkiConnect version 25.2.25.0 or newer (released 2025-02-25) for full compatibility. Most features work with older versions, but we recommend updating for the best experience.

3. Configure AnkiConnect (Optional)

AnkiConnect works out of the box, but you can customize settings:

  1. Go to ToolsAdd-ons
  2. Select AnkiConnect and click Config
  3. Default settings should work fine for most users

🚀 Quick Start

Option 1: Use with Claude Desktop (Recommended)

  1. Install the package

    npm install -g @arielbk/anki-mcp
    
  2. Configure Claude Desktop

    Edit your Claude Desktop configuration file:

    macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

    Add this configuration:

    {
      "mcpServers": {
        "anki": {
          "command": "anki-mcp",
          "args": []
        }
      }
    }
    
  3. Restart Claude Desktop

  4. Start using it!

    • Make sure Anki is running with AnkiConnect enabled
    • Ask Claude: "Show me my Anki decks" or "Quiz me with 5 cards"

💡 Pro Tip: You can test your setup by asking Claude simple questions like "How many Anki decks do I have?" or "What's in my largest deck?"

Option 2: Development Setup

  1. Clone the repository

    git clone https://github.com/arielbk/anki-mcp.git
    cd anki-mcp
    
  2. Install dependencies

    pnpm install
    
  3. Build the project

    pnpm build
    
  4. Test the server

    # Use the MCP inspector to test functionality
    pnpm inspect
    

Option 3: Use with Other MCP Clients

This server works with any MCP-compatible client. You can also use it with:

  • MCP Inspector: Interactive debugging tool
  • Cline: VS Code extension for AI coding
  • Custom MCP clients: Build your own using the MCP SDK

For stdio transport, run:

node dist/index.js

🎮 Usage Examples

Once configured with Claude Desktop, you can have natural conversations like:

📖 Study Sessions

You: "I have a Japanese exam tomorrow. Can you quiz me on Hiragana cards I haven't reviewed in a week?"

Claude: I'll find your Hiragana cards that need review and start a quiz session...

📝 Content Creation

You: "Create flashcards for the major battles of World War II with dates and significance"

Claude: I'll create comprehensive flashcards covering the key WWII battles...

📊 Study Analytics

You: "How am I doing with my medical terminology deck? Show me my weak areas."

Claude: Let me analyze your performance on the medical terminology deck...

🏷️ Organization

You: "Tag all cards about cardiovascular system with 'cardiology' and move them to my MCAT prep deck"

Claude: I'll help you organize those cards...

🔧 Available Tools & Resources

This MCP server provides comprehensive access to your Anki collection through these capabilities:

📚 Deck Management

  • List all decks with statistics
  • Create new decks
  • Rename and delete decks
  • Get deck configuration

🗂️ Card Operations

  • Find cards by search criteria
  • Answer cards (simulate reviews)
  • Get card information and statistics
  • Suspend/unsuspend cards
  • Bulk card operations

📝 Note Management

  • Add new notes with custom fields
  • Update existing notes
  • Delete notes
  • Find notes by search query
  • Bulk note operations

📊 Statistics & Analytics

  • Deck statistics and performance metrics
  • Card ease and interval data
  • Review history and patterns
  • Learning progress insights

🎨 Media & Models

  • Access note types and field definitions
  • Media file management
  • Template customization support

🔍 Advanced Features

  • Complex search queries using Anki's search syntax
  • Batch operations for efficiency
  • Real-time synchronization with Anki
  • Error handling and validation
  • Organized API methods grouped by functionality (cards, decks, notes, models, statistics, media, etc.)
  • Direct access to all 115 AnkiConnect API methods with full type safety

🛠 Development

# Run in development mode with auto-reloading
pnpm dev

# Lint the code
pnpm lint

# Format the code
pnpm format

# Test with MCP inspector
pnpm inspect

🔧 Configuration

AnkiConnect Settings

The server connects to AnkiConnect on localhost:8765 by default. If you've customized your AnkiConnect configuration, you may need to adjust the connection settings.

Important: Make sure Anki is running and AnkiConnect is installed before using the MCP server. The server will fail to connect if AnkiConnect is not accessible.

💡 Note: The underlying yanki-connect library supports auto-launching Anki on macOS, but this feature is not currently exposed in the MCP server configuration. You'll need to start Anki manually.

Claude Desktop Advanced Configuration

For advanced users, you can pass additional parameters:

{
  "mcpServers": {
    "anki": {
      "command": "anki-mcp",
      "args": ["--verbose"],
      "env": {
        "ANKI_CONNECT_HOST": "localhost",
        "ANKI_CONNECT_PORT": "8765"
      }
    }
  }
}

Troubleshooting

Common Issues:

  • "Failed to connect to AnkiConnect": Ensure Anki is running and AnkiConnect plugin is installed
  • "No decks found": Make sure you have at least one deck in Anki
  • Claude doesn't respond: Restart Claude Desktop after configuration changes
  • Permission errors: Check that the global npm install worked correctly with npm list -g @arielbk/anki-mcp

🤝 Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📜 License

MIT - see LICENSE file for details.

🙏 Acknowledgments


Transform your flashcard experience with AI-powered conversations! 🚀

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选