Skip to main content
Glama
bim2sim-mcp

bim2sim-mcp

by l4b4r4b4b4

BIM2Sim MCP

CI PyPI version Python 3.12+ License: MIT

GHCR

MCP server for BIM-to-building-energy simulation workflows with IFC extraction, TEASER integration, scenario modeling, weather binding, and results export for downstream WAT/ROI analysis

Built with FastMCP and mcp-refcache for efficient handling of large data in AI agent tools.

Features

  • ✅ Reference-Based Caching - Return references instead of large data, reducing context window usage

  • ✅ Preview Generation - Automatic previews for large results (sample, truncate, paginate strategies)

  • ✅ Pagination - Navigate large datasets without loading everything at once

  • ✅ Access Control - Separate user and agent permissions for sensitive data

  • ✅ Private Computation - Let agents compute with values they cannot see

  • ✅ Docker Ready - Production-ready containers with Python slim base image

  • ✅ GitHub Actions - CI/CD with PyPI publishing and GHCR containers

  • ✅ Langfuse Tracing - Built-in observability integration

  • ✅ Type-Safe - Full type hints with Pydantic models

  • ✅ Testing Ready - pytest with 73% coverage requirement

  • ✅ Pre-commit Hooks - Ruff formatting and linting

Related MCP server: real-estate-sustainability-mcp

Quick Start

Prerequisites

  • Python 3.12+

  • uv (recommended) or pip

Installation

# Clone the repository
git clone https://github.com/l4b4r4b4b4/bim2sim-mcp
cd bim2sim-mcp

# Install dependencies
uv sync

# Run the server (stdio mode for Claude Desktop)
uv run bim2sim-mcp

# Run the server (SSE/HTTP mode for deployment)
uv run bim2sim-mcp --transport sse --port 8000

Install from PyPI

# Run directly with uvx (no install needed)
uvx bim2sim-mcp stdio

# Or install globally
uv tool install bim2sim-mcp
bim2sim-mcp --help

Docker Deployment

# Pull and run from GHCR
docker pull ghcr.io/l4b4r4b4b4/bim2sim-mcp:latest
docker run -p 8000:8000 ghcr.io/l4b4r4b4b4/bim2sim-mcp:latest

# Or build locally with Docker Compose
docker compose up

# Build images manually
docker compose --profile build build base
docker compose build

Using with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "bim2sim-mcp": {
      "command": "uv",
      "args": ["run", "bim2sim-mcp"],
      "cwd": "/path/to/bim2sim-mcp"
    }
  }
}

Using with Zed

The project includes .zed/settings.json pre-configured for MCP context servers.

Project Structure

bim2sim-mcp/
├── app/                     # Application code
│   ├── __init__.py          # Version export
│   ├── server.py            # Main server with tools
│   ├── tools/               # Tool modules
│   └── __main__.py          # CLI entry point
├── tests/                   # Test suite
│   ├── conftest.py          # Pytest fixtures
│   └── test_server.py       # Server tests
├── docker/
│   ├── Dockerfile.base      # Python slim base image with dependencies
│   ├── Dockerfile           # Production image (extends base)
│   └── Dockerfile.dev       # Development with hot reload
├── .github/
│   └── workflows/
│       ├── ci.yml           # CI pipeline (lint, test, security)
│       ├── publish.yml      # PyPI trusted publisher
│       └── release.yml      # Docker build & publish to GHCR
├── .agent/                  # AI assistant workspace
│   └── goals/
│       └── 00-Template-Goal/  # Goal tracking template
├── pyproject.toml           # Project config
├── docker-compose.yml       # Local development & production
├── flake.nix                # Nix dev shell
└── .rules                   # AI assistant guidelines

Development

Setup

# Install dependencies
uv sync

# Install pre-commit and pre-push hooks
uv run pre-commit install --install-hooks
uv run pre-commit install --hook-type pre-push

Running Tests

uv run pytest
uv run pytest --cov  # With coverage

Linting and Formatting

uv run ruff check . --fix
uv run ruff format .

Type Checking

uv run mypy app/

Docker Development

# Run development container with hot reload
docker compose --profile dev up

# Build base image (for publishing)
docker compose --profile build build base

# Build all images
docker compose build

Using Nix (Optional)

nix develop  # Enter dev shell with all tools

Configuration

Environment Variables

Variable

Description

Default

LANGFUSE_PUBLIC_KEY

Langfuse public key

-

LANGFUSE_SECRET_KEY

Langfuse secret key

-

LANGFUSE_HOST

Langfuse host URL

https://cloud.langfuse.com

CLI Commands

uvx bim2sim-mcp --help

Commands:
  stdio             Start server in stdio mode (for Claude Desktop and local CLI)
  sse               Start server in SSE mode (Server-Sent Events)
  streamable-http   Start server in streamable HTTP mode (recommended for remote/Docker)

# Examples:
uvx bim2sim-mcp stdio                          # Local CLI mode
uvx bim2sim-mcp sse --port 8000                # SSE on port 8000
uvx bim2sim-mcp streamable-http --host 0.0.0.0 # Docker/remote mode

CI/CD Workflow

This project uses a CI-gated workflow to ensure code quality and safe releases:

┌─────────────────────────────────────────────────────────────┐
│  Feature Branch → Open PR                                   │
│         ↓                                                    │
│  CI Runs (lint, test, security)                            │
│         ↓                                                    │
│  ✅ CI Must Pass (enforced by branch protection)           │
│         ↓                                                    │
│  Merge to main                                              │
└─────────────────────────────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  CI Re-runs on main                                         │
│         ↓                                                    │
│  Release Workflow waits for CI Success                      │
│         ↓                                                    │
│  Docker Images Built & Pushed to GHCR                       │
└─────────────────────────────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  Manually Create GitHub Release                             │
│         ↓                                                    │
│  Publish Workflow verifies Release succeeded                │
│         ↓                                                    │
│  Package Published to PyPI                                  │
└─────────────────────────────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  CD Workflow deploys (staging/production)                   │
└─────────────────────────────────────────────────────────────┘

Key Safeguards:

  • ✅ Branch protection ensures CI passes before merge

  • ✅ Tag pushes verify CI passed before building images

  • ✅ Publish workflow verifies Release succeeded before PyPI upload

  • ✅ CD workflow only deploys after Release completes

Manual Gates:

  • 🔒 Creating GitHub Release (allows review before PyPI publish)

  • 🔒 Production deployments (requires manual approval)

Publishing

PyPI

Configure trusted publisher at PyPI:

  • Project name: bim2sim-mcp

  • Owner: l4b4r4b4b4

  • Repository: bim2sim-mcp

  • Workflow: publish.yml

  • Environment: pypi

Docker Images

Images are automatically published to GHCR on:

  • Push to main branch → latest tag

  • Version tags (v*.*.*) → latest, v0.0.1, 0.0.1, 0.0 tags

License

MIT License - see LICENSE for details.

Contributing

See CONTRIBUTING.md for development guidelines.

Available Tools

11 tools
admin_clear_namespaceA

Clear all references in a namespace.

⚠️ ADMIN ONLY - Requires elevated permissions. ⚠️ DESTRUCTIVE - This action cannot be undone.

Args: namespace: The namespace to clear (e.g., 'user:alice'). include_children: Also clear child namespaces (default: True).

Returns: Confirmation with count of deleted references.

Inputs: namespace (required), include_children. Returns: object

admin_delete_referenceA

Delete a specific cached reference.

⚠️ ADMIN ONLY - Requires elevated permissions. ⚠️ DESTRUCTIVE - This action cannot be undone.

Args: ref_id: The reference ID to delete.

Returns: Confirmation of deletion or error.

Inputs: ref_id (required). Returns: object

admin_get_cache_statsA

Get detailed cache statistics.

⚠️ ADMIN ONLY - Requires elevated permissions.

Returns: Dictionary with cache statistics including: - Total references and counts by namespace - Active vs expired reference counts - Value type breakdown - Cache configuration

Inputs: no named parameters. Returns: object

admin_get_reference_infoA

Get detailed information about a cached reference.

⚠️ ADMIN ONLY - Requires elevated permissions.

Args: ref_id: The reference ID to look up.

Returns: Dictionary with detailed reference information (value not included).

Inputs: ref_id (required). Returns: object

admin_list_referencesA

List cached references with optional filtering.

⚠️ ADMIN ONLY - Requires elevated permissions.

Args: namespace: Filter by namespace (e.g., 'public', 'user:alice'). include_expired: Include expired references in results. include_preview: Include value previews in results. limit: Maximum number of results (default: 50, max: 100). offset: Offset for pagination.

Returns: Dictionary with references list and pagination info.

Inputs: limit, offset, namespace, include_expired, +1 more. Returns: object

enable_test_contextA

Enable or disable test context mode for Langfuse attribution demos.

When enabled, all traces will include user_id, session_id, and metadata from the MockContext. This allows testing Langfuse filtering and aggregation without a real FastMCP authentication setup.

Args: enabled: Whether to enable test context mode (default: True).

Returns: Status dict with current test mode state and context values.

Inputs: enabled. Returns: object

get_cached_resultA

Retrieve a cached result, optionally with pagination.

Use this to:

  • Get a preview of a cached value

  • Paginate through large lists

  • Access the full value of a cached result

All cache operations are traced to Langfuse with hit/miss status.

Args: ref_id: Reference ID to look up. page: Page number (1-indexed). page_size: Items per page. max_size: Maximum preview size (overrides defaults).

Returns: The cached value or a preview with pagination info.

Caching: Large results are returned as references with previews.

Pagination: Use page and page_size to navigate results.

References: This tool accepts ref_id from previous tool calls.

Inputs: ref_id (required), page, max_size, page_size. Returns: object

get_trace_infoA

Get information about the current Langfuse trace and context.

Returns metadata about Langfuse tracing status and current context values for debugging.

Returns: Dict with Langfuse configuration and current context.

Inputs: no named parameters. Returns: object

health_checkA

Check server health status.

Returns: Health status information including Langfuse tracing status.

Inputs: no named parameters. Returns: object

reset_test_contextB

Reset test context to default demo values.

Returns: Reset context state.

Inputs: no named parameters. Returns: object

set_test_contextA

Set test context values for Langfuse attribution demos.

Changes here affect what user_id, session_id, and metadata are sent to Langfuse traces. Use this to test filtering by different users or sessions in the Langfuse dashboard.

Args: user_id: User identity (e.g., "alice", "bob"). org_id: Organization identity (e.g., "acme", "globex"). session_id: Session identifier for grouping traces. agent_id: Agent identity (e.g., "claude", "gpt4").

Returns: Updated context state and example of Langfuse attributes.

Inputs: org_id, user_id, agent_id, session_id. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 11 tools

    Disambiguation4/5

    Tools are mostly distinct, with clear separation between test context management, cache admin operations, and health check. The only minor overlap is between admin_get_reference_info and get_cached_result, but the distinction (metadata vs. value) is clear.

    Naming Consistency4/5

    Non-admin tools follow a verb_noun pattern (enable_test_context, set_test_context, get_cached_result), while admin tools consistently use an 'admin_' prefix. This is a predictable convention, though health_check is a slight deviation.

    Tool Count5/5

    11 tools is well-scoped for a caching and tracing server, covering test context, cache retrieval, admin functions, and health monitoring without unnecessary bloat.

    Completeness4/5

    Cache operations cover retrieval, deletion, listing, info, stats, and namespace clearing, which is comprehensive. Test context has enable, set, reset, and get info. The only gap is no explicit cache creation tool, but that is likely automatic from other operations.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers