Model or dataset
matlab/matlab-mcp-server avatar
matlab/matlab-mcp-server

MATLAB MCP Server: MathWorks hands its own language to coding agents

Run MATLAB® using AI applications with the official MATLAB MCP Server from MathWorks®. This MCP server for MATLAB supports a wide range of coding agents like Claude Code® and Visual Studio® Code.

1,702 stars139 forksGoNOASSERTION

At a glance

What is it?
An official Go server that lets Claude Code, Claude Desktop, Copilot and Codex start MATLAB, write and run MATLAB code, and check it for style and correctness. The interesting parts are the licensing terms and the session model.
Who is it for?
The significance here is who is publishing it. A vendor writing an MCP server for its own language puts the tool definitions, error messages and MATLAB idioms inside the vendor's own documentation surface, which is the difference between an agent guessing at MATLAB syntax and an agent that was given the right vocabulary.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 8 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 21, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What the server actually exposes to an agent

The README states three capabilities, and they are worth quoting in the order given because the order is the difficulty order.

Start and quit MATLAB. Write and run MATLAB code. Assess your MATLAB code for style and correctness.

The first item is the one people underestimate. Launching MATLAB is slow and stateful, and an agent that shells out to a fresh interpreter per question gets a several-second penalty on every turn and no memory between turns. A server that holds a session open is the difference between an agent that can build on its own earlier work and one that cannot.

The second item is the reason the server exists. Running MATLAB code is not the same as running Python code. The language is array-oriented, indexing is one-based, matrix operations are the default rather than an optimization, and the common idioms are expressions rather than library calls. An agent writing plausible-looking Python will produce MATLAB that does not mean what the agent intended.

The third item is the one with the most leverage. Style and correctness assessment against MATLAB's own rules means the server can reject code before it runs, using the same criteria the vendor applies. That is the piece no general-purpose agent can replicate.

The protocol surface is standard, so any application that speaks Model Context Protocol can use it. The README documents Claude Code, Claude Desktop, GitHub Copilot in VS Code and Codex, and separately notes that the server supports any AI application that uses the protocol.

Setup: MATLAB on PATH, then a binary

The prerequisite is specific and non-negotiable. Install MATLAB R2021a or later and add it to the system PATH. If MATLAB is not on the PATH, nothing else works, and this is also the root of the Windows problem described later.

For Windows and Linux the README points at the latest release for a prebuilt binary, and gives a source build as the alternative: install Go, then `go install github.com/matlab/matlab-mcp-server/cmd/matlab-mcp-server@latest`. That path requires nothing but a Go toolchain and produces the binary in your Go bin directory.

macOS gets its own instructions because the artifacts are architecture-specific and the download is two steps rather than one. Apple silicon:

sh
curl -L -o ~/Downloads/matlab-mcp-server https://github.com/matlab/matlab-mcp-server/releases/latest/download/matlab-mcp-server-macos-arm64

Intel machines use the same command with the `macos-x64` suffix in place of `macos-arm64`. Then the downloaded file needs execute permission, which is a separate step people miss:

sh
chmod +x ~/Downloads/matlab-mcp-server

Note that the destination is `~/Downloads` rather than a system location. The binary is deliberately left somewhere disposable and explicit, and every subsequent configuration step asks you for the full path to it. That is a security decision rather than laziness: a server that executes code runs with whatever privileges you gave your agent, and keeping it out of a PATH that everything else on the system can reach limits the blast radius.

The minimum supported MATLAB version is worth pausing on. R2021a is roughly five releases old, which means the server deliberately targets a long tail of installs rather than only current ones. For a vendor that could also mean the tool set is pinned to what that generation supports.

Four clients, four configuration styles

The README documents a setup path for each major client, and the differences are instructive about how far MCP configuration has yet to converge.

Claude Code registers the server over stdio transport with a `--` separator between its own options and the server's arguments:

sh
claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-server-binary --initial-working-folder=/home/username/myproject

Removal is `claude mcp remove matlab`. The `matlab` name is the handle used for both, so pick the client and treat that as the same one.

Claude Desktop takes a different route entirely, through a bundle. You install Anthropic's Filesystem extension first, specifying the folders the server may access and toggling it from Disabled to Enable, then download `matlab-mcp-server.mcpb` from the latest release and double-click it to install. Arguments are then edited under Settings, Extensions, Configure. The `.mcpb` packaging is the newest piece of the ecosystem and the reason v0.13.1's only change was a fix to MCPB registry metadata.

GitHub Copilot in VS Code uses a file. Create `.vscode/mcp.json` in the workspace:

json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "C:\\fullpath\\to\\matlab-mcp-server-windows-x64.exe",
            "args": []
        }
    }
}

The README flags that Windows paths need extra slashes as escape characters, which is why the doubled backslashes appear above.

Codex mirrors the Claude Code form closely:

sh
codex mcp add matlab -- /fullpath/to/matlab-mcp-server-binary --initial-working-folder=/home/username/myproject

Which brings us to the one documented platform bug. Codex does not forward the `WINDIR` environment variable, and MATLAB needs it to run. The fix is to add the variable to the `[mcp_servers.matlab]` section of `config.toml`:

toml
[mcp_servers.matlab]
command = 'C:\fullpath\to\matlab-mcp-server-windows-x64.exe'
args = []
env_vars = ["WINDIR"]

A server for an interactive GUI application depends on environment variables that most MCP hosts do not pass through by default. Expect more of these as the ecosystem meets desktop software.

Arguments and the session model that keeps surprising people

Three documented ways to configure behavior, in the order the README lists them: put the arguments in your AI application's configuration file, usually a JSON one; pass them as command-line flags when you start the server; or use environment variables. The flexibility is real, and it is also why the same server behaves differently depending on how you installed it.

The flags that appear in examples are `--initial-working-folder`, `matlab-root`, and `matlab-display-mode`. The first sets where MATLAB starts, the second points at a custom MATLAB installation, the third controls display.

The interaction between these is the sharp edge. Release v0.13.0 added support for MATLAB running with a custom base path, and in the same release updated the README to tell users not to combine existing session mode with `matlab-root`, `initial-working-folder` or `matlab-display-mode`, because doing so results in an error.

That sentence tells you a lot about the design. The server can either manage a MATLAB session itself, opening and configuring one to its own specification, or attach to a session you already have running. Those two modes are mutually exclusive by construction, since arguments describe how to start a session and attaching to an existing one means there is nothing to start. The error is reasonable; the documentation burden lands on you.

A second-session detail came in v0.12.0, which added a message displayed inside MATLAB when an agent connects. In a shared workstation, or anywhere MATLAB is used by someone who did not start the agent, that notification is the thing standing between a surprising process and a mysterious one. It is also a small admission that agent sessions are visible to people who are not expecting them.

Go 1.26, code generation, and a repository organized like a company project

The manifest starts with `module github.com/matlab/matlab-mcp-server` and declares Go 1.26.6, which is a very recent toolchain requirement and worth checking against what you have installed before planning anything.

The direct dependencies are few and reveal the shape of the thing. `github.com/modelcontextprotocol/go-sdk v1.4.1` is the protocol implementation. `github.com/spf13/pflag v1.0.10` handles flags. `github.com/google/wire v0.7.0` is compile-time dependency injection, `github.com/vektra/mockery/v3` and `github.com/stretchr/testify v1.12.1` are the test stack, and `github.com/golangci/golangci-lint/v2` is the linter. `github.com/google/jsonschema-go` and `github.com/google/uuid` handle tool schemas and identifiers.

The observability block is the surprising entry: a full OpenTelemetry stack, `go.opentelemetry.io/otel` at v1.46.0 with the OTLP HTTP metrics exporter, plus `collector/pdata`. An MCP server emitting OpenTelemetry metrics is being treated as a service in a fleet rather than a desktop helper, which suggests MathWorks expects some users to run it centrally.

The Makefile carries the rest. The `go.mod` declares a `tool` block listing golangci-lint, wire, mockery and gotestsum, so linting, dependency-injection generation, mock generation and test running are all tool dependencies declared in the module file rather than installed ad hoc. Generating wire and mockery output into `mocks/` means the interfaces are designed for substitution and the substitutes are committed.

The tree shows how a corporate open-source project is laid out. Alongside `cmd/`, `internal/`, `pkg/`, `matlab/` and `tests/` there is `l10n/` holding Spanish, Japanese, Korean and Simplified Chinese READMEs, `messagecatalogs/` for translatable output, `.registry/` for the MCPB registry entry, `manifest.yaml` for bundle metadata, `guides/`, `SECURITY.md`, `CONTRIBUTING.md` and a `licenses/` directory. A `.golangci.yml` and `.mockery.yml` sit at the root alongside a `.copyright-ignore` file.

On the license there is a discrepancy worth naming. License detection reports NOASSERTION, which is the label used when no license can be inferred, yet the tree contains a `LICENSE.md` and a separate `licenses/` directory. The README also has a Licensing and Usage section, which is where a vendor with a commercial product in the loop puts the terms. Read that section rather than inferring terms from the metadata field.

Where this approach runs into trouble

Three limits are visible from the outside.

First, the whole thing is gated on a commercial license. The server is free and the code is open, so the marginal cost of trying it is an afternoon. But the prerequisite is a MATLAB R2021a or later installation with a valid license, and if you do not have one, this project does nothing for you. Budget for that before planning a rollout.

Second, a server that starts a desktop application and executes arbitrary code written by a model inherits every security problem of remote code execution, and inherits it in a setting where the target is a licensed commercial product with license-manager checks and possibly USB dongles in older installations. The README has a Security Considerations section, and the mitigations are configuration-level: point the binary at an explicit path outside a shared PATH, restrict the folders you grant in Claude Desktop, and remember that an agent with MATLAB access can write files anywhere the process can reach.

Third, session state is a genuine design tension rather than a missing feature. A long-lived MATLAB session is what makes the server useful, because MATLAB startup dominates every alternative. It is also what makes concurrent use awkward. Two agents, or an agent and a person, sharing one session means one can observe or disturb the other's variables, and the existing-session mode exists precisely so you can attach to something a human is already driving. The v0.13.0 documentation note is the current state of that negotiation, and it reads as unsettled rather than settled.

One more thing to check before committing. The companion skills live in separate repositories, `matlab-agentic-toolkit` and `simulink-agentic-toolkit`, and both can install this server for you. That convenience is worth using for Simulink work, where the vocabulary an agent needs is even more specialized than for MATLAB. It also means the useful configuration lives in a second place, so budget for tracking two repositories.

Editorial conclusion

The significance here is who is publishing it. A vendor writing an MCP server for its own language puts the tool definitions, error messages and MATLAB idioms inside the vendor's own documentation surface, which is the difference between an agent guessing at MATLAB syntax and an agent that was given the right vocabulary. MathWorks has done that, and the companion `matlab-agentic-toolkit` and `simulink-agentic-toolkit` repositories extend the same approach to skills. Two things to weigh before adopting it. The server is free and the code is open, but MATLAB itself is a commercial product and R2021a or later must be installed and on your PATH, so the total cost of this feature is the MATLAB license you already have or were going to buy. And the session model has sharp edges the project is still documenting: v0.13.0 added support for a custom MATLAB base path and, in the same release, a warning that combining existing session mode with `matlab-root`, `initial-working-folder` or `matlab-display-mode` produces an error. With 1,546 stars, 125 forks and only 25 open issues, this is a project being maintained steadily rather than abandoned, and the 2026-09-18 release that fixed MCPB registry metadata is the kind of unglamorous fix that tells you the packaging is taken seriously.

Frequently asked questions

Can I run Claude code with MATLAB MCP?

Yes. Install MATLAB R2021a or later and put it on your PATH, download or build the server binary, then run `claude mcp add --transport stdio matlab -- /fullpath/to/matlab-mcp-server-binary`. Remove it later with `claude mcp remove matlab`. The same binary works with Claude Desktop, GitHub Copilot in VS Code and Codex.

How do I run an MCP server?

An MCP server is a program your AI application launches, usually over stdio transport, and registers with a name. For this server the client commands are `claude mcp add --transport stdio matlab -- <path-to-binary>` for Claude Code, `codex mcp add matlab -- <path-to-binary>` for Codex, and a `.vscode/mcp.json` entry with `type` set to stdio for VS Code. Claude Desktop uses the `matlab-mcp-server.mcpb` bundle instead.

Is MATLAB required, and does this cost anything?

MATLAB R2021a or later is required and must be on the system PATH. The MCP server itself is free and its code is open source, so the only cost is the MATLAB license, which is a separate commercial product. The README has a Licensing and Usage section that is worth reading rather than inferring terms from the repository metadata.

Why does MATLAB MCP fail for Codex users on Windows?

Codex does not forward the `WINDIR` environment variable, and MATLAB needs it in order to run. Add `env_vars = ["WINDIR"]` to the `[mcp_servers.matlab]` section of your Codex config file at `C:\Users\<username>\.codex\config.toml`.

Can I use existing session mode with matlab-root or initial-working-folder?

No. Release v0.13.0 updated the README to warn that combining existing session mode with `matlab-root`, `initial-working-folder` or `matlab-display-mode` results in an error. Those arguments describe how the server should start MATLAB, which is incompatible with attaching to a session that is already running.

Official sources

  1. Issues
  2. matlab/matlab-mcp-server on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/matlab-matlab-mcp-server.svg)](https://hysenlabs.com/projects/matlab-matlab-mcp-server)

Was this useful?