For developers¶
kartoza-mcp is a small, opinionated Go server. The fastest path to
productive work is:
nix develop— drops you in a shell with the exact toolchain.nix run .#test— green tests on the first run.- Add a tool — copy
clusterHandler, register it frommain.
-
Architecture
How the MCP server, Quadtree, DBSCAN and Orb fit together. Sequence diagrams included.
-
Add a new tool
Step-by-step recipe for adding a new spatial analytic: buffer, hull, voronoi, isochrone — whatever your workflow needs.
-
Coding standards
REUSE headers, Kartoza credit, gofmt, errcheck. The non-negotiables.
-
Testing
Table-driven Go tests + golden-file JSON fixtures. How to write them, how to run them.
-
:material-folder-tree:{ .lg .middle } Project structure
Where things live and why.
-
Contributing
Branching, PR template, review expectations, release cadence.
The five-minute mental model¶
flowchart TB
subgraph stdio["stdio"]
C[MCP Client]
end
subgraph srv["kartoza-mcp (Go process)"]
M[main.go<br/>server.NewMCPServer]
H1[clusterHandler]
H2[your new handler]
Q[Quadtree / Orb]
end
C <-->|JSON-RPC over stdio| M
M --> H1
M --> H2
H1 --> Q
H2 --> Q
One Go file (main.go) wires up the MCP server. Each tool is a Go function
with the signature func(ctx, mcp.CallToolRequest) (*mcp.CallToolResult,
error). That's the whole conceptual surface.
Why so little structure?
Spatial-analysis tools tend to be small, mostly-stateless functions over
geometry. We keep the codebase flat on purpose. When a handler outgrows
main.go, lift it into its own pkg/<tool> directory — there's no
rush.