Enterprise Knowledge Mesh

Enterprise Knowledge Mesh

Enables AI agents to query structured knowledge across enterprise domains (legal, HR, compliance) with metadata-driven filtering and TF-IDF ranking.

Category
访问服务器

README

Enterprise Knowledge Mesh — An MCP Server for Structured Data Lake Retrieval

AI Runtime Platform Feature — tagged as knowledge-mesh-mcp


Executive Summary

Modern enterprises operate across multiple domains—legal, human resources, compliance, engineering, finance—each maintaining its own body of institutional knowledge. This knowledge is typically trapped in static documents, wikis, and PDFs, making it inaccessible to AI-powered assistants and automation pipelines. The Enterprise Knowledge Mesh solves this by exposing domain-specific knowledge bases as composable tools through the Model Context Protocol (MCP), enabling LLMs to retrieve relevant, filtered, and rank-ordered information from a unified data lake with zero boilerplate integration.

This project demonstrates how a renewable energy company with operations across multiple markets, device types, and regulatory regimes can centralize its fragmented knowledge into a single MCP server that any AI agent can query in real time.


Problem Statement

Enterprise knowledge management suffers from three systemic failures:

Failure Impact
Siloed documentation Legal contracts live in a DMS, HR policies in the intranet, compliance checklists in SharePoint. No single entry point.
Context blindness A query like "What are the warranty terms for solar panels in Berlin?" requires cross-referencing market-specific regulations, device-specific policies, and category-specific contract terms.
No structured access for AI LLMs cannot natively query internal databases. Prompt engineering with static RAG chunks is brittle, ungoverned, and unobservable.

The result: employees waste hours searching for answers, compliance risks go undetected, and AI-assisted workflows stall because models cannot reliably access enterprise ground truth.


Solution Architecture

┌─────────────────────────────────────────────────────────┐
│                   AI Agent / LLM                         │
│  (Claude, ChatGPT, Cursor, Copilot, custom agent)        │
└────────────────────┬────────────────────────────────────┘
                     │ MCP Protocol (stdio/SSE)
                     ▼
┌─────────────────────────────────────────────────────────┐
│              Enterprise Knowledge Mesh MCP Server         │
│                                                          │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐      │
│  │  Legal KB    │  │   HR KB     │  │ Compliance  │ ...  │
│  │  (MCP Tool)  │  │ (MCP Tool)  │  │ KB (MCP     │      │
│  │              │  │             │  │   Tool)     │      │
│  └──────┬───────┘  └──────┬──────┘  └──────┬──────┘      │
│         │                 │                │              │
│         └────────┬────────┴────────┬───────┘              │
│                  ▼                  ▼                      │
│         ┌──────────────────────────────────┐              │
│         │    TF-IDF Search Engine           │              │
│         │  (tokenize → TF × IDF → rank)    │              │
│         │  + filter pipeline               │              │
│         └──────────────────────────────────┘              │
│                  ▲                                         │
│         ┌────────┴────────┐                                │
│         │  ServiceRegistry │                                │
│         │  (YAML → class) │                                │
│         └─────────────────┘                                │
│                  ▲                                         │
│         ┌────────┴────────┐                                │
│         │  services.yaml  │                                │
│         │  (declarative   │                                │
│         │   config)       │                                │
│         └─────────────────┘                                │
└──────────────────────────────────────────────────────────┘

Core Design Decisions

1. MCP Protocol as the Integration Standard

Rather than building a custom REST API or GraphQL endpoint, the server implements the Model Context Protocol—an open standard from Anthropic that defines how AI applications communicate with tools and data sources. This makes the knowledge mesh immediately compatible with every major AI assistant and IDE without adapter code.

2. Declarative Service Configuration

Services are defined in a single services.yaml file:

services:
  - id: legal
    name: Legal Knowledge Base
    description: Contracts, policies, and regulatory information
    markdown: src/services/legal/legal.md

  - id: hr
    name: HR Knowledge Base
    description: Employee policies, benefits, leave, and workplace guidelines
    markdown: src/services/hr/hr.md

  - id: compliance
    name: Compliance Knowledge Base
    description: Regulatory compliance, data protection, audit requirements
    markdown: src/services/compliance/compliance.md

Adding a new domain requires nothing more than a YAML entry and a markdown file. No routing code, no controller logic, no boilerplate.

3. Metadata-Driven Filtering

Each knowledge base and every section within it carries a metadata signature:

> **Markets:** Berlin, Frankfurt, Munich, Hamburg
> **Devices:** Solar Panel, Battery-Storage, Inverter
> **Categories:** Contracts, Warranty, Liability

This enables cross-dimensional filtering: queries can target a specific market, device, category, or any combination thereof. A compliance officer asking "What are the GDPR requirements for smart meters in Berlin?" gets results scoped to the intersection of market: berlin, device: inverter, category: gdpr.

4. TF-IDF Ranking for Relevance

The search engine uses a classic information-retrieval approach:

  • Tokenization splits queries and documents into normalized term vectors
  • Term Frequency (TF) measures how often a term appears within a section
  • Inverse Document Frequency (IDF) downweights terms that appear everywhere
  • Heading boost applies a multiplier (+2) when a query term matches a section heading
  • Top-3 truncation returns the three most relevant results per query

This approach is deterministic, auditable, and requires no external AI dependencies or GPU infrastructure.


Current Knowledge Domains

Legal Knowledge Base

Contracts, warranty terms, liability frameworks, consumer rights, data protection clauses, and grid connection requirements across four German markets (Berlin, Frankfurt, Munich, Hamburg). Covers devices: solar panels, battery storage, inverters, car chargers.

HR Knowledge Base

Remote work policies, vacation and leave regulations (including regional variations), parental leave top-ups, health insurance benefits, compensation and bonus structures, professional development budgets, onboarding processes, mental health programs, and anti-discrimination policies.

Compliance Knowledge Base

GDPR compliance for smart meter data, ISO 27001 information security requirements, VDE electrical safety standards, EEG 2023 renewable energy law, grid connection compliance, internal audit procedures, incident reporting obligations, and anti-corruption/ethics policies.


Getting Started

Prerequisites

  • Node.js 20+
  • npm or yarn
  • An MCP-compatible client (Claude Desktop, VS Code with Cline, any custom agent)

Installation

git clone <repository-url>
cd acme-energy-mcp
npm install
npm run build

Configuration

Edit services.yaml to add, remove, or modify knowledge bases. Each service requires:

  • id — unique identifier (used as the MCP tool name prefix)
  • name — human-readable label
  • description — tool description exposed to the LLM
  • markdown — path to the markdown file relative to project root

Markdown Structure

Each markdown file must include:

  1. YAML frontmatter — service-level metadata bounded by --- delimiters:

    ---
    name: Legal Knowledge Base
    description: Contracts and regulatory information
    markets: [berlin, frankfurt, munich, hamburg]
    devices: [solar-panel, battery-storage, inverter, car-charger]
    categories: [contracts, warranty, liability, consumer-rights, data-protection]
    last_updated: 2025-11-15
    ---
    
  2. H2 sections — each ## Heading becomes a searchable chunk:

    ## Solar Panel Installation Contracts
    > **Markets:** Berlin, Frankfurt, Munich, Hamburg
    > **Devices:** Solar Panel
    > **Categories:** Contracts, Consumer-Rights
    
    All Acme Energy solar panel installation contracts include...
    

Running the Server

npm run dev        # Development (hot-reload via tsx)
npm start          # Production (runs compiled dist/index.js)

The server runs on stdio transport, which is the native integration mode for MCP clients.

Client Integration

To connect from any MCP-compatible client:

{
  "mcpServers": {
    "acme-energy-knowledge": {
      "command": "node",
      "args": ["/path/to/acme-energy-mcp/dist/index.js"]
    }
  }
}

The server exposes one tool per knowledge base dynamically. For the three configured services, the LLM sees:

Tool Name Description
query_legal Search the Legal Knowledge Base with optional market/device/category filters
query_hr Search the HR Knowledge Base with optional market/category filters
query_compliance Search the Compliance Knowledge Base with optional market/device/category filters

Each tool accepts a query string and optional market, device, and category filter parameters, populated dynamically from the frontmatter metadata.


Testing

npm test             # Run all tests (vitest)
npm run test:watch   # Watch mode
npm run typecheck    # TypeScript type checking
npm run lint         # ESLint

Extending the Knowledge Mesh

Adding a New Knowledge Domain

  1. Create a markdown file in src/services/<domain>/<domain>.md with frontmatter and H2 sections
  2. Add a YAML entry to services.yaml pointing to the new file
  3. Restart the server — the new tool appears automatically

Customizing the Search Engine

The TF-IDF implementation lives in src/search/engine.ts. It can be replaced with:

  • Embedding-based retrieval (OpenAI, Cohere, Voyage) for semantic search
  • BM25 for improved lexical matching
  • Hybrid search combining both with reciprocal rank fusion
  • Vector database integration (pgvector, Pinecone, Chroma) for scale

The IKnowledgeBase interface (src/types.ts) abstracts the search contract, so swapping engines requires no changes to the MCP server or service registry.


Roadmap

Phase Feature Status
1 Core MCP server with YAML-configurable knowledge bases ✅ Complete
2 TF-IDF search with metadata filtering ✅ Complete
3 Dynamic MCP tool generation from service config ✅ Complete
4 Multi-market, multi-device, multi-category filtering ✅ Complete
5 Embedding-based semantic search (pluggable engine) 🔜 Planned
6 SSE transport for remote server deployment 🔜 Planned
7 Authentication and authorization layer 🔜 Planned
8 Analytics and usage observability 🔜 Planned
9 Real-time content sync from upstream systems (SharePoint, Confluence) 🔜 Planned
10 Cross-knowledge-base query routing ("ask anything") 🔜 Planned

Design Philosophy

  1. Protocol, not framework. By implementing MCP, this project integrates with the entire AI ecosystem rather than a single vendor's platform.
  2. Content over code. Knowledge is authored in plain markdown with YAML frontmatter—editable by domain experts, version-controlled in git, and deployable via CI/CD.
  3. Deterministic retrieval first. TF-IDF is transparent, debuggable, and works offline. Semantic search can be layered on when needed, but the foundation is auditable.
  4. Composable by default. Each knowledge base is an independent MCP tool. Agents can query one, many, or all, and the filter system enables precise cross-section queries.
  5. Self-describing tools. The MCP tool definitions are generated from frontmatter metadata, so the LLM always knows which filters are available without hardcoding.

Technical Stack

Component Technology
Runtime Node.js 20+ (ESM)
Language TypeScript 5.8 (strict mode)
MCP SDK @modelcontextprotocol/sdk v1.12
Search Custom TF-IDF engine
Configuration YAML via js-yaml
Validation Zod 3.24
Testing Vitest 3.1
Linting ESLint 9 with typescript-eslint

License

Private / Internal use. This project is designed as an enterprise internal tool.


About This Case Study

This project was built as a coding challenge to demonstrate how the Model Context Protocol can serve as an enterprise knowledge mesh—transforming static documentation into composable, AI-accessible tools. The architecture patterns shown here are applicable across industries: financial services (regulatory handbooks), healthcare (clinical protocols), manufacturing (equipment manuals), and any organization where institutional knowledge must be made available to AI agents in a structured, filterable, and observable way.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选