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

Uploaded Python 3

File details

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

File metadata

  • Download URL: discrete_structures_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 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.0.tar.gz
Algorithm Hash digest
SHA256 ae9fea38d87dd77d49e061dd7bfe1aabbfc31c980a5b8a75b13902ce2f4c151d
MD5 7ef302b6fd0c02544ce8feac2c5e61d7
BLAKE2b-256 096e9e847a27202959d8f9ca813edc20e4e9c4e4f52a2e4786472f0a594fdf5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for discrete_structures_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6800008c58b856dc2c1166b0090f3be81a19f816520120aff41859d0b21ed8c3
MD5 28b4ecfe483f47af9c8704ef250aa1ad
BLAKE2b-256 790669cf52366ad45dd18c43953bece88aeff70cc17eb069356f78c106e0fe04

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