Skip to main content

hedl_mcp/
lib.rs

1// Dweve HEDL - Hierarchical Entity Data Language
2//
3// Copyright (c) 2025 Dweve IP B.V. and individual contributors.
4//
5// SPDX-License-Identifier: Apache-2.0
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License in the LICENSE file at the
10// root of this repository or at: http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! HEDL Model Context Protocol (MCP) Server
19//!
20//! This crate provides an MCP server that allows AI/LLM systems to interact
21//! with HEDL files and the HEDL ecosystem. Key features:
22//!
23//! - **Read HEDL files** from a directory with graph-aware lookups
24//! - **Query entities** by type and ID via the reference registry
25//! - **Validate HEDL** input with detailed error reporting
26//! - **Optimize JSON to HEDL** for token-efficient context injection
27//! - **Get token statistics** comparing HEDL vs JSON representations
28
29#![cfg_attr(not(test), warn(missing_docs))]
30/// Authentication.
31pub mod auth;
32/// Batch operations.
33pub mod batch;
34mod batch_executor;
35/// Caching.
36pub mod cache;
37mod config;
38mod error;
39mod protocol;
40mod rate_limiter;
41mod resource_limits;
42mod server;
43/// MCP tools.
44pub mod tools;
45
46pub use auth::*;
47pub use batch::{
48    BatchError, BatchMode, BatchOperation, BatchOperationResult, BatchRequest, BatchResponse,
49    BatchSummary,
50};
51pub use batch_executor::BatchExecutor;
52pub use cache::{CacheStats, OperationCache};
53pub use config::{ConfigError, ResourceLimitConfig};
54pub use error::{ErrorCategory, ErrorSeverity, McpError, McpResult};
55pub use protocol::*;
56pub use rate_limiter::RateLimiter;
57pub use resource_limits::*;
58pub use server::{McpServer, McpServerConfig};
59pub use tools::{execute_tool, get_tools};
60
61/// MCP Server version
62pub const VERSION: &str = env!("CARGO_PKG_VERSION");
63
64/// Server name for MCP protocol
65pub const SERVER_NAME: &str = "hedl-mcp";