mcp_bundle library

MCP Bundle - Schema, models, loader, validator, expression language, and port contracts.

This package provides tools for working with MCP Bundle data:

  • Data models for all bundle sections (UI, Flow, Skills, etc.)
  • Bundle loading and parsing
  • Schema validation
  • Expression language for dynamic content
  • Integrity verification
  • Port contracts for inter-package communication

Classes

AbsolutePeriod
Absolute period - a fixed date range.
ActionDef
Action definition.
ArrayExpr
Array literal expression.
Asset
Individual asset definition.
AssetBundle
Asset bundle for grouped assets.
AssetDirectory
Asset directory definition.
AssetSection
Asset section containing static resources.
AuthConfig
Authentication configuration.
BinaryExpr
Binary expression (+, -, *, /, ==, !=, etc.).
BindingSection
Binding section containing data bindings.
Bundle
A bundle containing packaged MCP resources.
BundleBuilder
Builder for creating bundles programmatically.
BundleDependency
Dependency on another bundle.
BundleLoader
Loads and parses MCP bundles from various sources.
BundleManifest
Bundle manifest containing metadata and configuration.
BundleResource
A resource within a bundle.
BundleSource
Bundle source information.
BundleValidator
Validates MCP bundles against schema and rules.
CallExpr
Function call expression.
Canonicalizer
Canonicalizes JSON data for consistent representation.
ChunkingConfig
Chunking configuration.
Claim
A verifiable assertion extracted from content or generated by skill execution.
ClaimDef
Claim definition.
ComputedValue
Computed value definition.
ConditionalExpr
Conditional/ternary expression (cond ? then : else).
Confidence
Utility class for confidence calculations.
ContentHash
Content hash with algorithm information.
ContentResolver
Resolves content references to actual content.
CoverageConfig
Coverage configuration.
DataBinding
Data binding definition.
DataSource
Data source definition.
DateRange
Helper class for resolved date ranges.
DependencyResolver
Resolves bundle dependencies.
EmbeddingConfig
Embedding configuration.
EmptyLlmPort
Empty LLM port that throws on use.
ErrorHandler
Error handler definition.
EvaluationContext
Context for expression evaluation.
EvaluationResult
Result of expression evaluation.
EventPort
Event port for pub/sub.
ExpectedResult
Expected result definition.
Expr
Base class for all AST nodes.
ExpressionEvaluator
Evaluates expressions in a given context.
ExpressionFunctions
Registry of built-in expression functions.
ExprVisitor<T>
Visitor pattern for AST traversal.
FileContentResolver
Default file-based content resolver.
FlowDefinition
Flow definition.
FlowOutput
Flow output definition.
FlowParameter
Flow parameter definition.
FlowSection
Flow section containing flow definitions.
FlowStep
Flow step definition.
FlowTrigger
Flow trigger definition.
GroupingExpr
Grouping expression (parentheses).
HybridWeights
Hybrid search weights.
IdentifierExpr
Identifier reference (variable name).
IndexConfig
Index configuration.
IndexExpr
Index access expression (arrindex).
InMemoryEventPort
In-memory event port for testing.
InMemoryKvStoragePort
In-memory KV storage for testing.
InMemoryStoragePort<T>
In-memory typed storage for testing.
IntegrityChecker
Integrity checker for MCP bundles.
IntegrityError
Integrity error.
IntegrityResult
Bundle integrity verification result.
InterpolationExpr
String interpolation expression (${...}).
JsonComparator
JSON deep equality comparison.
KnowledgeDocument
Knowledge document.
KnowledgeSection
Knowledge section containing knowledge sources.
KnowledgeSource
Knowledge source definition.
KnowledgeSourceRef
Knowledge source reference.
KvStoragePort
Key-value storage port.
LambdaExpr
Lambda/arrow function expression (x => x * 2).
Lexer
Lexer for the MCP Expression Language.
LifecycleHooks
Lifecycle hooks.
LiteralExpr
Literal value (number, string, boolean, null).
LlmCapabilities
LLM capabilities configuration.
LlmChunk
Streaming chunk.
LlmMessage
LLM message for multi-turn conversations.
LlmPort
Abstract LLM Port interface.
LlmRequest
LLM request.
LlmResponse
LLM response.
LlmTool
Tool definition for function calling.
LlmToolCall
Tool call from LLM.
LlmUsage
Token usage information.
LoaderOptions
Options for loading bundles.
LoadResult<T>
Load result containing the loaded bundle and any issues.
LogicalExpr
Logical expression (and, or, &&, ||).
McpBundle
A complete MCP Bundle containing all packaged resources.
McpToolRef
MCP tool reference.
MemberExpr
Member access expression (obj.field or obj?.field).
MetricEvent
Metric event for streaming.
MetricPort
Metric computation port.
MetricValue
Metric value.
Navigation configuration.
Navigation guard.
ObjectExpr
Object literal expression.
OutputSchema
Output schema definition.
ParameterDef
Parameter definition.
ParameterSchema
Parameter schema for inputs/outputs.
Parser
Parser for the MCP Expression Language.
Period
Base class for Period types.
PipeExpr
Pipe expression (value | filter).
PlatformRequirements
Platform requirements for the bundle.
PortEvent
Event data.
ProcedureStep
Procedure step.
ProfileManifest
Profile manifest schema.
ProfileSection
Profile section.
RefreshConfig
Refresh configuration.
RelativePeriod
Relative period - a duration from reference time backwards.
ReporterConfig
Reporter configuration.
RerankConfig
Reranking configuration.
RetrieverConfig
Retriever configuration.
RetryConfig
Retry configuration.
RouteDefinition
Route definition.
RubricCriterion
Rubric criterion.
ScoringLevel
Scoring level.
ScreenDefinition
Screen definition.
SkillConfig
Shared skill configuration.
SkillManifest
Skill manifest schema.
SkillModule
Skill module definition.
SkillOutput
Skill output definition.
SkillParameter
Skill parameter definition.
SkillProcedure
Skill procedure definition.
SkillRubric
Skill rubric for evaluation.
SkillSection
Skill section containing skill modules.
SkillStep
A step within a skill.
SkillTrigger
Skill trigger definition.
SourceReference
Source reference for external sources.
StateDefinition
State definition.
StepAction
Step action definition.
StoragePort<T>
Generic storage port for typed entities.
StubLlmPort
Stub LLM port for testing.
StubMetricPort
Stub metric port for testing.
TestAssertion
Test assertion.
TestCase
Test case definition.
TestConfig
Global test configuration.
TestFixture
Test fixture definition.
TestSection
Test section containing test definitions.
TestStep
Test step definition.
TestSuite
Test suite definition.
ThemeConfig
Theme configuration.
Token
A token produced by the lexer.
UiSection
UI section containing screens and widgets.
UnaryExpr
Unary expression (!, -, not).
ValidationContext
Validation context for tracking state during validation.
ValidationError
Validation error (blocks validation).
ValidationIssue
Base class for validation issues.
ValidationResult
Result of bundle validation.
ValidationRule
A custom validation rule.
ValidationWarning
Validation warning (non-blocking issue).
ValidatorOptions
Options for bundle validation.
WidgetDefinition
Reusable widget definition.
WidgetNode
Widget node in the UI tree.

Enums

ActionType
Action types.
AssertionType
Assertion types.
AssetType
Asset types.
AuthType
Authentication types.
BindingDirection
Binding directions.
BundleType
Bundle types.
ChunkingStrategy
Chunking strategies.
ClaimStatus
Validation state of the claim.
ClaimType
Semantic type of the claim content.
ComparisonOperator
Comparison operators.
ConfidenceLevel
Semantic ranges for confidence interpretation.
DataSourceType
Data source types.
DocumentFormat
Document formats.
HashAlgorithm
Supported hash algorithms.
IndexType
Index types.
IntegrityErrorType
Types of integrity errors.
KnowledgeSourceType
Knowledge source types.
LoadStrategy
Asset load strategies.
Navigation types.
PeriodUnit
Period unit for relative periods.
ReferenceType
Reference types.
RefreshMode
Refresh modes.
ReporterType
Reporter types.
ResourceType
Types of resources that can be in a bundle.
ResultType
Result types.
RetrievalMode
Retrieval modes.
SkillTriggerType
Skill trigger types.
SourceType
Source type for bundle loading.
StepActionType
Step action types.
StepType
Step types.
TestType
Test types.
TokenType
Token types for the expression language.
TriggerType
Trigger types.
ValidationSeverity
Severity levels for validation issues.

Extensions

BundleExtensions on Bundle
Utility functions for working with bundles.

Constants

bundleSchemaVersion → const String
Version of the bundle schema.
canonicalizer → const Canonicalizer
Default canonicalizer instance.
currentSchemaVersion → const String
Version of the bundle schema.
integrityChecker → const IntegrityChecker
Default integrity checker instance.
jsonComparator → const JsonComparator
Default JSON comparator instance.
keywords → const Map<String, TokenType>
Keywords map.

Functions

canonicalizeJson(dynamic value) String
Canonicalize JSON value.
cosineSimilarity(List<double> a, List<double> b) double
Cosine similarity helper.
jsonEquals(dynamic a, dynamic b) bool
Compare JSON values for equality.
profileToResource(ProfileManifest profile, {String? path}) BundleResource
Create a BundleResource from a ProfileManifest.
sha256Hash(List<int> bytes) ContentHash
Compute SHA-256 hash of bytes.
sha256HashJson(dynamic value) ContentHash
Compute SHA-256 hash of JSON value.
sha256HashString(String content) ContentHash
Compute SHA-256 hash of string.
skillToResource(SkillManifest skill, {String? path}) BundleResource
Create a BundleResource from a SkillManifest.
verifyIntegrity(List<int> bytes, String hashString) bool
Verify content against hash.

Typedefs

ExprFunction = dynamic Function(List args)
Type alias for expression functions.

Exceptions / Errors

EvaluationException
Exception thrown during expression evaluation.
LexerException
Lexer exception for invalid input.
ParserException
Parser exception for syntax errors.