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.3.tar.gz (6.8 MB 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.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: discrete_structures_mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 6.8 MB
  • 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.3.tar.gz
Algorithm Hash digest
SHA256 57f833fe0e21f412de856449b5394a1bf67efd8001f6e869a9a3829fc0faa794
MD5 f4b5e433315fd9059bfce8a601bfd351
BLAKE2b-256 d1c5c2aa656ee5175bf89759afa6b5bcc2446fb5be9808e88979dc5d635f9313

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discrete_structures_mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6a5af6c5ffbb6b269dbc325fc16bee224c75456803638c8d3e7022770704462f
MD5 a0fa0b89ace3d2bde968f502ccebc789
BLAKE2b-256 887a62ddbfbbf1e8be6a27e5479d7672919b036353843fa2e84ffd18d5443fbc

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