MCP server for Discrete Mathematics: Boolean Logic, Algorithms, Number Theory, Cryptography. 21 AI-ready tools for education and research.
Project description
๐ Discrete Structures MCP Server
Professional-grade AI tools for discrete mathematics, algorithms, and cryptography
Installation โข Features โข Quick Start โข Documentation โข Examples
๐ Overview
Discrete Structures MCP Server is a comprehensive Model Context Protocol server that brings 21 powerful mathematical tools to AI assistants like Claude Desktop, Cline, and Zed. Perfect for students, educators, and developers working with discrete mathematics, data structures, algorithms, and cryptography.
Why Choose This Server?
- ๐ฏ 21 Production-Ready Tools across 4 categories
- ๐ Educational Focus with step-by-step visualizations
- ๐ Enterprise Cryptography (RSA, AES, Caesar, Vigenere)
- ๐ Algorithm Visualizations for sorting and graph algorithms
- ๐งฎ Boolean Logic with CNF/DNF conversion
- ๐ข Number Theory including prime factorization and modular arithmetic
- โก Fast Installation via
uvx discrete-structures-mcp - ๐ MCP Registry Listed for easy discovery
โจ Features
๐งฎ Logic Tools (5 tools)
๐ข Number Theory Tools (5 tools)
|
๐ Algorithm Visualizers (6 tools)
๐ Cryptography Tools (5 tools)
|
๐ฆ Installation
โก Quick Install (Recommended)
# Install and run directly with uvx
uvx discrete-structures-mcp
๐ฅ Install with pip
# Install globally
pip install discrete-structures-mcp
# Run the server
discrete-structures-mcp
๐ ๏ธ Development Installation
# Clone the repository
git clone https://github.com/ZohaibCodez/discrete-structures-ai-platform.git
cd discrete-structures-ai-platform/mcp-server
# Install with uv
uv sync
# Run locally
uv run discrete-structures-mcp
๐ฏ Quick Start
Usage with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"discrete-structures": {
"command": "uvx",
"args": ["discrete-structures-mcp"]
}
}
}
Usage with Other MCP Clients
Compatible with any MCP client:
- Cline - VS Code extension
- Zed - Modern code editor
- Continue - AI code assistant
- Custom MCP clients via Python SDK
๐ป Example Tool Calls
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
๐ข Number Theory Examples
Calculate GCD and LCM
# Find greatest common divisor and least common multiple
result = await session.call_tool("gcd_lcm", {
"numbers": "48,18,24"
})
# Output: {"gcd": 6, "lcm": 144, "explanation": "..."}
Prime Factorization
result = await session.call_tool("prime_factors", {
"number": "84"
})
# Output: {"factors": [2, 2, 3, 7], "factorization": "2ยฒ ร 3 ร 7"}
Modular Arithmetic
result = await session.call_tool("modular_arithmetic", {
"operation": "power",
"base": "3",
"exponent": "5",
"modulus": "7"
})
# Output: {"result": 5, "explanation": "3^5 mod 7 = 5"}
๐งฎ Boolean Logic Examples
Generate Truth Table
result = await session.call_tool("generate_truth_table", {
"expression": "(A & B) | (~A & C)"
})
# Returns: Complete truth table with all input combinations
Simplify Boolean Expression
result = await session.call_tool("simplify_boolean", {
"expression": "(A & B) | (A & ~B)"
})
# Output: {"simplified": "A", "steps": ["..."]}
Convert to CNF
result = await session.call_tool("convert_to_cnf", {
"expression": "(A | B) & (C | D)"
})
# Output: Expression in Conjunctive Normal Form
๐ Algorithm Visualization Examples
Visualize Bubble Sort
result = await session.call_tool("visualize_bubble_sort", {
"array": "64,34,25,12,22,11,90"
})
# Returns: Step-by-step sorting with comparisons and swaps
Binary Search
result = await session.call_tool("visualize_binary_search", {
"array": "1,3,5,7,9,11,13,15",
"target": "7"
})
# Output: Search path with index calculations
Dijkstra's Algorithm
result = await session.call_tool("visualize_dijkstra", {
"graph": "A-B:4,A-C:2,B-C:1,B-D:5,C-D:8",
"start": "A",
"end": "D"
})
# Returns: Shortest path with distances
๐ Cryptography Examples
RSA Encryption
# Generate keys
keys = await session.call_tool("generate_rsa_keys", {
"key_size": "2048"
})
# Encrypt message
encrypted = await session.call_tool("rsa_encrypt_decrypt", {
"action": "encrypt",
"message": "Hello World",
"public_key": keys["public_key"]
})
# Decrypt message
decrypted = await session.call_tool("rsa_encrypt_decrypt", {
"action": "decrypt",
"ciphertext": encrypted["ciphertext"],
"private_key": keys["private_key"]
})
AES Encryption
result = await session.call_tool("aes_encrypt_decrypt", {
"action": "encrypt",
"text": "Sensitive Data",
"key": "my-secret-key-32-characters-long"
})
# Output: {"ciphertext": "...", "iv": "...", "tag": "..."}
Caesar Cipher
result = await session.call_tool("caesar_cipher", {
"action": "encrypt",
"text": "HELLO",
"shift": "3"
})
# Output: {"result": "KHOOR", "explanation": "Each letter shifted by 3"}
๐ Use Cases
- Computer Science Education - Teach algorithms and data structures
- Cryptography Learning - Understand encryption methods
- Mathematics Research - Number theory and discrete math
- Algorithm Analysis - Visualize complexity and performance
- Code Interviews - Practice common algorithmic problems
- Academic Projects - Implement mathematical concepts
๐๏ธ Technical Stack
- Language: Python 3.11+
- Framework: Model Context Protocol (MCP)
- Math Libraries: SymPy, NumPy
- Crypto: Python Cryptography library
- Graphs: NetworkX
- Build: UV package manager
๐ Performance
- Startup Time: < 2 seconds
- Response Time: < 100ms for most operations
- Memory: < 50MB baseline
- Concurrency: Async/await support
๐ Security Note
Educational Purpose: Caesar and Vigenere ciphers are for learning only. Use AES or RSA for real-world encryption.
๐ค Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Links & Resources
Official Links
- ๐ Homepage: GitHub Repository
- ๐ฆ PyPI Package: discrete-structures-mcp
- ๐ MCP Registry: Official Listing
- ๐ Documentation: README
- ๐ Issue Tracker: Report Bugs
Community
- ๐ฌ Discussions: GitHub Discussions
- ๐ข Announcements: Watch repository for updates
- ๐ค Contributing: See contribution guide
MCP Resources
- ๐ MCP Documentation: modelcontextprotocol.io
- ๐ ๏ธ MCP SDK: Python SDK
- ๐ MCP Servers: Community Servers
๐ Project Stats
๐ Acknowledgments
- Model Context Protocol team at Anthropic
- SymPy and NumPy communities
- Python Cryptography developers
- NetworkX graph library maintainers
- All contributors and users
๐ Support
- ๐ง Email: Open an issue for support
- ๐ฌ Discussions: Use GitHub Discussions
- ๐ Bugs: Report via Issues
- ๐ก Features: Request via Issues with enhancement label
Made with โค๏ธ for the discrete mathematics and computer science community
โญ Star this repo if you find it useful! โญ
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discrete_structures_mcp-0.1.4.tar.gz.
File metadata
- Download URL: discrete_structures_mcp-0.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4edbbb0e8bc19ff3ef93ca77740016a6afd9ea355ad82595b59b4730a3f30548
|
|
| MD5 |
d1d9f80c662df5f3fdda27e281243570
|
|
| BLAKE2b-256 |
6e5a5ede21a84ef190b5a7b5d55ab982aeea6075da9c953ac8e680d0e6a39e33
|
File details
Details for the file discrete_structures_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: discrete_structures_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce7e045016be076f3a3b029a3bc1330a989739c1d02083d6b533d567e40a8508
|
|
| MD5 |
56f228bb7322f2775d1cca6774d1f20d
|
|
| BLAKE2b-256 |
130c9003ac4165a54639aa99a78a58488e40e135893a0f6f4ef1d41552e6da15
|