Skip to main content
Glama

IDS MCP サーバー

AIを活用した、IDS 1.0標準に100%準拠するbuildingSMART IDSファイルの作成

buildingSMART IDS 1.0標準に完全に準拠したInformation Delivery Specification(IDS)ファイルを、AIエージェントが決定論的に作成、検証、管理できるようにするMCP(Model Context Protocol)サーバーです。

ifc-ids-mcp MCP server

License: MIT Python 3.8+ Code style: black

特徴

  • IDS 1.0に100%準拠 - すべてのエクスポートは公式XSDスキーマに対して検証されます

  • IfcTester統合 - 公式のIfcOpenShellライブラリを使用

  • FastMCPコンテキストベースのセッション - 自動セッション管理

  • テスト駆動開発 - 包括的なテストにより95%以上のコードカバレッジを確保

  • 決定論的な出力 - 同じ入力からは常に同一の出力が生成されます

  • 型安全性 - Pydantic検証による完全な型ヒント

クイックスタート

インストール

# Clone repository
git clone https://github.com/Quasar-Consulting-Group/ifc-ids-mcp.git
cd ifc-ids-mcp

# Install dependencies
pip install -r requirements.txt

# Install in development mode
pip install -e .

Claude Desktopでの使用

Claude Desktopの設定(claude_desktop_config.json)に追加します:

{
  "mcpServers": {
    "ids-mcp": {
      "command": "python",
      "args": ["-m", "ids_mcp_server"],
      "env": {
        "IDS_LOG_LEVEL": "INFO"
      }
    }
  }
}

プログラムによる使用

from ifctester import ids

# The MCP server handles this automatically via tools
# But you can also use IfcTester directly:

# Create new IDS
my_ids = ids.Ids(title="Project Requirements")

# Add specification
spec = ids.Specification(name="Wall Requirements", ifcVersion=["IFC4"])
spec.applicability.append(ids.Entity(name="IFCWALL"))

requirement = ids.Property(
    baseName="FireRating",
    propertySet="Pset_WallCommon",
    cardinality="required"
)
spec.requirements.append(requirement)

my_ids.specifications.append(spec)

# Export to XML
my_ids.to_xml("requirements.ids")

利用可能なMCPツール

ドキュメント管理

  • create_ids - 新しいIDSドキュメントを作成

  • load_ids - ファイルまたはXML文字列から既存のIDSを読み込み

  • export_ids - 検証付きでIDSをXMLにエクスポート

  • get_ids_info - ドキュメント構造とメタデータを取得

仕様管理

  • add_specification - IFCバージョンとカーディナリティを指定して仕様を追加

ファセット管理

基本ファセット

  • add_entity_facet - IFCエンティティタイプフィルターを追加(例:IFCWALL)

  • add_property_facet - プロパティ要件を追加

  • add_attribute_facet - IFC属性要件を追加

高度なファセット

  • add_classification_facet - 分類要件を追加

  • add_material_facet - 材料要件を追加

  • add_partof_facet - 空間関係要件を追加

制限管理

  • add_enumeration_restriction - 有効な値のリストに制限

  • add_pattern_restriction - 正規表現パターンで制限

  • add_bounds_restriction - 数値範囲で制限

  • add_length_restriction - 文字列の長さを制限

検証

  • validate_ids - XSDスキーマに対してIDSドキュメントを検証

  • validate_ifc_model - IDSに対してIFCモデルを検証(ボーナス機能)

事前検証と制約チェック

このMCPサーバーには、エクスポート時まで待つのではなく、ツールが呼び出された瞬間にIDS 1.0スキーマ違反を捕捉する事前検証が含まれています。これにより、AIエージェントに明確で実行可能なエラーメッセージを提供します。

IDS 1.0スキーマの制約

1. 適用範囲ごとに1つのエンティティファセット

制約: IDS 1.0では、仕様の適用範囲セクションごとにエンティティファセットは1つしか許可されません。

事前検証: add_entity_facetツールは、ファセットを追加する前にこの制約を検証します:

# ✅ CORRECT: First entity facet
add_entity_facet(spec_id="S1", location="applicability", entity_name="IFCWALL")

# ❌ INCORRECT: Second entity facet raises ToolError immediately
add_entity_facet(spec_id="S1", location="applicability", entity_name="IFCDOOR")
# Error: "IDS 1.0 XSD constraint violation: Only ONE entity facet is allowed..."

回避策: エンティティタイプごとに個別の仕様を作成してください:

# Specification 1: Walls
add_specification(name="Wall Requirements", ifc_versions=["IFC4"], identifier="S1")
add_entity_facet(spec_id="S1", location="applicability", entity_name="IFCWALL")

# Specification 2: Doors
add_specification(name="Door Requirements", ifc_versions=["IFC4"], identifier="S2")
add_entity_facet(spec_id="S2", location="applicability", entity_name="IFCDOOR")

2. プロパティファセットにはプロパティセットが必要

制約: IfcTesterは、有効なIDSエクスポートのためにproperty_setパラメータを必要とします。

事前検証: add_property_facetツールは、ファセットを追加する前にこの要件を検証します:

# ❌ INCORRECT: Missing property_set raises ToolError immediately
add_property_facet(
    spec_id="S1",
    location="requirements",
    property_name="FireRating"
)
# Error: "Property facet validation error: 'property_set' parameter is required..."

# ✅ CORRECT: Include property_set parameter
add_property_facet(
    spec_id="S1",
    location="requirements",
    property_name="FireRating",
    property_set="Pset_WallCommon"
)

一般的なプロパティセット:

  • Pset_WallCommon - 壁のプロパティ

  • Pset_DoorCommon - ドアのプロパティ

  • Pset_WindowCommon - 窓のプロパティ

  • Pset_SpaceCommon - スペースのプロパティ

  • Pset_Common - カスタム/汎用プロパティ

事前検証の利点

  1. 即時フィードバック - エクスポート時ではなく、ツール呼び出し時にエラーを捕捉

  2. 明確なエラーメッセージ - 回避策と例を含む

  3. 無効な状態の防止 - 作成中を通じてIDSドキュメントが有効に保たれる

  4. AIエージェントの体験向上 - エージェントが実行可能なガイダンスを受け取れる

IDS 1.0の制約に関する詳細なドキュメントはCLAUDE.mdを参照してください。

アーキテクチャ

┌─────────────────────────────────────────────┐
│           AI Agent (Claude, GPT)             │
└────────────────────┬────────────────────────┘
                     │ MCP Protocol
┌────────────────────▼────────────────────────┐
│            FastMCP Server                    │
│  ┌──────────────────────────────────────┐   │
│  │     MCP Tools (15+ tools)            │   │
│  └───────────────┬──────────────────────┘   │
│  ┌───────────────▼──────────────────────┐   │
│  │     Session Manager (Context)        │   │
│  └───────────────┬──────────────────────┘   │
│  ┌───────────────▼──────────────────────┐   │
│  │  IfcTester Integration (IDS Engine)  │   │
│  └──────────────────────────────────────┘   │
└─────────────────────────────────────────────┘
                     │
                     ▼
        IDS XML File (100% XSD compliant)

開発

テスト駆動開発

このプロジェクトは厳格にTDD手法に従います:

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=src/ids_mcp_server --cov-report=html

# Run specific test category
pytest tests/unit/ -v        # Unit tests
pytest tests/integration/ -v  # Integration tests
pytest tests/validation/ -v   # XSD validation tests

# Must maintain 95%+ coverage
pytest tests/ --cov-fail-under=95

TDDワークフロー (Red-Green-Refactor)

  1. RED - 失敗するテストを書く

  2. GREEN - パスするための最小限のコードを実装する

  3. REFACTOR - コードの品質を向上させる

例:

# RED: Write failing test
def test_create_specification():
    result = add_specification(name="Test", ifc_versions=["IFC4"])
    assert result["status"] == "success"

# GREEN: Implement
def add_specification(name, ifc_versions):
    return {"status": "success"}

# REFACTOR: Improve (keep tests passing)

コード品質

# Format code
black src/ tests/

# Lint code
ruff check src/ tests/

# Type checking (optional)
mypy src/

プロジェクト構造

ifc-ids-mcp/
├── src/
│   └── ids_mcp_server/
│       ├── __init__.py
│       ├── __main__.py
│       ├── server.py          # FastMCP server
│       ├── config.py          # Configuration
│       ├── version.py         # Version management
│       ├── session/           # Session management
│       │   ├── manager.py
│       │   ├── storage.py
│       │   ├── cleanup.py
│       │   └── models.py      # Session data models
│       └── tools/             # MCP tools (17 total)
│           ├── document.py
│           ├── specification.py
│           ├── facets.py
│           ├── restrictions.py    # Phase 007
│           ├── validation.py      # Phase 008
│           └── validators.py      # Early validation helpers
├── tests/                     # 168 tests, 94% coverage
│   ├── unit/                  # Unit tests
│   ├── component/             # Component tests
│   ├── integration/           # Integration tests
│   └── validation/            # XSD compliance tests
│       └── fixtures/          # Test fixtures
├── samples/                   # Sample IDS/IFC files
│   ├── wall_fire_rating.ids
│   └── walls-fire-rating.ifc
├── specs/                     # Implementation plans (PRDs)
├── .mcp.json                  # MCP server configuration
├── .coveragerc                # Coverage configuration
├── constitution.md            # Project principles
├── DESIGN_SPECIFICATION.md    # Technical specification
├── CLAUDE.md                  # AI agent guide
├── pyproject.toml
├── pytest.ini
└── README.md

憲法原則

このプロジェクトは、譲れない6つの原則に従います:

  1. 100% IDSスキーマ準拠 - すべてのエクスポートはXSDに対して検証される

  2. テスト駆動開発 - 95%以上のカバレッジ、コードより先にテストを書く

  3. IfcTester統合を最優先 - カスタムXML生成は行わない

  4. 決定論的な生成 - 同一の入力 = 同一の出力

  5. FastMCPコンテキストベースのセッション - 自動セッション管理

  6. Pythonのベストプラクティス - 型ヒント、PEP 8、モダンなPython

詳細はconstitution.mdを参照してください。

ドキュメント

依存関係

コア

  • fastmcp - MCPサーバーフレームワーク

  • ifctester - IDSオーサリングおよび検証(IfcOpenShellより)

  • pydantic - データ検証

開発

  • pytest - テストフレームワーク

  • pytest-asyncio - 非同期テストサポート

  • pytest-cov - カバレッジレポート

  • black - コードフォーマット

  • ruff - リンティング

参照

ライセンス

MITライセンス - 詳細はLICENSEファイルを参照してください

貢献

  1. プロジェクトの原則についてはconstitution.mdを読んでください

  2. TDD手法(Red-Green-Refactor)に従ってください

  3. 95%以上のテストカバレッジを確保してください

  4. すべてのエクスポートはIDS 1.0 XSDに対して検証される必要があります

  5. すべてのIDS操作にはIfcTesterを使用してください

サポート


ステータス: ✅ 実装完了 | 94% テストカバレッジ | 17 MCPツール | 168 テスト | 事前検証済み

IfcOpenShellFastMCPを使用して❤️を込めて構築

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinnividivicci/ifc-ids-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server