API & MCP

Everything a person can do on Ohmforge Magnetic Declination (WMM2025), a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Ohmforge Magnetic Declination (WMM2025)

Computes the Earth's main magnetic field with the World Magnetic Model WMM2025 of NOAA and the British Geological Survey: declination (how far a compass needle points away from true north), inclination, horizontal and total field strength, the yearly change and the grid variation near the poles. Optionally converts a compass bearing to a true bearing. Same model as the compass in Ohmforge's Pocket instruments.

Inputs of Ohmforge Magnetic Declination (WMM2025)
FieldTypeDefaultDescription
latitudenumber52.52Latitude. North positive, south negative (WGS84).
longitudenumber13.405Longitude. East positive, west negative.
heightnumber0Height above sea level. Treated as height above the WGS84 ellipsoid; the difference (up to about 100 m) does not matter here.
datetext—Date. YYYY-MM-DD or a decimal year such as 2027.5, between 2025.0 and 2030.0. Empty = today.
bearingnumber—Compass bearing to convert (optional). A magnetic bearing read from a compass; the result adds the declination to get the true bearing.

Example request

Berlin, 8 November 2026

curl -X POST https://ohmforgemagneticdeclination.usefulweb.app/api/v1/calculate -H 'content-type: application/json' -d '{"latitude":52.52,"longitude":13.405,"height":34,"date":"2026-11-08"}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "ohmforge-magnetic-declination": { "type": "http", "url": "https://ohmforgemagneticdeclination.usefulweb.app/mcp" }
  }
}