Skip to main content

A Model Context Protocol (MCP) server that implements the Chico & Dico card magic trick.

Project description

card-magic-mcp

License PyPI Downloads CI smithery badge

中文文档

A Model Context Protocol (MCP) server that implements the Chico & Dico card magic trick.

Chico & Dico's Card Magic: Randomly draw five playing cards, and the audience only needs to recite the first four cards in the order arranged by Chico, and Dico can know what the fifth card is.

You can experience this magic trick in the Smithery Playground.

smithery_playground

🎭 Performance Steps

  1. Tell the magician: Help me arrange these playing cards ♠J ♠4 ♣2 ♦3 ♦K
  2. This magician will separate the cards into two piles: the first four cards and the fifth card
  3. Tell the other magician what the first four cards are, and they can tell you what the fifth card is: The first four playing cards are [card1 card2 card3 card4], what is the fifth card?

[!NOTE] Trust me, it's not through memory that it knows what the fifth card is, but through pure magic. To prevent the current dialog from remembering the fifth card, you can open a new Playground page. Tell it what the first four cards are and see if it can still guess correctly.

📦 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

This MCP server can be integrated with Qwen Agent using two connection methods: stdio and sse.

For more examples, see examples/usage_remote.py

stdio: Local Call

Add the following configuration to the function_list parameter:

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

sse: Remote Call

Before calling, run the following code in the command line to start the MCP service:

HOST=0.0.0.0 PORT=8385 uvx --from card-magic-mcp card_magic_sse

Add the following configuration to function_list:

{
  "mcpServers": {
    "card_magic_sse": {
      "url": "http://0.0.0.0:8385/sse"
    }
  }
}

🔧 Available Tools

The MCP Server provides two tools for card magic:

  • encode_cards: Encode 5 cards to hide the 5th card's information in the arrangement of the first 4 cards
  • decode_cards: Decode the hidden 5th card from the arrangement information of the first 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.9.tar.gz (246.3 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.9-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: card_magic_mcp-1.0.9.tar.gz
  • Upload date:
  • Size: 246.3 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.9.tar.gz
Algorithm Hash digest
SHA256 46daff5ce0f7894440c0f52bd3f9182bff3969464916c709b33861b7e080073e
MD5 341f6606e86798f65459fc4f5c9976af
BLAKE2b-256 a25a8e957e6f4779d0deade5966e9b96a436dbeba6d9bfc88889009bfad203a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: card_magic_mcp-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.4 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b63d58cdb08a7c21abb0fd53d20f205da0db8e182718bd376ef5b1403f5ee62e
MD5 d8bb7a68994e9e105383b2b954eda5b9
BLAKE2b-256 01ae6da311cc98b3146e1824f631a4d18a9e0bd053841e331cbd747f3326cbea

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