Skip to main content

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?

📦 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

Metadata

Release files for card-magic-mcp 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for card-magic-mcp 1.0.9
File Size Uploaded
card_magic_mcp-1.0.9.tar.gz 246.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for card-magic-mcp 1.0.9
File Interpreter ABI Platform
card_magic_mcp-1.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 257.8 kB

Release files / card_magic_mcp-1.0.9.tar.gz

Download URL card_magic_mcp-1.0.9.tar.gz
Size 246.3 kB
Tags Source
SHA-256 checksum
How to use checksums
46daff5ce0f7894440c0f52bd3f9182bff3969464916c709b33861b7e080073e
BLAKE2b-256 checksum
How to use checksums
a25a8e957e6f4779d0deade5966e9b96a436dbeba6d9bfc88889009bfad203a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release files / card_magic_mcp-1.0.9-py3-none-any.whl

Download URL card_magic_mcp-1.0.9-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b63d58cdb08a7c21abb0fd53d20f205da0db8e182718bd376ef5b1403f5ee62e
BLAKE2b-256 checksum
How to use checksums
01ae6da311cc98b3146e1824f631a4d18a9e0bd053841e331cbd747f3326cbea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release history Release notifications | RSS feed

This release

1.0.9 This release

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page