Skip to content

External Files and Tools


An often asked questions is about how to integrate MPS with existing tools, or how to import their data and use existing frameworks or libraries. When you come from the Java world, you can reuse your code directly in MPS since Base Language is a Java clone and the IntelliJ platform that MPS builds on is written in Java and Kotlin.

If MPS completely replaces existing tools, it is better to write an importer for existing data. Data that needs to be processed by a different tool can be exported or generated by MPS/your RCP can also be exported. This case can happen if you introduce it as part of a chain of tools that each use the previous exported data as input.

Generators are not the only solution to export data. Other files such as Word or Excel documents can still be generated through a Java library. If no library supports a special output format, you can still use mps-plaintextgen ⧉ from MPS Extensions ⧉ to generate the files.

How do you write an importer?

Alternatively, custom persistence ⧉ can be employed (rarely used).

How do you deal with errors when writing an importer?

  • Create a new tab in the messages view and show the errors.
  • Create error concepts in the language. If the import fails for a particular node, replace it with one of these error nodes in the output model. You can append some error messages. This way, you can also implement checking rules for the error nodes to display the errors as part of model checking. You can also use finders to find all occurrences of errors in the model.

Is a wizard available to set up an MPS language based on an XML schema (defined in .xsd files)?

No, not possible at the moment, but you can create new projects from local or GitHub-hosted templates with Lochkarte ⧉(experimental).

Where do I put the Java JARs that I want to use as dependencies?

Where do I put my JARs? ⧉ (Specific Languages' blog)


Introducing MPS as a new tool can be challenging because there are concerns about integrating MPS with existing tools. You can find more details about this topic in Language Design | Patterns.

While MPS is not a database or can replace certain tools, it can be used in the Web and also integrate tightly with existing tools. For example, Integrating into the MPS Make Framework | MPS documentation ⧉ shows how you can compile and execute generated C code with external tools. Similar approaches have been done for other tools in the past. You can also send generated code to an external tools, get the result back and further process them in MPS. To achieve this, call the MPS generator directly (see: MPS Utilities: Generator) and send the data via Runtime#getRuntime#.exec or similar code to the external tool. Parse/import the result then back to MPS.

Alternatively, you can create a run configuration ⧉ to make root nodes executable by external tools. When you generate Java code, you can get this functionality for free through the Base Language implementation.

How can you run an LSP server for MPS grammars?

IntelliJ products have no support for LSP servers (see IDEABKL-7409 ⧉), and no implementation exists in MPS.

How can you use databases in MPS?

How can you create a standalone utility (not a complete IDE) for language generation with MPS?

This feature is not available at the moment, but you can interact with MPS models from Java when you set up the necessary dependencies:

import jetbrains.mps.smodel.ModelAccess;
import jetbrains.mps.tool.environment.EnvironmentConfig;
import jetbrains.mps.project.Project;
import jetbrains.mps.tool.environment.MpsEnvironment;
import org.jetbrains.mps.openapi.model.SModel;
import org.jetbrains.mps.openapi.module.SModule;


public class Test {
    static String projectDir = "your MPS project path";

    public static void main(String[] args) {
        EnvironmentConfig config = EnvironmentConfig.emptyConfig();
        MpsEnvironment ourEnv = new MpsEnvironment(config);
        Project myProject = ourEnv.openProject(new File(projectDir));
        myProject.getModelAccess().runReadAction(() -> {
            for(SModule module:myProject.getProjectModules()) {
                for(SModel model:module.getModels()) {

How can you share MPS snippets?

You can use Skadi Cloud Gists ⧉.

How can you run MPS in the browser?

You can try Skadi Cloud. There is also Modelix and JetBrains Projector. LIonWeb is the newest project with some information ⧉ about other projects.

How can you embed a web browser in MPS?

Since IntelliJ 2020.1, it is possible to use the Java Chromium Embedded Framework ⧉. Create a new Java Swing component in the editor:

JBCefBrowser myBrowser = new JBCefBrowser(myUrl);
return myBrowser.getComponent();

For more information, read the page about JCEF.

What is the future of MPS, especially regarding the cloud?