knapsack_problem
Solve a knapsack problem using a genetic algorithm.
Run a genetic algorithm over a maximization problem and get the result back in the conversation.
LABSCO SUMMARY
The useful shape here is that a problem is data: a population size, a chromosome size, a generation count and a fitness function, all in JSON. That makes it easy to hand the assistant a variation and ask it to compare runs. Start from one of the bundled samples and edit it — the travelling-salesman file shows exactly which keys the solver expects.
A Python MCP server that solves maximization problems with a genetic algorithm, driven either from an MCP client or straight from the command line with a JSON problem file.
population_size, chromosome_size, generations and a fitness-function blocktraveling_salesman with its cities and distance matrixUv. Run uv run main.py from the genetic-mcp-server directory, and point your client at that directory in the mcpServers block.
Build from source
USE CASES
Copy the travelling-salesman sample, swap in your cities and distance matrix, and run it.
Run the same problem again with a larger population or more generations and compare the results.
Run it from the command line first, so a malformed definition fails in your terminal rather than mid-conversation.
Listed in project code.
knapsack_problemSolve a knapsack problem using a genetic algorithm.
traveling_salesman_problemSolve a traveling salesman problem using a genetic algorithm.
BEFORE YOU INSTALL
2 tools registered in the project's code.
The documented client runs the server on your machine.
INSTALLATION
You clone and build this one yourself.
git clone https://github.com/jbmattos03/genetic_mcp
cd genetic_mcp/genetic-mcp-server
uv run main.py{
"mcpServers": {
"genetic_algorithm_mcp_server": {
"command": "uv",
"args": [
"--directory",
"<YOUR_FULL_PATH_TO_GENETIC_MCP>",
"run",
"main.py"
]
}
}
}