Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mongoose

> 包管理
Open source

Embedded web server, with TCP/IP network stack, MQTT and Websocket

13.0K stars0 likes14 views
WebsiteGitHub

About

Embedded web server, with TCP/IP network stack, MQTT and Websocket

Mongoose - Embedded Web Server / Embedded Network Library

Two files. Drop mongoose.c and mongoose.h into any C/C++ project and get a full network stack — HTTP, WebSocket, MQTT, TLS, firmware OTA updates, device dashboard — on any microcontroller or desktop OS.

On the market since 2004, used by vast number of open source and commercial products - it even runs on the International Space Station! Features include:

  • Cross-platform:
    • works on Linux/UNIX, MacOS, Windows, Android, STM32, NXP, ESP32, Nordic, TI, Microchip, Infineon, Renesas and other chips
    • write code once - and it'll work everywhere
    • ideal for the unification of the network infrastructure code across company
  • Built-in protocols: plain TCP/UDP, SNTP, HTTP, MQTT, Websocket, Modbus-TCP, and other
  • Asynchronous DNS resolver
  • Tiny static and run-time footprint
  • Source code is both ISO C and ISO C++ compliant
  • Very easy to integrate
  • Own TCP/IP stack for bare metal / RTOS, or run on top of any existing one (lwIP, Zephyr, ...)
  • Built-in TLS 1.3 ECC stack. Also can use external TLS libraries - mbedTLS, OpenSSL, or other
  • Does not depend on any other software to implement networking
  • Built-in firmware updates for STM32 H5, STM32 H7, NXP IMXRT, RP2040/2350, ESP32 and more
  • Commercial support with proactive security updates; CRA-compliant

Mongoose is ideal for IoT devices, embedded web servers, OTA updates, MQTT telemetry, secure device dashboards, REST APIs on microcontrollers

See https://mongoose.ws/ for complete documentation, videos, case studies, etc.

Supported platforms

Mongoose can work on top of any TCP/IP stack that supports BSD sockets API. Platforms supported by the 3rd party TCP/IP stacks:

TCP/IP stack Notes
lwIP All devices running lwIP, for example ESP32, ESP32S3, ESP32C3, ESP32C6, etc
Zephyr All devices supported by Zephyr
Other Any other TCP/IP stack that supports BSD socket API, for example Amazon FreeRTOS-TCP
Linux, Mac, Windows Workstations, server, single board computers, embedded Linux devices running on MPUs or FPGAs

Optionally, Mongoose provides its own built-in TCP/IP stack, eliminating the need for additional software to implement networking functionality. The built-in stack supports operation in both bare-metal and RTOS environments. Platforms supported by the Mongoose built-in TCP/IP stack:

Hardware Notes
STM32 All STM32 MCUs with built-in Ethernet: STM32Fxx, STM32H5xx, STM32H7xx
NXP All NXP MCUs with built-in Ethernet: IMXRT102x, IMXRT104x, IMXRT105x, IMXRT106x, IMXRT117x, RW612, MCXN94x
Microchip ATSAME54 MCUs with built-int Ethernet
Renesas RA5M, RA6M, RA8M MCUs with built-in Ethernet
Infineon XMC4, XMC7 MCUs with built-in Ethernet
Texas Instruments TM4C, TMS570 MCUs with built-in Ethernet
Cypress WiFi Any MCU with CY43xx WiFi chips, like RP2040 Pico-W, RP2350 Pico2-W, Arduino Portenta
Wiznet Ethernet Any MCU that use Wiznet W5500 or Wiznet 5100 MAC+PHY chips
Cellular NRF9160, SIM800

Usage Examples

Below are quick snippets that should give an idea how simple the API is and how easy it is to create applications with it.

Create a simple web server that serves a directory. The behavior of the HTTP server is specified by its event handler function:

…

HTTP server implements a REST API that returns current time. JSON formatting:

c
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
  if (ev == MG_EV_HTTP_MSG) {
    struct mg_http_message *hm = (struct mg_http_message *) ev_data;
    if (mg_match(hm->uri, mg_str("/api/time/get"), NULL)) {
      mg_http_reply(c, 200, "", "{%m:%lu}\n", MG_ESC("time"), time(NULL));
    } else {
      mg_http_reply(c, 500, "", "{%m:%m}\n", MG_ESC("error"), MG_ESC("Unsupported URI")); 
    }
  }
}

MQTT client that subscribes to a topic device1/rx and echoes incoming messages to device1/tx:

…

Commercial use

  • Mongoose is used by hundreds of businesses, from Fortune500 giants like Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
  • Used to solve a wide range of business needs, like implementing Web UI interface on devices, RESTful API services, telemetry data exchange, remote control for a product, remote software updates, remote monitoring, and others
  • Deployed to hundreds of millions devices in production environment worldwide
  • See Case Studies from our respected customers like Schneider Electric (industrial automation), Broadcom (semiconductors), Pilz (industrial automation), and others
  • See Testimonials from engineers that integrated Mongoose in their commercial products
  • We provide Evaluation and Commercial licensing, support, consultancy and integration services - don't hesitate to contact us

Security

We take security seriously:

  1. Mongoose repository runs a continuous integration test powered by GitHub, which runs through hundreds of unit tests on every commit to the repository. Our unit tests are built with modern address sanitizer technologies, which help to find security vulnerabilities early
  2. Mongoose repository is integrated into Google's oss-fuzz continuous fuzzer which scans for potential vulnerabilities continuously
  3. We receive periodic vulnerability reports from the independent security groups like Cisco Talos, Microsoft Security Response Center, MITRE Corporation, Compass Security and others. In case of the vulnerability found, we act according to the industry best practice: hold on to the publication, fix the software and notify all our customers that have an appropriate subscription
  4. Some of our customers (for example NASA) have specific security requirements and run independent security audits, of which we get notified and in case of any issue, act similar to (3).

How to report security vulnerabilities

Please report via https://github.com/cesanta/mongoose/security/advisories. Do NOT create a github issue.

Articles

Technical guides and deep dives into embedded web servers, WebUI integration and embedded networking technologies:

  • Embedded Web Server: A Comprehensive Guide for Modern Connected Devices
  • Building Embedded Web Device Dashboards
  • ESP32 Device Dashboard: A Step-by-Step Guide for Developers
  • How to build an STM32 Web Dashboard
  • STM32 WebSocket Guide
  • Web File Manager on STM32, ESP32 and Embedded Linux
  • Web dashboard on Zephyr RTOS
  • Limiting TCP/IP RAM usage on STM32
  • STM32 Ethernet explained
  • MQTT on a Microcontroller
  • STM32 OTA Firmware Update
  • RP2350 OTA Firmware Update
  • STM32 Ethernet and caches
  • NXP RW612 OTA Firmware Update
  • lwIP vs Mongoose - TCP/IP Stack Integration Benchmark

Contributions

Contributions are welcome! Please follow the guidelines below:

  • Sign Cesanta CLA and send GitHub pull request
  • Make sure that PRs have only one commit, and deal with one issue only

Issues· 2 open

View all issuesOpen on GitHub
  • #3684

    Add tutorials/esp32

    Updated Sep 8, 2026
  • #3683

    Reorganise https://github.com/cesanta/mongoose/tree/master/tutorials/nxp

    Updated Sep 8, 2026

> Tags

Cembeddedhttpiotmqtt

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image