### Quick Start Installation for MockLoop MCP Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md This snippet provides a quick guide to install MockLoop MCP using pip and verify the installation. It also advises on configuring with an MCP client. ```bash # 1. Install MockLoop MCP pip install mockloop-mcp # 2. Verify installation mockloop-mcp --version # 3. Configure with your MCP client (Cline, Claude Desktop, etc.) # See configuration examples below ``` -------------------------------- ### Installing MockLoop MCP and Verifying Installation (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This snippet provides commands to set up a Python virtual environment, activate it, install MockLoop MCP using pip, and verify the installation by checking its version. It's recommended for isolating project dependencies and ensuring a clean development environment. ```bash python3 -m venv mockloop-env source mockloop-env/bin/activate # On Windows: mockloop-env\Scripts\activate pip install mockloop-mcp mockloop-mcp --version ``` -------------------------------- ### Installing MockLoop MCP with pipx (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs MockLoop MCP using pipx, which provides an isolated environment for the application. After installation, the command verifies the successful setup by checking the installed MockLoop MCP version. ```bash pipx install mockloop-mcp mockloop-mcp --version ``` -------------------------------- ### Setting Up Virtual Environment and Installing MockLoop MCP (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Creates and activates a Python virtual environment to manage dependencies in isolation. After activation, MockLoop MCP is installed within this environment, and its successful installation is verified by checking the version. ```bash # Create virtual environment python3 -m venv mockloop-env source mockloop-env/bin/activate # On Windows: mockloop-env\Scripts\activate # Install MockLoop MCP pip install mockloop-mcp # Verify installation mockloop-mcp --version ``` -------------------------------- ### Running Mock Server Directly with Python (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This snippet provides commands to run the mock server directly using Python. It first installs the necessary Python dependencies from `requirements_mock.txt` and then starts the FastAPI application using Uvicorn, enabling live reloading and specifying the port. ```bash pip install -r requirements_mock.txt uvicorn main:app --reload --port 8000 ``` -------------------------------- ### Starting MkDocs Documentation Server Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command starts a local development server for the MkDocs documentation, allowing real-time preview of changes. ```bash mkdocs serve ``` -------------------------------- ### MockLoop MCP Development Environment Setup Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Provides a step-by-step guide to set up the MockLoop MCP development environment. This includes cloning the repository, creating and activating a Python virtual environment, installing development dependencies, running tests, and performing quality checks using ruff and bandit. ```Bash # Fork and clone the repository git clone https://github.com/your-username/mockloop-mcp.git cd mockloop-mcp # Create development environment python3 -m venv .venv source .venv/bin/activate # Install development dependencies pip install -e ".[dev]" # Run tests pytest tests/ # Run quality checks ruff check src/ bandit -r src/ ``` -------------------------------- ### Installing Documentation Tools (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs tools required for building and generating project documentation. This includes MkDocs for static site generation, MkDocs Material for a modern theme, and MkDocstrings for generating documentation from Python docstrings. ```bash pip install mkdocs mkdocs-material mkdocstrings[python] ``` -------------------------------- ### Starting Docker Service on Linux - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command starts the Docker daemon service on Linux. It is necessary if Docker is not running, allowing Docker commands to execute successfully. ```bash sudo systemctl start docker ``` -------------------------------- ### Example Response for Server Start Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/api/admin-api.md Provides an example JSON response confirming that a mock server start operation has been initiated, including the server's ID and its new status. ```json { "id": "server_123", "status": "starting", "message": "Server start initiated" } ``` -------------------------------- ### Verifying Docker and Docker Compose Installations - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md Provides commands to check the installed versions of Docker and Docker Compose. This is a fundamental step in diagnosing and troubleshooting any Docker-related issues with MockLoop. ```bash docker --version ``` ```bash docker-compose --version ``` -------------------------------- ### Configure SchemaPin for MockLoop MCP Quick Start Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Example Python configuration for quickly enabling SchemaPin in MockLoop MCP, demonstrating basic setup, policy modes, trusted domains, and schema verification. ```python from mockloop_mcp.schemapin import SchemaPinConfig, SchemaVerificationInterceptor # Basic configuration config = SchemaPinConfig( enabled=True, policy_mode="warn", # enforce, warn, or log auto_pin_keys=False, trusted_domains=["api.example.com"], interactive_mode=False ) # Initialize verification interceptor = SchemaVerificationInterceptor(config) # Verify tool schema result = await interceptor.verify_tool_schema( tool_name="database_query", schema=tool_schema, signature="base64_encoded_signature", domain="api.example.com" ) if result.valid: print("✓ Schema verification successful") else: print(f"✗ Verification failed: {result.error}") ``` -------------------------------- ### Testing MockLoop MCP Server (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Tests the functionality of the MockLoop MCP server. For PyPI installations, it displays the help message; for development installations, it runs the MCP development server, confirming its operational status. ```bash # For PyPI installation mockloop-mcp --help # For development installation mcp dev src/mockloop_mcp/main.py ``` -------------------------------- ### Install MockLoop MCP with SchemaPin Support Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/schemapin-integration.md Install the MockLoop MCP library, which includes SchemaPin integration, using pip. Optionally, install the standalone SchemaPin library for enhanced features. ```bash # Install MockLoop MCP with SchemaPin support pip install mockloop-mcp>=2.3.0 # Optional: Install SchemaPin library for enhanced features pip install schemapin>=1.0.0 ``` -------------------------------- ### Verifying Docker Installation (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Verifies the Docker installation by checking its version and running a simple 'hello-world' container. This confirms that the Docker daemon is running and accessible, which is essential for running generated mock servers. ```bash docker --version docker run hello-world ``` -------------------------------- ### Testing MockLoop MCP CLI Help Command - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command invokes the `mockloop-mcp` CLI with the `--help` flag. A successful output indicates that the command-line tool is correctly installed and executable, providing its usage instructions. ```bash mockloop-mcp --help ``` -------------------------------- ### Complete SchemaPin Integration Example Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/schemapin-integration.md Illustrates a full integration of SchemaPin components including configuration, initialization of interceptor, key manager, and audit logger, and performing a schema verification with result logging. ```python import asyncio from mockloop_mcp.schemapin import ( SchemaPinConfig, SchemaVerificationInterceptor, KeyPinningManager, PolicyHandler, SchemaPinAuditLogger ) async def main(): # Configuration config = SchemaPinConfig( enabled=True, policy_mode="warn", trusted_domains=["api.example.com"], auto_pin_keys=True ) # Initialize components interceptor = SchemaVerificationInterceptor(config) key_manager = KeyPinningManager("keys.db") audit_logger = SchemaPinAuditLogger("audit.db") # Example tool schema tool_schema = { "name": "database_query", "description": "Execute SQL queries", "parameters": { "type": "object", "properties": { "query": {"type": "string"}, "database": {"type": "string", "default": "main"} }, "required": ["query"] } } # Verify schema result = await interceptor.verify_tool_schema( tool_name="database_query", schema=tool_schema, signature="eyJhbGciOiJFUzI1NiJ9...", domain="api.example.com" ) print(f"Verification result: {'✓' if result.valid else '✗'}") if result.valid: print(f"Key pinned: {result.key_pinned}") else: print(f"Error: {result.error}") # Get audit statistics stats = audit_logger.get_verification_stats() print(f"Total verifications: {stats.get('total_verifications', 0)}") if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Installing MockLoop MCP from PyPI (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs MockLoop MCP from the Python Package Index (PyPI). This command allows installing the latest stable version, a specific version, or versions with optional dependencies like development tools, documentation tools, or all available extras. ```bash # Install the latest stable version pip install mockloop-mcp # Or install with specific version pip install mockloop-mcp==2.1.0 # Install with optional dependencies pip install mockloop-mcp[dev] # Development tools pip install mockloop-mcp[docs] # Documentation tools pip install mockloop-mcp[all] # All optional dependencies ``` -------------------------------- ### MockLoop MCP SchemaPin Migration - Phase 1: Installation Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/schemapin-integration.md The initial phase of integrating SchemaPin into MockLoop MCP, focusing on upgrading the `mockloop-mcp` package and optionally installing the `schemapin` library. This step ensures backward compatibility. ```bash pip install --upgrade mockloop-mcp>=2.3.0 # Optional: Install SchemaPin library pip install schemapin>=1.0.0 ``` -------------------------------- ### Installing MkDocs Documentation Dependencies Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command installs all necessary Python packages required for building and serving the documentation, as specified in the `docs-requirements.txt` file. This ensures all documentation tools, themes, and plugins are available for local development and deployment. ```Shell pip install -r docs-requirements.txt ``` -------------------------------- ### Verifying MockLoop MCP Installation (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Checks if MockLoop MCP is installed and retrieves its details using `pip show`. It then verifies the installed version of MockLoop MCP, confirming successful installation. ```bash # Check if MockLoop MCP is installed pip show mockloop-mcp # Check version mockloop-mcp --version ``` -------------------------------- ### Start MockLoop MCP Server with Uvicorn Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Instructions to install dependencies and start the MockLoop MCP server using Uvicorn, enabling hot-reloading and specifying a port. ```bash pip install -r requirements_mock.txt uvicorn main:app --reload --port 8000 ``` -------------------------------- ### Running Mock Server with Docker Compose (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This command uses Docker Compose to build and start the generated mock API server. It's the recommended method as it handles containerization and dependency management, providing an isolated and consistent runtime environment for the mock server. ```bash docker-compose up --build ``` -------------------------------- ### Configuring Claude Desktop with Virtual Environment (JSON) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This alternative JSON configuration for Claude Desktop points to the Python executable within a virtual environment to launch MockLoop MCP. This ensures that Claude Desktop uses the specific MockLoop installation from the virtual environment, providing better dependency management. ```json { "mcpServers": { "mockloop": { "command": "/path/to/your/mockloop-env/bin/python", "args": ["-m", "mockloop_mcp"] } } } ``` -------------------------------- ### Starting Mock Server on Alternate Port - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md Demonstrates how to start the `uvicorn` server on a different port (e.g., 8001) using the `--port` flag. This is a solution when the default port is already occupied. ```bash uvicorn main:app --port 8001 ``` -------------------------------- ### Verifying MockLoop MCP Installation (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md These commands are used to verify that MockLoop MCP has been installed correctly. They check the installed version, run basic unit tests, and confirm the availability of the MockLoop CLI. ```Bash # Check MockLoop MCP installation python -c "import mockloop_mcp; print(mockloop_mcp.__version__)" ``` ```Bash # Run basic tests python -m pytest tests/unit/ -v ``` ```Bash # Check CLI availability mockloop --help ``` -------------------------------- ### Installing and Configuring MySQL (Bash, SQL) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This section provides commands for installing MySQL server on Ubuntu/Debian and macOS. It then includes SQL commands to create a dedicated database and user for MockLoop MCP development, along with granting necessary permissions. ```Bash # Ubuntu/Debian sudo apt-get install mysql-server ``` ```Bash # macOS with Homebrew brew install mysql brew services start mysql ``` ```SQL mysql -u root -p CREATE DATABASE mockloop_dev; CREATE USER 'mockloop_dev'@'localhost' IDENTIFIED BY 'dev_password'; GRANT ALL PRIVILEGES ON mockloop_dev.* TO 'mockloop_dev'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` -------------------------------- ### Cloning MockLoop MCP Repository (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Clones the MockLoop MCP source code repository from GitHub and navigates into the newly created directory. This is the first step for a development installation or for contributing to the project. ```bash git clone https://github.com/mockloop/mockloop-mcp.git cd mockloop-mcp ``` -------------------------------- ### Installing pipx (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs pipx, a tool for installing and running Python applications in isolated environments. This is a prerequisite for installing MockLoop MCP system-wide without affecting other Python packages. ```bash pip install pipx ``` -------------------------------- ### Uninstalling and Reinstalling MockLoop MCP - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md These commands first remove the existing `mockloop-mcp` package and then perform a fresh installation. This is useful for resolving corrupted installations or ensuring a clean state. ```bash pip uninstall mockloop-mcp pip install mockloop-mcp ``` -------------------------------- ### Installing Python Packages to User Directory - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command installs Python packages listed in `requirements.txt` into the user's local site-packages directory (`~/.local`). This avoids requiring root privileges and resolves permission issues for global installations. ```bash pip install --user -r requirements.txt ``` -------------------------------- ### Installing and Configuring PostgreSQL (Bash, SQL) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This section provides commands for installing PostgreSQL on Ubuntu/Debian and macOS, followed by SQL commands to create a dedicated database and user for MockLoop MCP development, granting necessary privileges. ```Bash # Ubuntu/Debian sudo apt-get install postgresql postgresql-contrib ``` ```Bash # macOS with Homebrew brew install postgresql brew services start postgresql ``` ```SQL sudo -u postgres psql CREATE DATABASE mockloop_dev; CREATE USER mockloop_dev WITH PASSWORD 'dev_password'; GRANT ALL PRIVILEGES ON DATABASE mockloop_dev TO mockloop_dev; \q ``` -------------------------------- ### Setting up Python Environment with uv (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This section outlines the recommended method for setting up the Python development environment using 'uv'. It covers installing 'uv', creating and activating a virtual environment, and installing all necessary development, test, and documentation dependencies. ```Bash # Install uv if not already installed curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```Bash # Create virtual environment and install dependencies uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install development dependencies uv pip install -e ".[dev,test,docs]" ``` -------------------------------- ### Installing MockLoop MCP in Development Mode (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs MockLoop MCP in editable mode, linking the package directly to the source code. This command also includes optional development, testing, and documentation dependencies, making it suitable for contributors. ```bash pip install -e ".[dev,test,docs]" ``` -------------------------------- ### Installing and Running Pre-commit Hooks (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This section details how to set up and use pre-commit hooks for automated code quality checks. It covers installing the 'pre-commit' tool, installing the configured hooks into the Git repository, and manually running them across all files. ```Bash # Install pre-commit pip install pre-commit ``` ```Bash # Install hooks pre-commit install ``` ```Bash # Run hooks manually pre-commit run --all-files ``` -------------------------------- ### Starting Generated Mock Server with Docker Compose Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/basic-usage.md Navigates into the directory of a newly generated mock server and starts it using Docker Compose in detached mode. This command assumes Docker and Docker Compose are installed and the mock server was previously generated into `generated_mocks/my_api/`. ```bash cd generated_mocks/my_api/ docker-compose up -d ``` -------------------------------- ### Installing MockLoop MCP from Specific PyPI Index - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command instructs `pip` to install `mockloop-mcp` from a specific package index URL. This is useful when the default PyPI index is inaccessible or when using a private package repository. ```bash pip install -i https://pypi.python.org/simple/ mockloop-mcp ``` -------------------------------- ### Verifying MockLoop MCP Package Installation Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command runs a Python one-liner to import the `mockloop_mcp` package and print its file path, confirming that the package is correctly installed and discoverable. ```bash python -c "import mockloop_mcp; print(mockloop_mcp.__file__)" ``` -------------------------------- ### Verifying Core Dependencies (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Lists installed Python packages and filters them to show core MockLoop MCP dependencies like FastAPI, Uvicorn, and MCP SDK components. This helps confirm that all necessary dependencies are present. ```bash pip list | grep -E "(fastapi|uvicorn|mcp|mockloop)" ``` -------------------------------- ### Checking MockLoop MCP CLI Version - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command verifies the successful installation of the `mockloop-mcp` command-line tool by displaying its version number. It confirms that the executable is accessible in the system's PATH. ```bash mockloop-mcp --version ``` -------------------------------- ### SchemaPin Gradual Rollout Migration Example Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Provides an example of configuring SchemaPin for a gradual rollout, starting with `log` mode. This allows monitoring verification events without immediate blocking, facilitating a smooth transition. ```python # Migration example: gradual rollout # Phase 1: Monitoring (log mode) config = SchemaPinConfig(enabled=True, policy_mode="log") ``` -------------------------------- ### Example Development Environment Variables (.env) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This snippet shows an example `.env` file containing various environment variables for configuring the MockLoop MCP development environment, including database settings, logging levels, development flags, testing URLs, and API keys. ```bash # Database MOCKLOOP_DATABASE_TYPE=sqlite MOCKLOOP_DATABASE_PATH=./dev.db # Logging MOCKLOOP_LOG_LEVEL=debug MOCKLOOP_LOG_FORMAT=text # Development MOCKLOOP_DEBUG=true MOCKLOOP_RELOAD=true # Testing MOCKLOOP_TEST_DATABASE_URL=sqlite:///test.db MOCKLOOP_TEST_REDIS_URL=redis://localhost:6379/1 # API Keys (for testing) MOCKLOOP_TEST_API_KEY=test-key-12345 ``` -------------------------------- ### Installing Code Quality Tools (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs common Python development tools for code quality, linting, type checking, and testing. These include Black for code formatting, Flake8 for linting, Mypy for static type checking, and Pytest for unit testing. ```bash pip install black flake8 mypy pytest ``` -------------------------------- ### Installing Documentation Dependencies for Local CI Testing Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command ensures all documentation-related Python packages are installed, mirroring the environment used in continuous integration (CI). This is a prerequisite for locally testing the exact build process used for deployment, ensuring consistency. ```Shell pip install -r docs-requirements.txt ``` -------------------------------- ### Creating Dockerfile for MockLoop MCP Development (Dockerfile) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This `Dockerfile.dev` defines the build process for the MockLoop MCP development container. It installs necessary system dependencies, sets up the Python environment, copies project files, installs Python dependencies including `debugpy` for remote debugging, and exposes application and debug ports. ```dockerfile FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ build-essential \ libpq-dev \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /workspace # Install Python dependencies COPY requirements-dev.txt . RUN pip install --no-cache-dir -r requirements-dev.txt # Install debugpy for remote debugging RUN pip install debugpy # Copy source code COPY . . # Install in development mode RUN pip install -e ".[dev,test]" # Expose ports EXPOSE 8000 5678 # Default command CMD ["python", "-m", "mockloop_mcp.main", "serve"] ``` -------------------------------- ### Install MockLoop MCP via pip Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Provides the command to install the MockLoop MCP library using pip, the Python package installer. This is the primary method for users to get started with the AI-native API testing platform. ```Bash pip install mockloop-mcp ``` -------------------------------- ### Navigating and Listing Generated Mock Server Files (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This bash snippet demonstrates how to navigate into the newly generated mock server directory and list its contents. This helps users verify the successful generation of files like `main.py`, `Dockerfile`, and `docker-compose.yml`, which form the core of the mock server. ```bash cd generated_mocks/petstore_api/ ls -la ``` -------------------------------- ### Run Basic SchemaPin Usage Example Source: https://github.com/mockloop/mockloop-mcp/blob/main/examples/schemapin/README.md This command executes the basic_usage.py script, demonstrating fundamental SchemaPin operations including configuration management, basic schema verification workflow, key pinning and retrieval, policy enforcement scenarios, audit logging, and configuration persistence. ```bash python examples/schemapin/basic_usage.py ``` -------------------------------- ### Running SchemaPin Integration Tests (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/examples/schemapin/README.md Provides command-line instructions to execute the comprehensive test suite for SchemaPin integration, including unit tests, integration tests, and example scripts to demonstrate basic and advanced usage. ```bash # Unit tests python -m pytest tests/unit/test_schemapin_integration.py -v # Integration tests python -m pytest tests/integration/test_schemapin_integration.py -v # Run examples python examples/schemapin/basic_usage.py python examples/schemapin/advanced_usage.py ``` -------------------------------- ### Creating Development Virtual Environment (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Creates and activates a dedicated Python virtual environment named `.venv` within the project directory. This isolates development dependencies from the system Python installation, ensuring a clean and reproducible development setup. ```bash python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` -------------------------------- ### Testing Mock Server: Get Pets by Status (Curl) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This `curl` command sends a GET request to the mock server to retrieve pets based on their status. It demonstrates how to query an API endpoint with a query parameter, expecting a list of available pets as a response from the mock server. ```bash curl http://localhost:8000/pet/findByStatus?status=available ``` -------------------------------- ### Viewing Docker Compose Service Logs - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md Shows how to retrieve and display the logs from Docker Compose services. Analyzing these logs is critical for identifying errors and understanding the operational status of containerized mock servers. ```bash docker-compose logs ``` -------------------------------- ### Serving MkDocs Documentation Locally Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command starts a local development server for the MkDocs documentation, allowing real-time preview of changes. It typically runs on `http://127.0.0.1:8000` and automatically reloads the browser on file modifications, streamlining the writing process. ```Shell mkdocs serve ``` -------------------------------- ### Checking Docker Service Status on Linux - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command checks the current status of the Docker daemon service on Linux systems. It helps diagnose if Docker is running or if there are issues preventing it from starting. ```bash sudo systemctl status docker ``` -------------------------------- ### Testing Mock Server: Get Specific Pet by ID (Curl) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This `curl` command sends a GET request to the mock server to fetch details of a specific pet by its ID. It illustrates accessing a resource via a path parameter, expecting the mock server to return the corresponding pet's data. ```bash curl http://localhost:8000/pet/1 ``` -------------------------------- ### Checking MockLoop MCP Installation Location - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command displays detailed information about the `mockloop-mcp` package, including its installed location. This helps verify if the package is installed in the expected Python environment. ```bash pip show mockloop-mcp ``` -------------------------------- ### Initialize Basic SchemaPin Configuration Source: https://github.com/mockloop/mockloop-mcp/blob/main/examples/schemapin/README.md This snippet demonstrates how to create a basic SchemaPin configuration object. It enables SchemaPin, sets the policy mode to 'warn', disables auto-key pinning, specifies trusted domains, and disables interactive mode, providing a starting point for integration. ```python from mockloop_mcp.schemapin import SchemaPinConfig config = SchemaPinConfig( enabled=True, policy_mode="warn", # enforce, warn, or log auto_pin_keys=False, trusted_domains=["api.example.com"], interactive_mode=False ) ``` -------------------------------- ### Initialize Production SchemaPin Configuration Source: https://github.com/mockloop/mockloop-mcp/blob/main/examples/schemapin/README.md This example shows a more robust SchemaPin configuration suitable for production environments. It enforces policies, enables auto-key pinning, specifies a secure key storage path, sets discovery timeouts and cache TTLs, defines multiple trusted domains and well-known endpoints, and enables revocation checks for enhanced security. ```python config = SchemaPinConfig( enabled=True, policy_mode="enforce", auto_pin_keys=True, key_pin_storage_path="/secure/path/keys.db", discovery_timeout=60, cache_ttl=7200, trusted_domains=[ "api.corp.com", "tools.internal.com" ], well_known_endpoints={ "api.corp.com": "https://api.corp.com/.well-known/schemapin.json" }, revocation_check=True, interactive_mode=False ) ``` -------------------------------- ### Verifying MockLoop Server Startup Output Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md This snippet shows the expected console output when the MockLoop server successfully starts using Uvicorn. It indicates that the server is running, listening on `http://0.0.0.0:8000`, and has completed its startup process, ready to serve requests. ```plaintext INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: Started reloader process [1234] using StatReload INFO: Started server process [5678] INFO: Waiting for application startup. INFO: Application startup complete. ``` -------------------------------- ### Checking Installed MockLoop Packages - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command checks if any `mockloop` related packages are currently installed in the Python environment. It pipes the output of `pip list` to `grep` to filter for 'mockloop' entries. ```bash pip list | grep mockloop ``` -------------------------------- ### Perform Development Installation of MockLoop MCP Source: https://github.com/mockloop/mockloop-mcp/blob/main/README.md Steps to set up MockLoop MCP for development, including cloning the repository, creating and activating a virtual environment, and installing dependencies in development mode. ```bash # Clone the repository git clone https://github.com/mockloop/mockloop-mcp.git cd mockloop-mcp # Create and activate virtual environment python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install in development mode pip install -e ".[dev]" ``` -------------------------------- ### Configuring Cline MCP Server with Virtual Environment (JSON) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This JSON configuration is an alternative for Cline, specifying the full path to the Python executable within a virtual environment to run MockLoop MCP. This ensures that the correct Python interpreter and its installed packages are used for the MCP server, especially when not in the system PATH. ```json { "mcpServers": { "MockLoopLocal": { "autoApprove": [], "disabled": false, "timeout": 60, "command": "/path/to/your/mockloop-env/bin/python", "args": ["-m", "mockloop_mcp"], "transportType": "stdio" } } } ``` -------------------------------- ### Installing MockLoop MCP with Increased Timeout - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command increases the network timeout for `pip` operations to 60 seconds. It helps prevent installation failures in environments with slow or unreliable network connections. ```bash pip install --timeout 60 mockloop-mcp ``` -------------------------------- ### Building MkDocs Documentation Site Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command compiles the MkDocs source files into a static HTML website, typically outputting to a `site/` directory. This generated site can then be deployed to a web server or GitHub Pages, making the documentation accessible online. ```Shell mkdocs build ``` -------------------------------- ### Verifying Docker Compose Installation (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Checks the installed version of Docker Compose. Docker Compose is often included with Docker Desktop, and this command confirms its availability for orchestrating multi-container Docker applications. ```bash # Usually included with Docker Desktop docker-compose --version ``` -------------------------------- ### Create an MCP Plugin for Shodan API in Proxy Mode Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/mcp-proxy-guide.md This example shows how to configure an MCP plugin to operate in 'proxy' mode, forwarding all requests to the live Shodan API. It requires a distinct plugin name, the target URL, and correct authentication credentials for the live API. This setup is used for integration testing against real-time data. ```python # Create a plugin configured for Proxy Mode proxy_plugin_result = await create_mcp_plugin( spec_url_or_path="https://api.shodan.io/openapi.json", mode="proxy", # Set mode to proxy plugin_name="shodan_api_proxy_instance", # Consider a distinct name for clarity target_url="https://api.shodan.io", # Required for proxy/hybrid modes auth_config={ # Ensure authentication is correctly configured for the live API "auth_type": "api_key", "credentials": {"api_key": "YOUR_ACTUAL_SHODAN_API_KEY"}, # Use your live API key "location": "query", "name": "key" } ) # The plugin 'shodan_api_proxy_instance' will now operate by forwarding requests to 'https://api.shodan.io'. ``` -------------------------------- ### Installing py-spy Profiler Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command installs the `py-spy` performance profiling tool using pip, which allows for non-intrusive profiling of Python programs. ```bash pip install py-spy ``` -------------------------------- ### Python Dependencies (`requirements_mock.txt`) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md A list of Python package dependencies required to run the generated mock server directly using `pip`. These packages include FastAPI for the web framework, Uvicorn for the ASGI server, and other utilities necessary for the mock server's functionality. ```text fastapi>=0.104.1 uvicorn[standard]>=0.24.0 pydantic>=2.5.0 jinja2>=3.1.2 aiofiles>=23.2.1 python-multipart>=0.0.6 ``` -------------------------------- ### Checking for Conflicting MockLoop Installations - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command lists all installed Python packages and filters for `mockloop` related entries. It helps identify if multiple versions or conflicting `mockloop` packages are present, which can cause import issues. ```bash pip list | grep mockloop ``` -------------------------------- ### Serving Built MkDocs Site Locally Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md After building the documentation, this command navigates into the `site/` directory and uses Python's built-in HTTP server to serve the static files on port `8080`. This allows for local verification of the final deployed website, ensuring all assets are correctly rendered. ```Shell cd site && python -m http.server 8080 ``` -------------------------------- ### Reinstalling MockLoop MCP in Current Environment - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md These commands first uninstall and then reinstall `mockloop-mcp`. This ensures the package is correctly installed within the currently active Python environment, resolving potential conflicts or partial installations. ```bash pip uninstall mockloop-mcp pip install mockloop-mcp ``` -------------------------------- ### Run Mock Server with Docker Compose Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md Bash commands to build and start the mock server using Docker Compose. The `--build` flag ensures the Docker image is built from the Dockerfile, and the `-d` flag allows running the container in detached (background) mode. ```bash # Build and start the container docker-compose up --build # Or run in background docker-compose up -d --build ``` -------------------------------- ### Example Response for Server Creation Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/api/admin-api.md Provides an example JSON response after successfully initiating the creation of a new mock server. It confirms the server's ID, name, initial status, port, and output directory. ```json { "id": "server_456", "name": "New API Mock", "status": "starting", "port": 8001, "output_directory": "./generated_mocks/new_api_mock", "created_at": "2024-01-01T16:00:00Z", "message": "Server creation initiated" } ``` -------------------------------- ### Updating pip for PyPI Troubleshooting (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Upgrades the pip package installer to its latest version. This is a common first step when encountering 'Package Not Found' or other installation issues from PyPI, as older pip versions might have outdated index caches. ```bash # Update pip to latest version pip install --upgrade pip ``` -------------------------------- ### Building MkDocs Documentation with Clean and Strict Modes Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command builds the documentation, first cleaning the `site/` directory to ensure a fresh build, and then running in strict mode to catch any warnings or errors. This replicates the CI build process for local verification, ensuring deployment readiness. ```Shell mkdocs build --clean --strict ``` -------------------------------- ### Docker Compose Configuration (`docker-compose.yml`) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md The Docker Compose configuration file for the mock server. It defines a service named `petstore-mock` that builds from the current directory, maps port 8000, and mounts local `db` and `logs` directories into the container for data persistence and logging. ```yaml version: '3.8' services: petstore-mock: build: . ports: - "8000:8000" volumes: - ./db:/app/db - ./logs:/app/logs environment: - PYTHONUNBUFFERED=1 ``` -------------------------------- ### Run Advanced SchemaPin Usage Example Source: https://github.com/mockloop/mockloop-mcp/blob/main/examples/schemapin/README.md This command executes the advanced_usage.py script, showcasing production-ready patterns and advanced scenarios such as batch verification for performance, MCP proxy integration patterns, error recovery and monitoring, performance metrics collection, and concurrent verification handling. ```bash python examples/schemapin/advanced_usage.py ``` -------------------------------- ### Installing Package in Development Mode Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/contributing/development-setup.md This command installs the current Python package in 'editable' or 'development' mode, allowing changes to the source code to be reflected without reinstallation. ```bash pip install -e . ``` -------------------------------- ### Testing Mock Server: Create New Pet (Curl) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This `curl` command sends a POST request to the mock server to create a new pet. It includes the `Content-Type` header and a JSON body with the pet's name and status, demonstrating how to interact with a creation endpoint. ```bash curl -X POST http://localhost:8000/pet \ -H "Content-Type: application/json" \ -d '{"name": "Fluffy", "status": "available"}' ``` -------------------------------- ### Installing MockLoop MCP with Explicit PyPI Index (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Installs MockLoop MCP by explicitly specifying the PyPI simple index URL. This can be used as a workaround if pip is having trouble resolving the package from its default sources, often due to network or configuration issues. ```bash # Try with explicit index pip install --index-url https://pypi.org/simple/ mockloop-mcp ``` -------------------------------- ### Run Mock Server with Python Directly Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md Bash commands to install the required Python dependencies and then start the FastAPI mock server directly using Uvicorn. The `--reload` flag enables auto-reloading on code changes, and `--port 8000` specifies the listening port for the server. ```bash # Install dependencies pip install -r requirements_mock.txt # Start the server uvicorn main:app --reload --port 8000 ``` -------------------------------- ### Installing MockLoop MCP via HTTP Proxy - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command configures `pip` to use a specified HTTP proxy for network requests during installation. It's essential for environments behind corporate firewalls or proxy servers, requiring `user:password@proxy.server:port` format. ```bash pip install --proxy http://user:password@proxy.server:port mockloop-mcp ``` -------------------------------- ### Checking Available Python 3 Versions - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md These commands check the installed versions of Python 3, specifically `python3`, `python3.10`, and `python3.11`. This helps identify which Python interpreters are available on the system. ```bash python3 --version python3.10 --version python3.11 --version ``` -------------------------------- ### Mock Server Generation Console Output Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md Example console output displayed by MockLoop MCP after successfully generating a mock API server. It confirms the steps taken during generation and provides immediate instructions for starting the generated server using Docker Compose or Python directly. ```text ✅ Downloaded OpenAPI specification from https://petstore3.swagger.io/api/v3/openapi.json ✅ Parsed API specification: Swagger Petstore - OpenAPI 3.0 ✅ Found 19 endpoints across 3 tags ✅ Generated FastAPI application with authentication middleware ✅ Created admin UI with logging capabilities ✅ Generated Docker configuration ✅ Mock server created successfully in: generated_mocks/my_first_petstore_mock/ Your mock server is ready! To start it: 1. cd generated_mocks/my_first_petstore_mock/ 2. docker-compose up --build OR pip install -r requirements_mock.txt && uvicorn main:app --reload ``` -------------------------------- ### Checking Python Version (Bash) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Verifies the installed Python version. MockLoop MCP requires Python 3.9 or higher, so this command confirms that the system meets the minimum Python version requirement. ```bash python --version # Should show Python 3.9 or higher ``` -------------------------------- ### Petstore OpenAPI Specification URL Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/first-mock-server.md The recommended OpenAPI specification URL for beginners to generate a mock server. This URL points to the Petstore API v3 definition, which is used as the basis for the mock server. ```text https://petstore3.swagger.io/api/v3/openapi.json ``` -------------------------------- ### Generating Mock API Server via MCP Tool (Natural Language) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/quick-start.md This command, intended for an MCP client, instructs MockLoop MCP to generate a mock API server. It takes the URL of an OpenAPI specification (Petstore API in this case) as input, which MockLoop will use to define the mock server's structure and endpoints. ```natural language Please generate a mock API server using the Petstore OpenAPI specification: https://petstore3.swagger.io/api/v3/openapi.json ``` -------------------------------- ### Create SchemaPin Configuration Object Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/guides/schemapin-integration.md Initialize a SchemaPinConfig object to define the system's behavior, including enabling verification, setting the policy mode, and configuring key pinning storage. This is the first step in customizing SchemaPin for your environment. ```python from mockloop_mcp.schemapin import SchemaPinConfig config = SchemaPinConfig( enabled=True, policy_mode="warn", # Start with warn mode auto_pin_keys=False, key_pin_storage_path="./schemapin_keys.db" ) ``` -------------------------------- ### Installing MockLoop MCP with Trusted Hosts - Bash Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md This command temporarily bypasses SSL certificate validation by explicitly trusting `pypi.org` and `pypi.python.org`. It's a temporary workaround for SSL errors, not a permanent solution. ```bash pip install --trusted-host pypi.org --trusted-host pypi.python.org mockloop-mcp ``` -------------------------------- ### Testing MockLoop MCP Python Import (Python) Source: https://github.com/mockloop/mockloop-mcp/blob/main/docs/getting-started/installation.md Executes a Python command to import the `mockloop_mcp` module and print a success message. This verifies that the MockLoop MCP package is correctly installed and discoverable by Python. ```python python -c "import mockloop_mcp; print('MockLoop MCP imported successfully')" ```