Text2Sim MCP Server 标志

Text2Sim MCP Server

组织
IamCatoBot

Text2Sim MCP Server is a conversational simulation engine that transforms natural language into working simulation models. Supporting Discrete-Event Simulation (DES) and System Dynamics (SD), it integrates with LLMs via the Model Context Protocol (MCP) to transform plain English descriptions into simulation models within environments like Claude.

发布者IamCatoBot
代码仓库text2sim-MCP-server
语言Python
复刻数
8
星标数
25
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Text2Sim MCP Server 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 25 个星标和 8 个复刻。

Header Image

Text2Sim MCP Server

Multi-paradigm Simulation Engine for LLM Integration

A Model Context Protocol server providing multi-paradigm simulation capabilities through conversational interfaces. The server supports Discrete-Event Simulation via SimPy and System Dynamics modeling via PySD and a PySD-compatible JSON schema.

Overview

Text2Sim MCP Server enables Large Language Models to create, validate, and execute simulation models through natural language interfaces. The server processes JSON-structured simulation configurations and returns execution results with comprehensive analytics.

Supported Simulation Paradigms

  • Discrete-Event Simulation (DES): Process-oriented modeling using SimPy engine
  • System Dynamics (SD): Stock-and-flow modeling using PySD and PySD-compatible JSON schema

Text2Sim MCP Server (demo)


About

The Text2Sim MCP Server is an open source project developed by The Cato Bot Company Limited. We believe in transparent, commercially-backed open source development that benefits both users and contributors while supporting sustainable project growth. Community contributions are accepted through standard pull request procedures.


Installation

Prerequisites

Install uv

On macOS and Linux:

bash
curl -LsSf https://astral.sh/uv/install.sh | sh

On Windows (PowerShell):

powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Learn more: astral-sh/uv


Quick Start

Clone the repository

bash
git clone https://github.com/IamCatoBot/text2sim-MCP-server.git
cd text2sim-MCP-server

Install dependencies

bash
uv sync

Integration with Claude Desktop

  1. Open:

Claude > Settings > Developer > Edit Config > claude_desktop_config.json

  1. Add the following block:
json
{
  "mcpServers": {
    "Text2Sim MCP Server": {
      "command": "uv",
      "args": [
        "--directory",
        "PATH_TO_TEXT2SIM_MCP_SERVER",
        "run",
        "python",
        "-m",
        "mcp_server"
      ],
      "env": {}
    }
  }
}

Note: Replace PATH_TO_TEXT2SIM_MCP_SERVER with the actual path to your cloned repository. If the uv command is not found, run which uv (Unix) or Get-Command uv (PowerShell) and use the full path in the "command" field.


Features

LLM Integration

  • Natural language to simulation model conversion
  • Multi-round conversation support for iterative model development
  • JSON Schema 2020-12 validation for configuration reliability
  • Contextual error messages with corrective guidance
  • Model persistence across conversation sessions

Discrete-Event Simulation Capabilities

  • Multiple entity types with configurable priorities and attributes
  • Resource management with FIFO, priority, and preemptive scheduling
  • Entity behavior modeling including balking and reneging
  • Resource failure and repair cycle simulation
  • Configurable metrics collection and reporting

System Dynamics Capabilities

  • PySD-compatible JSON schema
  • Stock, flow, and auxiliary variable modeling
  • Mathematical expression support via Abstract Syntax Tree structures
  • Time-series simulation with configurable parameters
  • Integration with PySD Python library ecosystem

Analytics and Validation

  • Simulation metrics including wait times, utilization rates, and throughput
  • Statistical analysis with warmup periods and confidence intervals
  • Multi-mode validation with partial, strict, and structural checking
  • Schema-specific error reporting and correction guidance

Model Management

  • Model storage and retrieval with metadata tracking
  • JSON export functionality for model sharing and backup
  • Automatic schema detection for DES and SD model types
  • Version management with conflict resolution

Documentation System

  • Context-aware schema documentation with examples
  • Multiple detail levels (brief, standard, detailed)
  • Domain-specific modeling patterns and workflows
  • Integrated help system accessible through MCP tools

Security

  • Regex-based distribution parsing without code execution
  • Input validation against formal JSON schemas
  • Secure error handling without internal state exposure

Architecture

Modular Design

Text2Sim MCP Server v2.6.0 features a completely refactored modular architecture that improves maintainability, testability, and extensibility:

mcp_server/
├── __init__.py              # Package exports and version info
├── server.py                # Main server entry point
├── registry.py              # Centralized tool registration
├── shared/                  # Common utilities
│   ├── error_handlers.py    # Standardized error handling
│   ├── response_builders.py # Response formatting utilities
│   └── integration_layer.py # SD integration with fallbacks
└── tools/                   # Domain-specific tool modules
    ├── des_tools.py         # DES simulation tools
    ├── sd_tools.py          # SD simulation tools
    ├── model_mgmt_tools.py  # Model lifecycle management
    ├── validation_tools.py  # Validation and help tools
    └── template_tools.py    # Template management tools

Key Improvements

  • Separation of Concerns: Each domain has its own focused module
  • Standardized Error Handling: Consistent error responses with actionable guidance
  • Enhanced Integration: Robust SD integration with graceful fallbacks
  • Professional Standards: Comprehensive documentation and type hints
  • Extensibility: Easy to add new simulation paradigms or tools

API Reference

MCP Tools Overview

The server exposes 16 tools across 5 categories through the Model Context Protocol:

Core Simulation Tools

simulate_des - Execute Discrete-Event Simulation models

  • Accepts JSON configuration with entity types, resources, and processing rules
  • Returns simulation results with metrics and statistical analysis

simulate_sd - Execute System Dynamics models

  • Accepts PySD-compatible abstractModel JSON format
  • Returns time-series data and model execution metadata

run_multiple_simulations - Execute multiple simulation replications

  • Runs multiple independent simulation runs with statistical analysis
  • Returns confidence intervals, variability measures, and reliability scoring
  • Supports seed-based random number control for reproducible results

Validation and Help Tools

validate_model - Validate simulation model configurations

  • Supports both DES and SD model validation with auto-detection
  • Provides detailed error reports with correction suggestions
  • Multiple validation modes: partial, strict, and structural

help_validation - Get validation guidance

  • Shows all available validation tools and when to use each one
  • Provides troubleshooting guidance for validation errors
  • Includes schema type detection and validation mode explanations

get_schema_help - Access comprehensive schema documentation

  • Returns structured documentation for schema sections with examples
  • Supports nested section paths (e.g., "processing_rules.steps")
  • Multiple detail levels: brief, standard, and detailed
  • Domain-specific examples and workflow guidance

Model Management Tools

save_model - Store models with metadata

  • Automatic naming with domain detection
  • Metadata tracking including validation status and tags
  • Version management with conflict resolution

load_model - Retrieve stored models

  • List all saved models with filtering options
  • Load specific models by name or identifier
  • Integration with last-loaded state tracking

export_model - Export models to JSON

  • Multiple output formats for different use cases
  • Conversation-ready templates for session sharing
  • Token count estimation for LLM context management

Template and Discovery Tools

list_templates - Browse available model templates

  • Lists pre-built templates for both DES and SD models
  • Filter by schema type, domain, or complexity level
  • Includes template descriptions and use cases

load_template - Retrieve specific templates

  • Load template configurations by name or template ID
  • Returns ready-to-use model configurations
  • Supports both DES and SD template formats

save_template - Save models as reusable templates

  • Store validated models as templates for future use
  • Automatic template naming with metadata
  • Template sharing and organization capabilities

delete_template - Remove user templates

  • Safe deletion with confirmation requirements
  • Protects built-in templates from accidental removal
  • Provides backup recommendations

System Dynamics Specific Tools

get_sd_model_info - Analyze System Dynamics models

  • Provides detailed analysis of SD model structure without simulation
  • Returns complexity metrics and variable information
  • Validates abstractModel format and reports structure analysis

convert_vensim_to_sd_json - Convert Vensim models to PySD JSON

  • Converts Vensim .mdl files to PySD-compatible abstractModel format
  • Handles model translation and format validation
  • Integration with PySD's Vensim translation capabilities

Enhanced Tools (New in v2.6.0)

delete_model - Safe model deletion

  • Remove saved models with confirmation requirements
  • Provides model metadata before deletion
  • Includes undo suggestions and safety features

JSON Schemas

Text2Sim MCP Server uses formal JSON Schema validation (Draft 2020-12) to ensure simulation model correctness and provide structured error reporting. The server supports two distinct JSON formats optimized for their respective simulation paradigms.

Discrete-Event Simulation JSON Format

The server uses a SimPy-compatible JSON schema for Discrete-Event Simulation models. This format provides declarative configuration that maps directly to SimPy's native capabilities.

Basic Structure

json
{
  "run_time": 480,
  "entity_types": {
    "customer": {
      "probability": 1.0,
      "value": {"min": 10, "max": 50},
      "priority": 5
    }
  },
  "resources": {
    "server": {
      "capacity": 2,
      "resource_type": "fifo"
    }
  },
  "processing_rules": {
    "steps": ["server"],
    "server": {
      "distribution": "uniform(5, 10)"
    }
  }
}

Key Components

  • Entity Types: Define different classes of entities with probabilities, values, priorities, and custom attributes
  • Resources: Specify system resources with capacity limits and queuing disciplines (FIFO, priority, preemptive)
  • Processing Rules: Configure sequential processing steps with service time distributions and conditional routing
  • Behavioral Rules: Support for balking, reneging, resource failures, and complex routing logic

Resource Types

  • FIFO: First-in-first-out queuing (SimPy Resource)
  • Priority: Priority-based queuing (SimPy PriorityResource)
  • Preemptive: Preemptive priority queuing (SimPy PreemptiveResource)

For detailed documentation of the DES JSON format, see schemas/DES/README.md.

System Dynamics JSON Format

The server uses a PySD-compatible JSON schema for System Dynamics simulations. This format provides direct compatibility with the PySD Python library ecosystem.

Basic Structure

json
{
  "abstractModel": {
    "originalPath": "model_name.json",
    "sections": [{
      "name": "__main__",
      "type": "main",
      "elements": [
        {
          "name": "Stock_Name",
          "components": [{
            "type": "Stock",
            "ast": {
              "syntaxType": "IntegStructure",
              "flow": {"syntaxType": "ReferenceStructure", "reference": "Flow_Name"},
              "initial": {"syntaxType": "ReferenceStructure", "reference": "1000"}
            }
          }],
          "units": "items"
        }
      ]
    }]
  }
}

Component Types

  • Stock: Accumulation variables that integrate flows over time
  • Flow: Rate variables that change stock values
  • Auxiliary: Calculated variables derived from other variables

Abstract Syntax Tree (AST) Structures

The PySD format supports two approaches for mathematical expressions:

  • Simple References: String-based expressions (e.g., "Birth_Rate - Death_Rate")
  • Arithmetic Structures: Explicit mathematical structures with defined operators and arguments

For detailed documentation of the PySD JSON format, see docs/PYSD_JSON_SCHEMA_INTEGRATION.md, docs/PYSD_AST_STRUCTURES_GUIDE.md, and schemas/SD/README.md.


Architecture

Text2Sim is structured into modular components:

  • MCP Server – Handles natural language requests via MCP.
  • Discrete-Event Simulation (DES) Module
    • Simulation Model – Core SimPy engine that executes process flows.
    • Entity Class – Represents units flowing through the system.
    • Process Steps – Encapsulate logic for each process stage.
    • Metrics Collector – Gathers statistics like wait times and throughput.
    • Secure Distribution Parser – Parses probability distributions safely.
  • System Dynamics (SD) Module
    • PySD Integration – Executes models using PySD-compatible abstractModel JSON format.
    • Schema Validation – Validates models against abstract_model_v2.json schema.
    • Single-Schema Architecture – Direct PySD workflow compatibility without format conversion.

Documentation

Additional technical documentation is available:

  • docs/PYSD_JSON_SCHEMA_INTEGRATION.md - PySD JSON format specification
  • docs/PYSD_AST_STRUCTURES_GUIDE.md - AST structure patterns and best practices
  • schemas/SD/README.md - System Dynamics schema documentation
  • schemas/DES/README.md - Discrete-Event Simulation schema files
  • SINGLE_SCHEMA_ARCHITECTURE.md - Architecture overview and design decisions

Security Considerations

  • No eval() usage
    Regex-based parsing prevents arbitrary code execution.

  • Input Validation
    Distribution types, parameters, and model configurations are validated before execution.

  • Robust Error Handling
    Errors are reported cleanly without leaking internal state.


Disclaimer

Text2Sim MCP Server is a project under active development. While we strive for accuracy and stability, please be aware of the following:

  • Work in Progress: The software is continuously evolving. Features may change, and you may encounter bugs or incomplete functionality. We welcome bug reports and contributions to help us improve!
  • LLM-Powered Tool: This server is designed to be used with Large Language Models (LLMs). The quality of the simulation models and the accuracy of the results depend heavily on the LLM's capabilities.
  • Verify Your Results: Always critically review and validate any simulation models and their outputs. The results should be used as a guide and not as a substitute for professional validation.

We are excited for you to use Text2Sim and hope you find it valuable. Your feedback is crucial to its development.


Contributing

Contributions are accepted through standard fork-and-pull-request procedures. Bug reports and feature suggestions can be submitted via the project issue tracker.

Major changes should be discussed before implementation. The project is under active development and architectural decisions may change.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Citation

For academic use, cite as:

Maniatis, N. (2025). Text2Sim MCP Server (v2.6.0). https://github.com/IamCatoBot/text2sim-MCP-server Copyright The Cato Bot Company Limited and contributors. Licensed under MIT.


安装

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "iamcatobot-text2sim-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

将 Text2Sim MCP Server MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Text2Sim MCP Server 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 Text2Sim MCP Server 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Text2Sim MCP Server MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "iamcatobot-text2sim-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "text2sim-MCP-server"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Text2Sim MCP Server MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Text2Sim MCP Server MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Text2Sim MCP Server 帮我完成这项任务吗?
Text2Sim MCP Server
当然,我看过了。
以下是我使用 Text2Sim MCP Server 得到的结果。

常见问题

Text2Sim MCP Server MCP 服务器有什么用途?

Text2Sim MCP Server 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Text2Sim MCP Server MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 Text2Sim MCP Server。

为什么在 TypingMind 中使用 Text2Sim MCP Server MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 Text2Sim MCP Server 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Text2Sim MCP Server MCP 连接到 TypingMind?

Text2Sim MCP Server 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Text2Sim MCP Server MCP 在 TypingMind 中提供哪些工具?

Text2Sim MCP Server 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Text2Sim MCP Server MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 Text2Sim MCP Server 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇