Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file provides guidance for AI coding agents working on this codebase. Read

## What This Project Is

`matlab-http-server` is a zero-dependency HTTP server framework for MATLAB. It is intended to support both REST APIs and static file serving in base MATLAB, with an optional Go sidecar transport for server-oriented deployments.
`matlab-http-server` is a zero-dependency HTTP server framework for MATLAB. It is intended to support both REST APIs and static file serving in base MATLAB, with an optional Go sidecar transport for automated or long-running MATLAB workflows.

Developers define endpoints by subclassing `mhs.ApiController`, implementing the abstract `registerRoutes` method, and writing handler methods with the signature `res = myHandler(obj, req, res)`.

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ curl http://localhost:8080/api/echo -d '{"msg":"hi"}' -H "Content-Type: applicat
curl http://localhost:8080/api/echo -d "{\"msg\":\"hi\"}" -H "Content-Type: application/json"
```

No config files, no external dependencies for core functionality, and no MATLAB Production Server license.
No config files, no external dependencies for core functionality, and no additional MATLAB products required by the framework itself beyond an appropriate MATLAB license.

---

Expand Down Expand Up @@ -110,7 +110,7 @@ addpath(fullfile(pwd, 'matlab-http-server', 'toolbox'))

## Transport Selection

`matlab-http-server` is designed around transport abstraction. The default path should work in base MATLAB, while the Go sidecar remains available as an explicit opt-in for server-oriented deployments.
`matlab-http-server` is designed around transport abstraction. The default path should work in base MATLAB, while the Go sidecar remains available as an explicit opt-in for automated or long-running MATLAB workflows.

```matlab
% Default transport
Expand Down Expand Up @@ -266,7 +266,9 @@ Caddy (TLS, :443) -> matlab-http-server (:8080, localhost only)

### Licensing Note

Single-user local use and shared multi-user deployments may have different MathWorks licensing requirements. If you plan to host a team-facing web app or API on a shared machine, verify that your organization's MATLAB license permits that deployment model and has sufficient named users or concurrent seats, as applicable.
This project is intended to operate within the scope of an existing MATLAB license and does not extend MATLAB access beyond licensed users.

Single-user local use and shared team deployments may have different MathWorks licensing requirements. If you plan to host a MATLAB-backed internal tool on a shared machine, verify that your organization's MATLAB license permits that deployment model and has sufficient named users or concurrent seats, as applicable.

See the official MathWorks licensing documentation for details:

Expand Down
2 changes: 1 addition & 1 deletion toolbox/+mhs/+internal/GoSidecarTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
% Works with base MATLAB — no toolboxes required.
% Go binary handles all HTTP; MATLAB handles request processing.
% Communication over stdin/stdout using line-delimited JSON.
% Preferred for headless, server, and production deployments.
% Optional transport for automated or long-running MATLAB workflows.
%
% The binary must exist at toolbox/bin/<platform>/matlab-http-bridge[.exe].
% Build from source: cd sidecar && make build-all
Expand Down
14 changes: 11 additions & 3 deletions toolbox/doc/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ This keeps the frontend and API on the same origin and avoids extra CORS complex
Uses `java.net.ServerSocket` coordinated by a MATLAB timer loop. Works in **Base MATLAB**.

- **Pros**: Zero toolbox dependencies, straightforward local use, good default for desktop tools and demos.
- **Cons**: Less scalable than the Go sidecar for heavier request loads.
- **Cons**: Still subject to MATLAB's single-threaded handler model.

### 2. Go Sidecar

Spawns an external Go binary to handle the HTTP socket layer and communicates with MATLAB over standard I/O.

- **Pros**: Better fit for headless or more server-oriented use cases, still works with Base MATLAB.
- **Pros**: Optional transport for improved I/O handling in automated or long-running MATLAB workflows, still works with Base MATLAB.
- **Cons**: Requires the bundled `matlab-http-bridge` binary.

The Go transport does not change MATLAB's execution model or licensing requirements and should be used within the same constraints as the default transport.

```matlab
server = MatlabHttpServer(8080, Transport="go");
```
Expand All @@ -61,21 +63,27 @@ server = MatlabHttpServer(8080, Transport="go");

## Centralized - Small Team

To share a MATLAB API or internal tool with a small team, run it on a shared machine and put a reverse proxy such as Caddy or Nginx in front of it.
To make a MATLAB-backed internal tool available within a small team environment, run it on a shared machine and put a reverse proxy such as Caddy or Nginx in front of it.

### Licensing Considerations

Shared deployments can have different MathWorks licensing requirements than a single-user local workflow. If multiple users will access the same MATLAB-backed web application or API, confirm that your organization's MATLAB license allows that deployment pattern and has enough named users or concurrent seats for the expected usage.

Access to MATLAB functionality through this server should be limited to users who are appropriately licensed, and deployments should not be used to provide MATLAB capabilities to unlicensed users.

This project does not change or extend MathWorks licensing terms. Treat the official MathWorks documentation as the source of truth for what your organization is permitted to run.

- [Individual License Administration](https://www.mathworks.com/help/install/license/individual-license-administration.html)
- [Administer Network Licenses](https://www.mathworks.com/help/install/administer-network-licenses.html)
- [Concurrent License Administration](https://www.mathworks.com/help/install/license/concurrent-licenses.html)
- [Network Named User License Administration](https://www.mathworks.com/help/install/license/key-administrative-tasks.html)

This setup is intended for lightweight internal use cases and is not a substitute for MATLAB Production Server in production or high-concurrency environments.

### Why Use a Reverse Proxy?

For internal or controlled network environments, a reverse proxy can be used to manage access and routing.

- **Security**: Dedicated web servers are better suited for external network exposure.
- **TLS/SSL**: `matlab-http-server` does not provide HTTPS directly.
- **Routing**: A proxy can route `/api/` to MATLAB and handle other paths differently if needed.
Expand Down
Loading