# collibra/chip architecture

> Architecture diagram of the GitHub repository collibra/chip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/collibra/chip
- Repository: https://github.com/collibra/chip

## Overview

1. **What this repo is**
   - A Go-based **Model Context Protocol (MCP) server** that exposes Collibra Data Governance Center capabilities to AI clients.
   - The server is a thin integration layer: it does not store business data locally; it translates MCP tool calls into Collibra API requests and returns the results.

2. **Top-level runtime boundary**
   - The executable entrypoint is `cmd/chip/main.go`.
   - That package wires together configuration, transport selection, and server startup.
   - The repo supports two runtime modes:
     - **stdio** for local/client-managed MCP integrations
     - **HTTP** for networked clients, with localhost-only binding for safety

3. **Configuration boundary**
   - Configuration comes from **environment variables** and/or a **YAML config file** under `~/.config/collibra/mcp.yaml`.
   - The config defines the Collibra base URL and credentials, plus tool enable/disable controls.
   - This is an important architectural boundary: auth can be **server-wide** in stdio mode or **client-provided per request** in HTTP mode.

4. **Server core**
   - `pkg/chip` contains the MCP server runtime support:
     - `server.go` for server composition/lifecycle
     - `http.go` for HTTP transport behavior
     - `context.go` for shared request/server context
     - `version.go` for version metadata
   - This layer is the orchestration boundary between the MCP protocol and the tool implementations.

5. **Tool layer**
   - `pkg/tools` is the main capability surface area.
   - Each file implements one MCP tool, such as asset discovery, glossary lookup, lineage traversal, classification matches, and data contract operations.
   - `tools_register.go` centralizes tool registration, so the server can expose a selected subset based on config/flags.
   - The tools are the primary unit of functionality exposed to external MCP clients.

6. **Collibra API client layer**
   - `pkg/clients` contains the outbound integration code to Collibra services.
   - The clients are split by domain:
     - core / GraphQL / search / responsibility / relation / datacontract / classification
     - lineage-specific client support
     - Copilot integration support
   - This separation keeps tool handlers thin and isolates Collibra-specific API details from MCP concerns.

7. **Data domains exposed**
   - The server groups Collibra capabilities into a few major domains:
     - **Data asset discovery** and asset metadata retrieval
     - **Business glossary** and term-to-asset relationships
     - **Semantic layer** queries for tables, columns, and measures
     - **Data contracts** push/pull/list workflows
     - **Data classification** search and classification match management
     - **Technical lineage** for entities, upstream/downstream flows, and transformations
   - These domains map directly to the tool list in the README and are the main architecture axes for diagrams.

8. **Request/data flow**
   - An MCP client invokes a tool over stdio or HTTP.
   - The server routes the request to the corresponding implementation in `pkg/tools`.
   - The tool calls one or more domain clients in `pkg/clients`.
   - The client performs the outbound Collibra API request and returns structured data.
   - The result is transformed into MCP-compatible tool output and sent back to the caller.

9. **State and persistence**
   - There is no local database or queue.
   - The server is effectively stateless aside from runtime config and request context.
   - All persistent system-of-record data remains in Collibra; this repo only mediates access.

10. **Operational and delivery concerns**
   - Tests exist for server behavior, versioning, client behavior, and most tools, indicating the boundaries are designed for isolated unit testing.
   - GitHub Actions and Goreleaser handle build/release packaging of the CLI binary.
   - Documentation under `docs/` covers configuration and MCP examples, reinforcing that deployment is primarily as a configurable binary rather than a hosted platform.

Main entry points: [`pkg/tools/tools_register.go`](https://github.com/collibra/chip/blob/main/pkg/tools/tools_register.go) (Tool registry), [`pkg/clients/dgc_core_client.go`](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_core_client.go) (Core API), [`pkg/chip/server.go`](https://github.com/collibra/chip/blob/main/pkg/chip/server.go) (Server), [`cmd/chip/main.go`](https://github.com/collibra/chip/blob/main/cmd/chip/main.go) (Main)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_cmd_chip_main["Main<br/>entrypoint<br/>[main.go]"]
  node_cmd_chip_config["Config<br/>[config.go]"]
  node_cmd_chip_http["HTTP mode<br/>cli transport<br/>[http.go]"]
end

subgraph group_core["Core"]
  node_pkg_chip_server["Server<br/>mcp runtime<br/>[server.go]"]
  node_pkg_chip_http["HTTP transport<br/>mcp transport<br/>[http.go]"]
  node_pkg_chip_context["Context<br/>request ctx<br/>[context.go]"]
  node_pkg_chip_version["Version<br/>metadata<br/>[version.go]"]
end

subgraph group_tools["Tools"]
  node_pkg_tools_register["Tool registry<br/>[tools_register.go]"]
  node_tool_assets["Assets<br/>tool domain"]
  node_tool_glossary["Glossary<br/>tool domain"]
  node_tool_semantics["Semantics<br/>tool domain"]
  node_tool_contracts["Contracts<br/>tool domain"]
  node_tool_classification["Classification<br/>tool domain"]
  node_tool_lineage["Lineage<br/>tool domain"]
end

subgraph group_clients["Clients"]
  node_client_core["Core API<br/>Collibra client<br/>[dgc_core_client.go]"]
  node_client_gql["GraphQL<br/>Collibra client<br/>[dgc_gql_client.go]"]
  node_client_search["Search<br/>Collibra client"]
  node_client_contracts["Contracts API<br/>Collibra client"]
  node_client_classification["Classify API<br/>Collibra client"]
  node_client_lineage["Lineage API<br/>Collibra client<br/>[lineage_client.go]"]
  node_client_copilot["Copilot<br/>integration client<br/>[copilot_client.go]"]
end

subgraph group_ops["Ops"]
  node_docs_ops["Docs & release<br/>delivery<br/>[CONFIG.md]"]
end

node_cmd_chip_main -->|"loads"| node_cmd_chip_config
node_cmd_chip_main -->|"starts"| node_pkg_chip_server
node_cmd_chip_main -->|"selects"| node_cmd_chip_http
node_cmd_chip_http -->|"uses"| node_pkg_chip_http
node_pkg_chip_server -->|"shares"| node_pkg_chip_context
node_pkg_chip_server -->|"registers"| node_pkg_tools_register
node_pkg_chip_server -->|"reports"| node_pkg_chip_version
node_pkg_tools_register -->|"enables"| node_tool_assets
node_pkg_tools_register -->|"enables"| node_tool_glossary
node_pkg_tools_register -->|"enables"| node_tool_semantics
node_pkg_tools_register -->|"enables"| node_tool_contracts
node_pkg_tools_register -->|"enables"| node_tool_classification
node_pkg_tools_register -->|"enables"| node_tool_lineage
node_tool_assets -->|"queries"| node_client_search
node_tool_glossary -->|"queries"| node_client_gql
node_tool_semantics -->|"queries"| node_client_core
node_tool_contracts -->|"uses"| node_client_contracts
node_tool_classification -->|"uses"| node_client_classification
node_tool_lineage -->|"uses"| node_client_lineage
node_client_search -->|"builds on"| node_client_core
node_client_gql -->|"builds on"| node_client_core
node_client_contracts -->|"builds on"| node_client_core
node_client_classification -->|"builds on"| node_client_core
node_client_lineage -->|"builds on"| node_client_core
node_client_copilot -->|"builds on"| node_client_core
node_docs_ops -.->|"documents"| node_cmd_chip_config
node_docs_ops -.->|"describes"| node_pkg_tools_register

click node_cmd_chip_main "https://github.com/collibra/chip/blob/main/cmd/chip/main.go"
click node_cmd_chip_config "https://github.com/collibra/chip/blob/main/cmd/chip/config.go"
click node_cmd_chip_http "https://github.com/collibra/chip/blob/main/cmd/chip/http.go"
click node_pkg_chip_server "https://github.com/collibra/chip/blob/main/pkg/chip/server.go"
click node_pkg_chip_http "https://github.com/collibra/chip/blob/main/pkg/chip/http.go"
click node_pkg_chip_context "https://github.com/collibra/chip/blob/main/pkg/chip/context.go"
click node_pkg_chip_version "https://github.com/collibra/chip/blob/main/pkg/chip/version.go"
click node_pkg_tools_register "https://github.com/collibra/chip/blob/main/pkg/tools/tools_register.go"
click node_tool_assets "https://github.com/collibra/chip/blob/main/pkg/tools/discover_data_assets.go"
click node_tool_glossary "https://github.com/collibra/chip/blob/main/pkg/tools/discover_business_glossary.go"
click node_tool_semantics "https://github.com/collibra/chip/blob/main/pkg/tools/get_table_semantics.go"
click node_tool_contracts "https://github.com/collibra/chip/blob/main/pkg/tools/list_data_contracts.go"
click node_tool_classification "https://github.com/collibra/chip/blob/main/pkg/tools/search_data_classification_matches.go"
click node_tool_lineage "https://github.com/collibra/chip/blob/main/pkg/tools/get_lineage_entity.go"
click node_client_core "https://github.com/collibra/chip/blob/main/pkg/clients/dgc_core_client.go"
click node_client_gql "https://github.com/collibra/chip/blob/main/pkg/clients/dgc_gql_client.go"
click node_client_search "https://github.com/collibra/chip/blob/main/pkg/clients/dgc_search_client.go"
click node_client_contracts "https://github.com/collibra/chip/blob/main/pkg/clients/dgc_datacontract_client.go"
click node_client_classification "https://github.com/collibra/chip/blob/main/pkg/clients/dgc_classification_client.go"
click node_client_lineage "https://github.com/collibra/chip/blob/main/pkg/clients/lineage_client.go"
click node_client_copilot "https://github.com/collibra/chip/blob/main/pkg/clients/copilot_client.go"
click node_docs_ops "https://github.com/collibra/chip/blob/main/docs/CONFIG.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmd_chip_main,node_cmd_chip_config,node_cmd_chip_http toneBlue
class node_pkg_chip_server,node_pkg_chip_http,node_pkg_chip_context,node_pkg_chip_version toneAmber
class node_pkg_tools_register,node_tool_assets,node_tool_glossary,node_tool_semantics,node_tool_contracts,node_tool_classification,node_tool_lineage toneMint
class node_client_core,node_client_gql,node_client_search,node_client_contracts,node_client_classification,node_client_lineage,node_client_copilot toneRose
class node_docs_ops toneIndigo
```

## Components

### Runtime

Executable entrypoint and transport modes

- [Main](https://github.com/collibra/chip/blob/main/cmd/chip/main.go): entrypoint · CLI startup and wiring · `cmd/chip/main.go`
- [Config](https://github.com/collibra/chip/blob/main/cmd/chip/config.go): cli config · Loads env and YAML settings · `cmd/chip/config.go`
- [HTTP mode](https://github.com/collibra/chip/blob/main/cmd/chip/http.go): cli transport · HTTP runtime bootstrap and localhost binding · `cmd/chip/http.go`

### Core

Server composition and shared request context

- [Server](https://github.com/collibra/chip/blob/main/pkg/chip/server.go): mcp runtime · Server composition and lifecycle · `pkg/chip/server.go`
- [HTTP transport](https://github.com/collibra/chip/blob/main/pkg/chip/http.go): mcp transport · HTTP protocol handling · `pkg/chip/http.go`
- [Context](https://github.com/collibra/chip/blob/main/pkg/chip/context.go): request ctx · Shared server and request context · `pkg/chip/context.go`
- [Version](https://github.com/collibra/chip/blob/main/pkg/chip/version.go): metadata · Build and version metadata · `pkg/chip/version.go`

### Tools

MCP tool surface grouped by capability

- [Tool registry](https://github.com/collibra/chip/blob/main/pkg/tools/tools_register.go): tool registry · Registers enabled MCP tools · `pkg/tools/tools_register.go`
- [Assets](https://github.com/collibra/chip/blob/main/pkg/tools/discover_data_assets.go): tool domain · Asset discovery and metadata · `pkg/tools/discover_data_assets.go`
- [Glossary](https://github.com/collibra/chip/blob/main/pkg/tools/discover_business_glossary.go): tool domain · Business glossary and term lookup · `pkg/tools/discover_business_glossary.go`
- [Semantics](https://github.com/collibra/chip/blob/main/pkg/tools/get_table_semantics.go): tool domain · Tables, columns, and measures · `pkg/tools/get_table_semantics.go`
- [Contracts](https://github.com/collibra/chip/blob/main/pkg/tools/list_data_contracts.go): tool domain · Data contract push, pull, and list · `pkg/tools/list_data_contracts.go`
- [Classification](https://github.com/collibra/chip/blob/main/pkg/tools/search_data_classification_matches.go): tool domain · Classification search and matches · `pkg/tools/search_data_classification_matches.go`
- [Lineage](https://github.com/collibra/chip/blob/main/pkg/tools/get_lineage_entity.go): tool domain · Entity, flow, and transformation lineage · `pkg/tools/get_lineage_entity.go`

### Clients

Outbound Collibra integrations by domain

- [Core API](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_core_client.go): Collibra client · Base Collibra API access · `pkg/clients/dgc_core_client.go`
- [GraphQL](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_gql_client.go): Collibra client · GraphQL queries and mutations · `pkg/clients/dgc_gql_client.go`
- [Search](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_search_client.go): Collibra client · Search and lookup operations · `pkg/clients/dgc_search_client.go`
- [Contracts API](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_datacontract_client.go): Collibra client · Data contract integration · `pkg/clients/dgc_datacontract_client.go`
- [Classify API](https://github.com/collibra/chip/blob/main/pkg/clients/dgc_classification_client.go): Collibra client · Classification and match APIs · `pkg/clients/dgc_classification_client.go`
- [Lineage API](https://github.com/collibra/chip/blob/main/pkg/clients/lineage_client.go): Collibra client · Technical lineage integration · `pkg/clients/lineage_client.go`
- [Copilot](https://github.com/collibra/chip/blob/main/pkg/clients/copilot_client.go): integration client · Copilot support integration · `pkg/clients/copilot_client.go`

### Ops

Config, docs, build, and release concerns

- [Docs & release](https://github.com/collibra/chip/blob/main/docs/CONFIG.md): delivery · Config docs, examples, CI, and packaging · `docs/CONFIG.md`

## Connections

- Main → Config: loads · Reads environment and YAML configuration
- Main → Server: starts · Constructs and runs the MCP server
- Main → HTTP mode: selects · Chooses stdio or HTTP runtime mode
- HTTP mode → HTTP transport: uses · Delegates transport behavior
- Server → Context: shares · Provides request-scoped context
- Server → Tool registry: registers · Exposes configured tools
- Server → Version: reports · Publishes version metadata
- Tool registry → Assets: enables · Registers asset discovery tools
- Tool registry → Glossary: enables · Registers glossary tools
- Tool registry → Semantics: enables · Registers semantic-layer tools
- Tool registry → Contracts: enables · Registers data contract tools
- Tool registry → Classification: enables · Registers classification tools
- Tool registry → Lineage: enables · Registers lineage tools
- Assets → Search: queries · Uses search and lookup APIs
- Glossary → GraphQL: queries · Uses GraphQL-backed Collibra access
- Semantics → Core API: queries · Uses core Collibra API access
- Contracts → Contracts API: uses · Push/pull/list contract workflows
- Classification → Classify API: uses · Searches and updates match data
- Lineage → Lineage API: uses · Traverses lineage relationships
- Search → Core API: builds on · Search client layers on core API access
- GraphQL → Core API: builds on · GraphQL client layers on core API access
- Contracts API → Core API: builds on · Contract client layers on core API access
- Classify API → Core API: builds on · Classification client layers on core API access
- Lineage API → Core API: builds on · Lineage client layers on core API access
- Copilot → Core API: builds on · Copilot integration uses shared API plumbing
- Docs & release → Config: documents · Configuration and example setup
- Docs & release → Tool registry: describes · Tool surface and selection behavior
