Magus API
Public JSON endpoints for MidnightBSD package build data.
Latest Packages
Returns the latest passing packages from the most recent blessed Magus
runs, grouped by binary package name.
| URL |
https://www.midnightbsd.org/magus/api/latest |
| Method |
GET |
| Content Type |
application/json |
Example
curl -s https://www.midnightbsd.org/magus/api/latest
Response Fields
| Field |
Description |
repository_name |
Repository name. |
last_update |
Timestamp of the newest blessed run included in the response. |
num_packages |
Number of package entries in packages. |
packages |
Object keyed by package stem. Each value describes one package. |
packages.*.package_name |
Binary package filename, such as p5-GD-2.83.mport. |
packages.*.port |
Port origin, such as databases/p5-DBI. |
packages.*.makefile_url |
GitHub URL for the port Makefile. |
packages.*.version |
Package version string. |
packages.*.osversion |
MidnightBSD OS version for the run. |
packages.*.summary |
Port description. |
packages.*.licenses |
List of license identifiers. |
packages.*.homepages |
List of upstream homepages. |
packages.*.categories |
List of port categories. |
packages.*.subpackages |
Flavor entries when a port has flavored packages. |
packages.*.cpe |
CPE identifier when available. |
Shortened Response Example
{
"repository_name": "MidnightBSD mports",
"last_update": "2026-05-19T12:00:00Z",
"num_packages": 1,
"packages": {
"p5-DBI": {
"package_name": "p5-DBI-1.647.mport",
"port": "databases/p5-DBI",
"makefile_url": "https://github.com/MidnightBSD/mports/blob/master/databases/p5-DBI/Makefile",
"version": "1.647",
"osversion": "4.1",
"summary": "Perl5 Database Interface",
"licenses": ["ART10", "GPLv1+"],
"homepages": ["https://dbi.perl.org/"],
"categories": [{"category": "databases"}, {"category": "perl5"}],
"subpackages": [],
"cpe": null
}
}
}
Other Endpoints
| Endpoint |
Description |
/magus/api/runs |
Lists Magus runs with status, architecture, OS version, creation time, and blessed state. |
/magus/api/run-ports-list?run=<id> |
Lists ports for a run. Add &status=<status> to filter by result status. |
Magus MCP Server
Magus also provides a public Model Context Protocol server for tools
that can call MCP endpoints over Streamable HTTP.
| URL |
https://www.midnightbsd.org/magus/auth/mcp.cgi |
| Protocol |
JSON-RPC 2.0 over MCP Streamable HTTP |
| Methods |
GET for the event stream, POST for JSON-RPC messages |
| Supported MCP Versions |
2025-06-18, 2025-03-26, 2024-11-05 |
POST Headers
Content-Type: application/json
Accept: application/json, text/event-stream
MCP-Protocol-Version: 2025-06-18
Initialize Example
curl -s https://www.midnightbsd.org/magus/auth/mcp.cgi \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2025-06-18' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "example-client",
"version": "1.0"
}
}
}'
List Tools Example
curl -s https://www.midnightbsd.org/magus/auth/mcp.cgi \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2025-06-18' \
--data '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'
Tools
| Tool |
Description |
lookup_port |
Look up latest complete blessed and unblessed build results for a port name or origin across CPU architectures. |
get_run_stats |
Get package result counts and metadata for a run, or for the latest blessed runs. |
list_runs |
List recent Magus build runs with optional status and architecture filters. |
get_port_log |
Retrieve the build log for a Magus port ID. |
get_log_excerpt |
Retrieve a focused build log excerpt by literal pattern or log tail size. |
get_port_details |
Get port metadata, build events, dependencies, and reverse-dependency information. |
get_port_events |
List structured build events for a port with optional type, phase, and machine filters. |
get_dependency_blockers |
Walk a port dependency graph and show failed or skipped dependencies likely blocking it. |
get_distfiles |
Show recorded distfiles, restricted distfiles, and master sites for a port. |
get_port_cves |
Look up CVE information for a Magus port using its CPE data. |
list_run_ports |
List ports in a run with filters for status, origin, category, package name, and flavor. |
search_ports |
Search ports across runs with filters for name, status, architecture, OS version, flavor, and run. |
compare_port_runs |
Compare a port across two runs and show status, version, and package differences. |
get_machine_events |
List recent build events for a machine in a run. |
top_blockers |
List failed or skipped ports blocking the most dependent ports. |
analyze_build_log |
Analyze a failed port build log with an available LLM model. |
list_port_updates |
List ports with new upstream versions detected by portscout. |