Skip to main content

A Model Context Protocol (MCP) server that implements the famous Chico and Dico card magic trick algorithm. This server enables AI assistants to perform mathematical card magic by encoding and decoding card sequences based on combinatorial principles. The magic works by using the first 4 cards to predict the 5th card from any randomly selected 5-card hand, leveraging factorial number systems and permutation mathematics.

Project description

card-magic-mcp

License PyPI GitHub CI Downloads

中文文档

A Model Context Protocol (MCP) server that implements the Chico and Dico card magic trick algorithm. This server enables AI assistants to perform mathematical card magic by encoding and decoding card sequences based on combinatorial principles. The magic works by using the first 4 cards to predict the 5th card from any randomly selected 5-card hand, leveraging factorial number systems and permutation mathematics.

📦 Installation

Manual Installation

pip install card-magic-mcp

Installing via Smithery

To install Card Magic MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli@latest install @luochang212/card-magic-mcp --client claude

🚀 Usage

With Qwen Agent

Add this to function_list argument:

{
  "mcpServers": {
    "card_magic": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "card-magic-mcp",
        "card_magic_mcp"
      ]
    }
  }
}

With Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "card_magic": {
      "command": "uv",
      "args": [
        "--directory",
        "path/to/card_magic_mcp",
        "run",
        "card_magic_mcp"
      ]
    }
  }
}

🔧 Available Tools

The MCP Server provides two main tools for card magic:

  • encode_cards: Encode 5 cards to hide the 5th card's information in the first 4
  • decode_cards: Decode the hidden 5th card from the arrangement of 4 visible cards

🃏 Card Format

  • Suits: ♠ (Spades), ♥ (Hearts), ♦ (Diamonds), ♣ (Clubs)
  • Ranks: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K
  • Format: Each card should be written as {suit}{rank} with spaces separating multiple cards

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

card_magic_mcp-1.0.4.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

card_magic_mcp-1.0.4-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file card_magic_mcp-1.0.4.tar.gz.

File metadata

  • Download URL: card_magic_mcp-1.0.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for card_magic_mcp-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f71e4c2aaef88d5675080730e94e66a633f164d06e1394dc425801544dabc4e5
MD5 54592b70d7b1c57fec1a11e61095f7bb
BLAKE2b-256 2cf515d00809f95cb2d6d06f5255802344241e67456ee914f8aa3a7ee07fcf48

See more details on using hashes here.

File details

Details for the file card_magic_mcp-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: card_magic_mcp-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for card_magic_mcp-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9954ff7871599f8975d8a82fa69e8150d7c36cbe0096e0ce7f466ac2cbdddf6e
MD5 0b8de1243157d78ca9929c5aca12d809
BLAKE2b-256 80fd81b5108ed8126fc01259b3700a9abff28ca5f47cf58dbf090853cf338bb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page