CLI tool and MCP server for validating Revit Property Set (PSET) definition files
A straightforward validator that implements the exact parsing logic from Revit IFC source code (PropertyMap.cs) and checks for common issues. The tool works both as a standalone CLI and as an MCP server.
- ✅ Exact Revit Parsing Logic - Matches PropertyMap.cs behavior exactly
- ✅ Critical Validation - Detects entity name case issues (IFCSPACE vs IfcSpace)
- ✅ Comprehensive Checks - Validates data types, structure, duplicates, and more
- ✅ CLI Tool - Standalone command-line interface
- ✅ MCP Server - Model Context Protocol server for AI integration
- ✅ Clear Error Messages - Line numbers and suggestions for fixes
- ✅ JSON Output - Machine-readable output for automation
# Clone repository
git clone https://github.com/byggstyrning/revit-pset-validator.git
cd revit-pset-validator
# Install dependencies
pip install -e .
# Or install with dev dependencies
pip install -e ".[dev]"pip install revit-pset-validator# Validate a PSET file
python -m pset_validator PSET-SPECIFIC.txt
# JSON output for automation
python -m pset_validator PSET-SPECIFIC.txt --format json
# Exit code on errors (for CI/CD)
python -m pset_validator PSET-SPECIFIC.txt --exit-code
# Treat warnings as errors
python -m pset_validator PSET-SPECIFIC.txt --warnings-as-errors --exit-codeThe FastMCP server can be used with Cursor or Claude Desktop. Add to your MCP configuration:
For Cursor:
-
First, install the package:
pip install -e . -
Then configure in Cursor settings → MCP servers:
{ "mcpServers": { "pset-validator": { "command": "python", "args": ["-m", "pset_validator.server"], "env": {} } } } -
Restart Cursor after adding the MCP server configuration.
Note: Make sure the python command points to the same Python environment where you installed the package. You can verify with:
python -c "import pset_validator; print('OK')"For Claude Desktop:
Add to claude_desktop_config.json:
{
"mcpServers": {
"pset-validator": {
"command": "python",
"args": ["-m", "pset_validator.server"],
"env": {}
}
}
}Or run standalone:
python -m pset_validator.serverAvailable MCP Tools:
validate_pset_file(file_path: str)- Validate a PSET file from diskvalidate_pset_content(content: str)- Validate PSET content from string
- Entity Name Case: Must be
IfcSpace, notIFCSPACE(case-sensitive - critical!) - Entity Format:
Ifc+EntityName(proper camelCase) - Property Set Structure: Correct format with tab-separated columns
- Data Types: Valid Revit data types (LABEL, TEXT, BOOLEAN, INTEGER, REAL, etc.)
- Required Fields: PropertySet line must have name, level (I/T), and entity list
- File Format: Proper tab-separated format for property lines
- Duplicate Properties: Same property name within a property set
- Duplicate Property Sets: Same property set name for same entities
- Empty Property Sets: Property sets with no properties defined
- Missing Revit Parameters: Warn when Revit parameter column is empty
- Properties Outside PropertySet: Properties defined before PropertySet declaration
# User Defined PropertySet Definition File
PropertySet: BIP I IfcWall
BSABe LABEL BSABe
BSABwr LABEL BSABwr
TypeID LABEL
Validating: PSET-SPECIFIC.txt
Property Sets: 14
Properties: 185
============================================================
[OK] File is valid!
Validating: PSET.txt
Property Sets: 6
Properties: 174
============================================================
[ERROR] Errors: 1
ERROR: Line 2: Entity name 'IFCSPACE' uses wrong case (all uppercase)
-> Use 'IfcSpace' instead of 'IFCSPACE'
[WARNING] Warnings: 1
WARNING: Line 5: Property 'TypeID' missing Revit parameter mapping
-> Add Revit parameter name in third column (optional but recommended)
============================================================
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src/pset_validator --cov-report=html
# Run specific test file
pytest tests/unit/test_parser.py -v# Format code
black src/ tests/
# Lint code
ruff check src/ tests/revit-pset-validator/
├── src/
│ └── pset_validator/
│ ├── __init__.py
│ ├── __main__.py # CLI entry point
│ ├── server.py # FastMCP server (MCP mode)
│ ├── validator.py # Core validation logic
│ ├── parser.py # PSET file parsing (matches PropertyMap.cs)
│ └── models.py # Pydantic models for validation results
├── tests/
│ ├── resources/ # Test resources
│ │ ├── DefaultUserDefinedParameterSets.txt # Official Autodesk template
│ │ └── test_sample.pset.txt # Test PSET file
│ ├── unit/
│ │ ├── test_parser.py
│ │ ├── test_validator.py
│ │ └── test_models.py
│ └── integration/
│ └── test_cli.py
├── pyproject.toml
└── README.md
The parser implements the exact logic from Revit IFC PropertyMap.cs (lines 327-393):
- Line Processing: Trim leading spaces/tabs, skip empty lines and comments
- PropertySet Line: Case-insensitive "PropertySet:" prefix, at least 4 tab-separated parts
- Property Line: At least 2 tab-separated parts, only processed inside PropertySet block
- Entities: Separated by comma, semicolon, or space
- Properties Outside PropertySet: Silently skipped (not errors)
LABEL, TEXT, BOOLEAN, INTEGER, REAL, AREA, VOLUME, POSITIVELENGTH, LENGTH, IDENTIFIER, THERMALTRANSMITTANCE, COUNT, CURRENCY, ELECTRICALCURRENT, FORCE, FREQUENCY, ILLUMINANCE, LOGICAL, LUMINOUSFLUX, NORMALISEDRATIO, PLANEANGLE, POSITIVEPLANEANGLE, POSITIVERATIO, POWER, PRESSURE, RATIO, THERMODYNAMICTEMPERATURE, VOLUMETRICFLOWRATE, COLORTEMPERATURE, ELECTRICALEFFICACY, ELECTRICALVOLTAGE, CLASSIFICATIONREFERENCE
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
- Revit IFC Export PropertyMap.cs
- MCP Configuration Guide - Detailed MCP server setup instructions
- revit-ifc - Official Autodesk Revit IFC exporter source code