A Flask-based REST API server, web UI, and MCP (Model Context Protocol) server for accessing and visualizing SYSMOD SysML v2 models.
Warning
Work in Progress — This project is under active development. Some features may be incomplete, use placeholder/dummy data, or behave unexpectedly. Contributions and feedback are welcome.
sysmod-sysmlv2-api-mcp connects to a SysML v2 repository server and provides:
- 📄 Single-page SYSMOD Viewer (
web/) — the recommended viewer: one web page, no Flask server, no Python packages. See Single-page viewer - 🔌 REST API + Web UI — interactive browser-based viewer and wizard for SYSMOD models
- 🤖 MCP Server — exposes all SYSMOD artifacts as tools for AI agents (Claude, Cursor, GitHub Copilot, etc.)
- 🧠 SYSMOD AI Agent — an LLM can autonomously query problem statements, contexts, stakeholders, requirements, feature trees, and more directly from the SysML v2 model
┌─────────────────────┐ MCP (stdio/SSE) ┌────────────────────────┐
│ SYSMOD AI Agent │ ─────────────────→ │ sysmod_mcp_server.py │
│ (Claude/Cursor/etc) │ │ (FastMCP tools) │
└─────────────────────┘ └───────────┬────────────┘
│ HTTP REST
┌───────────▼────────────┐
Browser ──────────────────────→ │ sysmod_api_server.py │
│ (Flask REST API) │
└───────────┬────────────┘
│ SysML v2 API
┌───────────▼────────────┐
│ SysML v2 Repository │
└────────────────────────┘
The SYSMOD Viewer as one web page: it reads the model with the SysML v2 API directly from the browser. No Flask server, no pip install.
python web/serve.py # then open http://localhost:8080/
# other SysML v2 servers: name them, as for the Flask server
ALLOWED_SYSML_SERVER_ORIGINS=http://localhost:9000,http://sysml2.intercax.com:9000 python web/serve.pyserve.py uses only the Python standard library. It serves the page and relays its requests, read-only, to the SysML v2 API servers in ALLOWED_SYSML_SERVER_ORIGINS (as for the Flask server; default http://localhost:9000): a page alone can only read servers that allow requests from it (CORS), and a page on https may not call an http server. With the relay every allowed server works, e.g. http://sysml2.intercax.com:9000 or Open-MBEE Flexo. The relay listens on localhost only, allows only GET of the read endpoints (/projects, …/branches, …/commits, …/commits/{id}/elements) with the paging query, follows no redirects and passes the token on without storing it. Any other static web server works too; then only servers that allow CORS can be read.
What it shows: the project cover (purpose, owner, description, the SYSMOD version from @SYSMOD { version = … }, the cover view), the SYSMOD Atlas, completeness checks, problem statement, system idea and objectives, stakeholders, needs, system requirements, system use cases and the context diagram of all six contexts, from the brownfield to the product architecture: actors, the system of interest with its white box parts, and the interfaces with the ports they connect. It reads SYSMOD v5 (the project is an occurrence def with #project; the roles are found by their direct redefinition of the features of SYSMOD::Project). It loads a commit once (paged) and reads it in the browser. Also a .json file with the elements of a commit can be opened.
| File | What |
|---|---|
web/index.html, web/sysmod-viewer.css |
the page |
web/sysmod-viewer-core.js |
reads the SYSMOD project from the elements (pure ES module, no dependencies) |
web/sysmod-viewer-api.js |
the requests to the SysML v2 API server, paging, relay |
web/sysmod-viewer.js |
the interface; the context diagrams are SVG drawn by the page (no CDN) |
web/serve.py |
serves the page and relays the requests |
The same JavaScript runs on mbse4u.com/tools/sysmod-viewer, which in addition opens the Delivery Drone example and .sysml files with a SysML v2 engine in the browser, and reaches servers without CORS through a relay with an allowlist. Changes to the viewer belong here; the site copies them.
Read-only. Editing the problem statement, AI suggestions and the creation wizard are in the Flask server (below). Tests of serve.py: python -m pytest tests/test_web_serve.py (part of python -m pytest, no extra packages). The viewer's JavaScript is tested on mbse4u.com with the Delivery Drone model and tests/test_sysmod.sysml of this repository.
| Feature | Description |
|---|---|
| Project & Commit Selection | Browse SysML v2 projects and commits |
| SYSMOD Atlas | Completeness grid showing which artifacts exist |
| Problem Statement | Read and edit via SysML v2 API |
| System Idea | Displays description and AI-generated image |
| Context Diagrams | Brownfield, System Idea, Requirement, Functional, Logical, Product |
| Stakeholders | Lists stakeholders with attributes |
| Use Cases | Displays use cases from the model |
| Requirements | Lists system requirements with priorities and obligations |
| Feature Tree | UVL format with Mermaid graph visualization |
| Feature Binding Matrix | Not implemented yet; endpoint returns HTTP 501 |
| Quality Checks | Automated SYSMOD model completeness checks |
| AI Suggestions | GPT-4o–powered suggestions to refine artifacts |
| Cache Warmup | Bulk element loading to speed up queries |
AI-assisted multi-step creation of new SYSMOD / SysML v2 models:
| Step | Name | Description |
|---|---|---|
| 1 | Project Setup | Define system name/description; generates SysML v2 scaffold |
| 2 | Brownfield Analysis | Upload documents; AI extracts existing system context |
| 3 | Problem Statement | AI generates concise problem statement |
| 4 | Stakeholders | AI suggests stakeholder attributes |
| 5 | System Idea | AI generates description and conceptual image |
| 6 | System Requirements | AI outputs SysML v2 requirements code |
| 7 | Use Cases | AI outputs SysML v2 use case definitions |
| 8 | Product Architecture | AI outputs initial product architecture code |
Exposes 17 MCP tools — SYSMOD artifacts become directly queryable by any MCP-compatible AI agent:
| Category | Tools |
|---|---|
| Discovery | get_projects, get_commits, get_sysmod_projects, get_sysmod_project, get_element |
| Overview | get_sysmod_atlas |
| Artifacts | get_problem_statement, get_system_idea, get_system_context, get_stakeholders, get_requirements, get_use_cases, get_feature_tree, get_feature_bindings |
| Quality | run_quality_checks |
| Write | save_problem_statement |
| Cache | warmup_cache |
Example agent prompts once connected:
- "Give me a summary of what this SYSMOD project is about."
- "Run quality checks and tell me what's missing."
- "Rewrite the problem statement following the 'How can we…' pattern and save it."
- "Walk me through all system contexts from brownfield to product architecture."
sysmod-sysmlv2-api-mcp/
├── sysmod_api_server.py # Main Flask application & REST API endpoints
├── sysmod_api_helpers.py # SYSMOD-specific helper functions
├── sysmod_mcp_server.py # MCP server (wraps Flask API as MCP tools)
├── pleml_api_server.py # PLEML Flask Blueprint (feature tree & bindings)
├── pleml_api_helpers.py # PLEML helper functions
├── html/
│ ├── index.html # Project / Commit / SYSMOD Project selection
│ ├── project.html # SYSMOD Viewer dashboard
│ └── sysmod-wizard.html # AI-assisted model creation wizard
├── prompts/ # AI prompt templates for wizard steps
├── uploads/ # Uploaded reference documents (per system)
├── word/ # Word macro templates
├── .env.example # Environment variable template
└── requirements.txt
| Module | Role |
|---|---|
sysmod_api_server.py |
Main Flask app; mounts pleml_blueprint, serves all SYSMOD REST endpoints |
sysmod_api_helpers.py |
SYSMOD model queries — problem statement, system idea, contexts, requirements, etc. |
sysmod_mcp_server.py |
MCP server facade; translates MCP tool calls to Flask REST calls |
pleml_api_server.py |
Flask Blueprint for all PLEML/feature endpoints; can run standalone on port 5001 |
pleml_api_helpers.py |
Feature tree (UVL) and feature binding helpers |
- Python 3.10+
- uv (optional, for project syncing)
- Node.js / npm (required only for
mcp devinspector UI) - A running SysML v2 API server (e.g., SysML v2 Reference Implementation)
- An OpenAI API key (optional — required only for AI wizard steps and suggestions)
git clone https://github.com/Open-MBEE/sysmod-sysmlv2-api.git
cd sysmod-sysmlv2-apipython -m pip install -e .Runtime dependencies are declared in pyproject.toml. The editable install keeps the server's HTML and prompt files available from the source checkout.
To enable PDF and Word document uploads in the wizard:
python -m pip install -e ".[documents]"To enable AI features (OpenAI GPT-4o / DALL-E 3):
python -m pip install -e ".[ai]"To install the test dependency:
python -m pip install -r requirements-dev.txtWith uv, install the runtime and test dependencies with:
uv sync --extra devcopy .env.example .envEdit .env:
# OpenAI (optional)
OPENAI_API_KEY=your_openai_api_key_here
# MCP Server — URL of the running Flask server
FLASK_BASE_URL=http://localhost:5000
# Default SysML v2 context (set these for zero-config MCP tool calls)
SYSML_SERVER_URL=http://localhost:9000
SYSML_PROJECT_ID=<your-project-uuid>
SYSML_COMMIT_ID=<your-commit-uuid>
SYSML_SYSMOD_PROJECT_ID=<your-sysmod-project-element-uuid>
# Comma-separated SysML API origins allowed for outbound requests
ALLOWED_SYSML_SERVER_ORIGINS=http://localhost:9000,http://127.0.0.1:9000,http://[::1]:9000Setting the
SYSML_*variables means the AI agent can call tools without needing to pass IDs every time. For remote SysML servers, add their exact origins (scheme, host, and port) toALLOWED_SYSML_SERVER_ORIGINS. Wizard uploads are limited to 20 MB per request and supported document/text formats.
python sysmod_api_server.pyRuns on http://localhost:5000. Open in browser to use the web UI (viewer with editing and AI, wizard). For viewing only, the single-page viewer needs no server packages.
The MCP server requires the Flask server to be running first.
Run the MCP server directly. It communicates via stdin/stdout with the AI client:
python sysmod_mcp_server.pyStart the MCP server in HTTP mode so the browser inspector can connect:
# SSE transport on port 8000
python sysmod_mcp_server.py --transport sse --port 8000
# Streamable HTTP transport on port 8000 (newer)
python sysmod_mcp_server.py --transport streamable-http --port 8000Then open the MCP Inspector in your browser, set the URL to http://localhost:8000/sse (or /mcp for streamable-http), and connect.
Note
This requires uv (install) and npm to be installed and on PATH.
Windows — one-time setup:
# Install uv
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Add to PATH for this session (or add permanently via System Settings)
$env:PATH += ";$env:LOCALAPPDATA\Programs\uv\bin"
$env:PATH += ";$env:APPDATA\Python\Python313\Scripts"Launch inspector:
mcp dev sysmod_mcp_server.py --with requests --with python-dotenvAdd to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"sysmod": {
"command": "python",
"args": ["c:/path/to/sysmod-sysmlv2-api-mcp/sysmod_mcp_server.py"]
}
}
}The server reads all configuration from
.envautomatically. Restart Claude Desktop after editing.
In Cursor Settings → MCP Servers → Add:
| Field | Value |
|---|---|
| Command | python |
| Args | c:/path/to/sysmod-sysmlv2-api-mcp/sysmod_mcp_server.py |
All Flask endpoints accept and return JSON (unless noted).
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/projects |
List projects on a SysML v2 server |
POST |
/api/commits |
List commits for a project |
POST |
/api/cache/warmup |
Bulk-load elements into cache |
POST |
/api/sysmod_projects |
List SYSMOD projects in a commit |
POST |
/api/sysmod_project |
Get SYSMOD project details |
POST |
/api/element |
Get a model element by ID |
POST |
/api/problem-statement |
Get the problem statement |
POST |
/api/problem-statement/save |
Save an updated problem statement |
POST |
/api/system-idea |
Get the system idea |
POST |
/api/sysmod-context |
Get a context diagram (Brownfield, System, Functional, …) |
POST |
/api/sysmod-requirements |
Get system requirements |
POST |
/api/sysmod-usecases |
Get use cases |
POST |
/api/stakeholders |
Get stakeholders |
POST |
/api/quality-checks |
Run model quality checks |
POST |
/api/sysmod-atlas |
Get SYSMOD Atlas completeness overview |
POST |
/api/ai-suggestion_problem_statement |
AI-improved problem statement |
POST |
/api/wizard/project-setup |
Wizard Step 1 — generate SysML v2 scaffold |
GET |
/api/wizard/files |
List previously uploaded files |
POST |
/api/wizard/brownfield |
Wizard Step 2 — brownfield analysis |
POST |
/api/wizard/problem |
Wizard Step 3 — problem statement generation |
POST |
/api/wizard/stakeholders |
Wizard Step 4 — stakeholder analysis |
POST |
/api/wizard/system-idea |
Wizard Step 5 — system idea generation |
POST |
/api/wizard/system-requirements |
Wizard Step 6 — requirements generation |
POST |
/api/wizard/use-cases |
Wizard Step 7 — use case generation |
POST |
/api/wizard/product-arch |
Wizard Step 8 — product architecture |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/check-pleml |
Check if project contains a PLEML feature model |
POST |
/api/feature-bindings |
Get feature binding dependencies (@FB) |
POST |
/api/feature-bindings/toggle |
Not implemented yet; returns HTTP 501 |
POST |
/api/feature-tree-uvl |
Get the UVL feature tree |
POST |
/api/feature-tree-sysml |
Feature matrix not implemented yet; returns HTTP 501 |
| Package | Purpose |
|---|---|
mbse4u-sysmlv2-helpers |
SysML v2 API client (element queries, caching, metadata) |
flask |
Web framework and REST API |
requests |
HTTP client for SysML v2 API |
python-dotenv |
Load environment variables from .env |
anytree |
Tree data structure for model traversal |
mcp[cli] |
Model Context Protocol server SDK |
openai (optional) |
GPT-4o and DALL-E 3 for AI features |
pypdf (optional) |
PDF text extraction for document uploads |
python-docx (optional) |
Word document extraction for document uploads |
- Tim Weilkiens — MBSE4U
Licensed under the Apache License 2.0. See LICENSE for details.
- SYSMOD Methodology — The MBSE methodology this tool supports
- mbse4u-sysml-helpers on PyPI — The underlying SysML v2 Python helper library
- SysML v2 Reference Implementation — The open-source SysML v2 API server
- Model Context Protocol — The MCP specification