Math MCP
Math MCP
A comprehensive math utility server implementing the Model Context Protocol (MCP) over streamable HTTP. Designed primarily for reverse engineering workflows in tools like IDA Pro, Ghidra, x64dbg, and others — but equally useful as a general-purpose math sidekick for any LLM-powered coding assistant.
Features
Base conversion — decimal, hex, binary, octal, all at once
Bitwise operations — AND, OR, XOR, NOT, NAND, NOR
Bit shifts & rotates — logical, arithmetic, rotate left/right
Endianness — swap between little and big endian for 16/32/64-bit values
IEEE-754 floats — inspect float32/float64 sign, exponent, mantissa, bit layout
Struct packing —
struct.pack/struct.unpackwith arbitrary format stringsBit fields — create masks, extract, set, clear, test arbitrary bit ranges
ASCII / Unicode — character to code point lookup, hex bytes to string
XOR cipher — XOR data with a repeating key (hex or string input)
GUID / UUID — parse mixed-endian GUID and RFC 4122 UUID from raw bytes
Timestamp conversion — FILETIME (NTFS), Unix, DOS timestamps
Hashing — MD5, SHA1, SHA256, SHA512
Hex dump — traditional format with ASCII sidebar
And more — CRC32, base64, sign extension, alignment, popcount, bit reverse, next power of 2
Tools Reference
Arithmetic
Tool | Description | Parameters | Returns | Example |
| Basic arithmetic operations |
| Formatted result in all bases (if integer) or decimal string |
|
Number Conversion
Tool | Description | Parameters | Returns | Example |
| Convert a number between bases |
| Requested representation(s) |
|
| Compare two numbers with diff/ratio |
| Difference, signed values, ratio, relationship |
|
Bitwise & Shift
Tool | Description | Parameters | Returns | Example |
| Bitwise AND / OR / XOR / NOT / NAND / NOR |
| Formatted result in all bases |
|
| Bit shift / rotate |
| Formatted result in all bases |
|
| Create / extract / set / clear / test bit fields |
| Mask value, extracted field, or modified value |
|
| Count set bits |
| Set/clear counts, density percentage |
|
| Reverse bit order |
| Original and reversed binary |
|
Data Layout
Tool | Description | Parameters | Returns | Example |
| Swap byte order (little ↔ big endian) |
| Byte-swapped value in all bases |
|
| Sign-extend from N to M bits |
| Extended value with signed interpretation |
|
| Pack integer to bytes or unpack hex bytes |
| Packed hex bytes or unpacked values |
|
| Align value up/down to a power-of-2 boundary |
| Aligned value and difference |
|
Float Analysis
Tool | Description | Parameters | Returns | Example |
| Inspect IEEE-754 float32 or float64 bit layout |
| Sign, exponent, mantissa, hex, binary |
|
String & Encoding
Tool | Description | Parameters | Returns | Example |
| Character ↔ code point lookup |
| Character info or code point info |
|
| Convert hex bytes or comma-separated decimals to ASCII |
| ASCII string and byte count |
|
| Encode to or decode from base64 |
| Encoded or decoded result |
|
| Calculate CRC32 checksum |
| CRC32 in hex and signed decimal |
|
| Calculate hash digest |
| Hash hex digest |
|
Reverse Engineering Utilities
Tool | Description | Parameters | Returns | Example |
| XOR cipher with repeating key |
| XOR result in hex and ASCII |
|
| Parse/format GUID/UUID from raw bytes |
| Mixed-endian GUID, RFC 4122 UUID, raw bytes |
|
| Convert FILETIME / Unix / DOS timestamps |
| Human-readable UTC and local time |
|
| Format hex bytes as traditional hex dump |
| Hex dump with ASCII sidebar |
|
| Find the next power of 2 |
| Next and previous power of 2 |
|
Getting Started
Prerequisites
Docker (recommended) — any modern Docker installation
or Python >= 3.14 with
uvinstalled
Docker (recommended)
# Build the image
docker build -t math-mcp .
# Run in background, mapping host port 13338 to container port 3000
docker run -d -p 13338:3000 --name MathMCP --restart unless-stopped math-mcpNative (Python 3.14+)
# Install uv (if not already installed)
pip install uv
# Sync dependencies
uv sync
# Run the server
uv run python server.pyConfiguration
MCP Client Integration
Add to your MCP client configuration (e.g., ~/.config/opencode/opencode.json, claude_desktop_config.json, or Continue config):
{
"mcpServers": {
"math-mcp": {
"type": "url",
"url": "http://localhost:13338/mcp"
}
}
}Environment / Arguments
The server listens on 0.0.0.0:3000 by default. To change the port, modify the uvicorn.run() call in server.py or the Docker port mapping.
API
The MCP endpoint uses the streamable HTTP transport (SSE + JSON-RPC).
Path | Method | Description |
| POST | MCP JSON-RPC endpoint over SSE |
Health check (FastAPI default):
curl http://localhost:13338/docsBuilding from Source
git clone https://github.com/yourusername/math-mcp.git
cd math-mcp
# Development with hot reload
uv run uvicorn server:app --host 0.0.0.0 --port 3000 --reload
# Production via Docker
docker build -t math-mcp .
docker run -d -p 13338:3000 --name MathMCP math-mcpExample: Tools in Action
Convert hex to all bases
Input: convert(value="0xDEAD")
Output: dec: 57005
hex: 0xDEAD
bin: 0b1101111010101101
oct: 0o157255Inspect a float32
Input: float_bits(value="3.14159", width=32)
Output: float32: 3.14159
hex: 0x40490FD0
bin: 0b01000000010010010000111111010000
sign=0 exp=128 (unbiased 1) mantissa=0x490FD0XOR cipher
Input: xor(value="48656C6C6F", key="FF")
Output: xor result (hex): B79A939390
xor result (ascii): \xb7\x9a\x93\x93\x90License
MIT — feel free to use, modify, and distribute.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AhmedAhmedEG/math-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server