Metadata-Version: 2.4
Name: discrete-structures-mcp
Version: 0.1.0
Summary: MCP server for Discrete Structures - Logic, Algorithms, Number Theory, and Cryptography tools
Project-URL: Homepage, https://github.com/ZohaibCodez/discrete-structures-ai-platform
Project-URL: Repository, https://github.com/ZohaibCodez/discrete-structures-ai-platform
Project-URL: Issues, https://github.com/ZohaibCodez/discrete-structures-ai-platform/issues
Project-URL: Documentation, https://github.com/ZohaibCodez/discrete-structures-ai-platform#readme
Author-email: ZohaibCodez <zohaib@example.com>
License: MIT
License-File: LICENSE
Keywords: algorithms,cryptography,discrete-structures,education,logic,mcp,model-context-protocol
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.11
Requires-Dist: cryptography>=42.0.0
Requires-Dist: mcp>=1.0.0
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: sympy>=1.12
Description-Content-Type: text/markdown

# 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)
```bash
uvx discrete-structures-mcp
```

### Using pip
```bash
pip install discrete-structures-mcp
discrete-structures-mcp
```

### Development Installation
```bash
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`:

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

## Usage with MCP Clients

```python
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
```python
result = await session.call_tool("gcd_lcm", {
    "numbers": "48,18"
})
# Returns: {"gcd": 6, "lcm": 144}
```

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

### Visualize Bubble Sort
```python
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

- [GitHub Repository](https://github.com/ZohaibCodez/discrete-structures-ai-platform)
- [Issue Tracker](https://github.com/ZohaibCodez/discrete-structures-ai-platform/issues)
- [MCP Documentation](https://modelcontextprotocol.io)
