Skip to main content

MCP server for Discrete Structures - Logic, Algorithms, Number Theory, and Cryptography tools

Project description

Discrete Structures MCP Server

A Model Context Protocol (MCP) server providing comprehensive tools for discrete mathematics education, including Boolean logic, algorithms, number theory, and cryptography.

Features

🧮 Logic Tools (5 tools)

  • evaluate_boolean - Evaluate boolean expressions with truth values
  • generate_truth_table - Generate complete truth tables for logical expressions
  • simplify_boolean - Simplify boolean expressions using algebraic rules
  • convert_to_cnf - Convert expressions to Conjunctive Normal Form
  • convert_to_dnf - Convert expressions to Disjunctive Normal Form

📊 Algorithm Visualizers (6 tools)

  • visualize_bubble_sort - Step-by-step bubble sort visualization
  • visualize_quick_sort - Quick sort with partition visualization
  • visualize_merge_sort - Merge sort with divide-and-conquer steps
  • visualize_binary_search - Binary search algorithm visualization
  • visualize_dijkstra - Dijkstra's shortest path algorithm
  • visualize_bfs_dfs - Breadth-first and depth-first search visualization

🔢 Number Theory Tools (5 tools)

  • is_prime - Check if a number is prime
  • prime_factors - Find prime factorization
  • gcd_lcm - Calculate GCD and LCM of numbers
  • modular_arithmetic - Perform modular arithmetic operations
  • euler_totient - Calculate Euler's totient function

🔐 Cryptography Tools (5 tools)

  • caesar_cipher - Encrypt/decrypt using Caesar cipher
  • vigenere_cipher - Encrypt/decrypt using Vigenere cipher
  • rsa_encrypt_decrypt - RSA encryption and decryption
  • aes_encrypt_decrypt - AES symmetric encryption
  • generate_rsa_keys - Generate RSA key pairs

Installation

Using uvx (recommended)

uvx discrete-structures-mcp

Using pip

pip install discrete-structures-mcp
discrete-structures-mcp

Development Installation

git clone https://github.com/ZohaibCodez/discrete-structures-ai-platform.git
cd discrete-structures-ai-platform/mcp-server
uv sync
uv run discrete-structures-mcp

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "discrete-structures": {
      "command": "uvx",
      "args": ["discrete-structures-mcp"]
    }
  }
}

Usage with MCP Clients

from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client

server_params = StdioServerParameters(
    command="uvx",
    args=["discrete-structures-mcp"]
)

async with stdio_client(server_params) as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        
        # List available tools
        tools = await session.list_tools()
        print([tool.name for tool in tools.tools])
        
        # Call a tool
        result = await session.call_tool("gcd_lcm", {"numbers": "48,18"})
        print(result)

Example Tool Calls

Calculate GCD and LCM

result = await session.call_tool("gcd_lcm", {
    "numbers": "48,18"
})
# Returns: {"gcd": 6, "lcm": 144}

Generate Truth Table

result = await session.call_tool("generate_truth_table", {
    "expression": "(A & B) | C"
})
# Returns complete truth table

Visualize Bubble Sort

result = await session.call_tool("visualize_bubble_sort", {
    "array": "5,2,8,1,9"
})
# Returns step-by-step sorting visualization

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Links

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

discrete_structures_mcp-0.1.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

discrete_structures_mcp-0.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file discrete_structures_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: discrete_structures_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for discrete_structures_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8f8817bd843e7e4b2a2c4d28eb7a983beb30e7d583fdbb06a2f131a1f8c491f2
MD5 681be846f59f5a2be3a63d7e9defbe4d
BLAKE2b-256 74019a7f809b44fa3afa9574fa9fda9acce7491161049a2a20833b89203e11c1

See more details on using hashes here.

File details

Details for the file discrete_structures_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for discrete_structures_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c40d49946295b5cd10d042006fad11a1e165f05c69a37c5529af5d4288fbfdee
MD5 140936e360cf631cd5e8a07fecc6d897
BLAKE2b-256 e0b5fe60befed26e2d70a730a8dfc4845bbec4ca95f4b27e6a07c4fb5ceec8c8

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