mcp-z3-prover
MCP server exposing Z3 solver API for creating variables, adding constraints, and solving SMT problems with optimization support.
README
mcp-z3-prover
MCP server exposing Z3 solver API
Install
pip install mcp-z3-prover
Usage
from mcp_z3_prover import mcp
# Run the server
mcp.run()
Or from command line:
mcp-z3-prover
MCP Tools
The server exposes the following tools:
- create_bool_var - Create a Boolean variable
- create_int_var - Create an Integer variable
- create_real_var - Create a Real variable
- create_int_constant - Create an integer constant
- create_real_constant - Create a real constant
- add_constraint - Add a constraint to the solver
- solve - Solve the current problem
- get_model_value - Get value of a variable from the model
- optimize - Solve with optimization objective
- reset_solver - Reset the solver state
- list_variables - List all created variables
Example
# Create variables
create_int_var("x")
create_int_var("y")
# Add constraints
add_constraint("int:x + int:y == 10")
add_constraint("int:x > 0")
add_constraint("int:y > 0")
# Solve
result = solve()
# Returns: {"status": "sat", "model": {"x": "5", "y": "5"}}
# Get specific values
x_val = get_model_value("int:x")
Integer Factorization Example
# Factor n = 4295229443 where n = p * q with q <= sqrt(n)
create_int_var("p")
create_int_var("q")
# Add constraints
add_constraint("int:p * int:q == 4295229443")
add_constraint("4295229443 > int:p")
add_constraint("4295229443 > int:q")
add_constraint("int:q <= 65537") # sqrt(4295229443) ≈ 65537
add_constraint("int:q > 1")
add_constraint("int:p > 1")
add_constraint("int:q % 2 != 0") # q is odd
add_constraint("int:p % 2 != 0") # p is odd
# Solve
result = solve()
# Returns: {"status": "sat", "model": {"p": "65539", "q": "65537"}}
# Verification: 65537 * 65539 = 4295229443
Development
git clone https://github.com/daedalus/mcp-z3-prover.git
cd mcp-z3-prover
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint
ruff check src/ tests/
# type check
mypy src/
MCP Registration
mcp-name: io.github.daedalus/mcp-z3-prover
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.