A lean Python 3 implementation that runs on microcontrollers and other resource-constrained devices, with hardware access modules.
cesanta/mongoose
A two-file embedded networking library in C providing a TCP/IP stack, TLS 1.3, HTTP, WebSocket, MQTT and firmware OTA updates for microcontrollers.
- Stars
- 13,105
- Forks
- 2,955
- Open issues
- 3
- Last commit
- 2 days ago
What is it?
Mongoose is a networking library for embedded C/C++ projects. It bundles a TCP/IP stack with drivers, TLS 1.3, HTTP, WebSocket, MQTT and firmware OTA updates into two source files, mongoose.c and mongoose.h, with no external dependencies. It can run on bare metal or under an RTOS, and it can also sit on top of an existing stack such as lwIP or Zephyr.
The library targets microcontrollers from STM32, NXP i.MX RT, MCX and RW612 families to ESP32, Raspberry Pi RP2040/RP2350, Renesas RA and TI parts, as well as Linux, macOS and Windows. Its event-driven API uses a single event manager loop, with a handler function per connection. Built-in protocols also include plain TCP/UDP, SNTP, asynchronous DNS and Modbus-TCP.
The project is dual-licensed under GPLv2 or a commercial license, and the vendor offers paid support and security updates for commercial users.
Key features
- 01Built-in TCP/IP stack with drivers for many MCU Ethernet and Wi-Fi chips
- 02Built-in TLS 1.3, or external mbedTLS and OpenSSL
- 03HTTP server and client, WebSocket, and MQTT support
- 04Firmware OTA updates for several STM32, RP2040/2350, ESP32 and NXP platforms
- 05Pure ISO C and C++ source with no external dependencies
Use cases
- Adding a web configuration dashboard to a microcontroller-based device
- Sending telemetry from an IoT device to an MQTT broker
- Delivering over-the-air firmware updates to embedded hardware
- Serving a small REST API from a resource-constrained board
Quick start
- 1
Copy mongoose.c and mongoose.h into your project
- 2
Write a main.c that includes mongoose.h and sets up an event loop
- 3
Build the program with the C compiler
cc main.c mongoose.c
Things to know
- Dual-licensed under GPLv2 or a commercial license, so closed-source products need a paid commercial license.
- Commercial support and early security fixes are available only through paid licensing.
In collections
Topics
FAQ
- What is mongoose?
- A two-file embedded networking library in C providing a TCP/IP stack, TLS 1.3, HTTP, WebSocket, MQTT and firmware OTA updates for microcontrollers. Mongoose is a networking library for embedded C/C++ projects. It bundles a TCP/IP stack with drivers, TLS 1.3, HTTP, WebSocket, MQTT and firmware OTA updates into two source files, mongoose.c and mongoose.h, with no external dependencies. It can run on bare metal or under an RTOS, and it can also sit on top of an existing stack such as lwIP or Zephyr.
- Is mongoose free to use? What license does it have?
- mongoose is open source under the Other license. Check the license terms before using it in commercial products.
- Is mongoose still maintained?
- Actively maintained. The last commit to mongoose was on Oct 23, 2026.
- What can I use mongoose for?
- Adding a web configuration dashboard to a microcontroller-based device Sending telemetry from an IoT device to an MQTT broker Delivering over-the-air firmware updates to embedded hardware Serving a small REST API from a resource-constrained board
- How do I install mongoose?
- Copy mongoose.c and mongoose.h into your project Write a main.c that includes mongoose.h and sets up an event loop Build the program with the C compiler: cc main.c mongoose.c
- Where can I get mongoose?
- The source code and installation instructions are on GitHub: https://github.com/cesanta/mongoose
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Go compiler built on LLVM that targets microcontrollers, WebAssembly (WASM/WASI), and command-line tools.
A configuration-driven system that turns ESP32, ESP8266, BK72xx and RP2040 microcontrollers into smart devices controlled from Home Assistant and other home automation systems.
An ESP32-CAM based device that photographs analog water, gas or power meters and uses on-device AI to convert the readings into digital values.
An interactive, TLS-capable intercepting HTTP proxy with console, command-line and web interfaces for inspecting HTTP/1, HTTP/2 and WebSocket traffic.
Python/Java/Vue backend server for xiaozhi-esp32 ESP32 voice devices, supporting MQTT+UDP, WebSocket, MCP, voiceprint recognition and knowledge base.