# spacelift-io/spacelift-intent architecture

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

- Interactive diagram: https://gitdiagram.com/spacelift-io/spacelift-intent
- Repository: https://github.com/spacelift-io/spacelift-intent

## Overview

Spacelift Intent is an MCP server for discovering provider capabilities, reading provider data, and provisioning cloud resources directly through provider APIs while tracking managed state in SQLite. An MCP host invokes registered tools; users can search and inspect schemas, then create, update, delete, refresh, or import resources and manage state and dependencies. The graph preserves the README’s tool families. Some lifecycle implementations were not excerpted, so their individual storage/provider links are omitted where the wiring is not evidenced.

Main entry points: [`tools/handlers.go`](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/handlers.go) (Tool registration), [`cmd/spacelift-intent/server.go`](https://github.com/spacelift-io/spacelift-intent/blob/main/cmd/spacelift-intent/server.go) (Stdio server), [`provider/opentofu_adapter.go`](https://github.com/spacelift-io/spacelift-intent/blob/main/provider/opentofu_adapter.go) (OpenTofu adapter), [`registry/opentofu.go`](https://github.com/spacelift-io/spacelift-intent/blob/main/registry/opentofu.go) (OpenTofu registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["MCP runtime"]
  node_server["Stdio server<br/>[server.go]"]
  node_toolset["Tool registration<br/>[handlers.go]"]
end

subgraph group_discovery["Provider discovery"]
  node_search["Provider search<br/>[search.go]"]
  node_provider_info["Provider description<br/>[describe.go]"]
  node_resource_schema["Resource schema<br/>[describe.go]"]
  node_datasource_schema["Data source schema<br/>[describe.go]"]
end

subgraph group_provision["Resource operations"]
  node_data_read["Data source read<br/>[read.go]"]
  node_create["Resource create<br/>[create.go]"]
  node_update["Resource update<br/>[update.go]"]
  node_delete["Resource delete<br/>[delete.go]"]
  node_refresh["Resource refresh<br/>[refresh.go]"]
  node_import["Resource import<br/>[import.go]"]
  node_operations["Operation history<br/>[operations.go]"]
end

subgraph group_state["State management"]
  node_state_tools["State tools<br/>[get.go]"]
  node_dependencies["Dependencies"]
  node_timeline["State timeline<br/>[timeline.go]"]
end

subgraph group_internals["Provider and storage"]
  node_provider_adapter["OpenTofu adapter"]
  node_schema_conversion["Schema conversion"]
  node_registry["OpenTofu registry<br/>[opentofu.go]"]
  node_sqlite[("SQLite state store<br/>[sqlite.go]")]
end

node_host(("MCP host"))
node_provider_service{{"Provider APIs"}}
node_registry_service{{"OpenTofu registry service"}}

node_host -->|"invokes over stdio"| node_server
node_server -->|"registers tools"| node_toolset
node_toolset -->|"registers"| node_search
node_toolset -->|"registers"| node_provider_info
node_toolset -->|"registers"| node_resource_schema
node_toolset -->|"registers"| node_datasource_schema
node_toolset -->|"registers"| node_data_read
node_toolset -->|"registers"| node_create
node_toolset -->|"registers"| node_update
node_toolset -->|"registers"| node_delete
node_toolset -->|"registers"| node_refresh
node_toolset -->|"registers"| node_import
node_toolset -->|"registers"| node_operations
node_toolset -->|"registers"| node_state_tools
node_toolset -->|"registers"| node_dependencies
node_toolset -->|"registers"| node_timeline
node_search -->|"searches providers"| node_registry
node_registry -->|"queries registry"| node_registry_service
node_server -->|"creates client"| node_registry
node_server -->|"creates adapter"| node_provider_adapter
node_provider_adapter -->|"uses client"| node_registry
node_provider_adapter -->|"calls provider APIs"| node_provider_service
node_server -->|"receives storage"| node_sqlite
node_toolset -->|"passes storage"| node_sqlite
node_resource_schema -->|"requests schema"| node_provider_adapter
node_data_read -->|"reads data"| node_provider_adapter
node_import -->|"saves state"| node_sqlite
node_state_tools -->|"reads state"| node_sqlite

click node_server "https://github.com/spacelift-io/spacelift-intent/blob/main/cmd/spacelift-intent/server.go"
click node_toolset "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/handlers.go"
click node_search "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/search.go"
click node_provider_info "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/describe.go"
click node_resource_schema "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/resources/describe.go"
click node_datasource_schema "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/datasources/describe.go"
click node_data_read "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/datasources/read.go"
click node_create "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/create.go"
click node_update "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/update.go"
click node_delete "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/delete.go"
click node_refresh "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/refresh.go"
click node_import "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/import.go"
click node_operations "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/operations.go"
click node_state_tools "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/state/get.go"
click node_dependencies "https://github.com/spacelift-io/spacelift-intent/tree/main/tools/lifecycle/resources/dependencies"
click node_timeline "https://github.com/spacelift-io/spacelift-intent/blob/main/tools/state/timeline.go"
click node_provider_adapter "https://github.com/spacelift-io/spacelift-intent/blob/main/provider/opentofu_adapter.go"
click node_schema_conversion "https://github.com/spacelift-io/spacelift-intent/blob/main/provider/schema_converter.go"
click node_registry "https://github.com/spacelift-io/spacelift-intent/blob/main/registry/opentofu.go"
click node_sqlite "https://github.com/spacelift-io/spacelift-intent/blob/main/storage/sqlite.go"

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_server,node_toolset toneBlue
class node_search,node_provider_info,node_resource_schema,node_datasource_schema toneAmber
class node_data_read,node_create,node_update,node_delete,node_refresh,node_import,node_operations,node_provider_service toneMint
class node_state_tools,node_dependencies,node_timeline toneRose
class node_provider_adapter,node_schema_conversion,node_registry,node_sqlite,node_host,node_registry_service toneIndigo
```

## Components

### MCP runtime

- [Stdio server](https://github.com/spacelift-io/spacelift-intent/blob/main/cmd/spacelift-intent/server.go): `cmd/spacelift-intent/server.go`
- [Tool registration](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/handlers.go): `tools/handlers.go`

### Provider discovery

- [Provider search](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/search.go): `tools/provider/search.go`
- [Provider description](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/describe.go): `tools/provider/describe.go`
- [Resource schema](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/resources/describe.go): `tools/provider/resources/describe.go`
- [Data source schema](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/provider/datasources/describe.go): `tools/provider/datasources/describe.go`

### Resource operations

- [Data source read](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/datasources/read.go): `tools/lifecycle/datasources/read.go`
- [Resource create](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/create.go): `tools/lifecycle/resources/create.go`
- [Resource update](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/update.go): `tools/lifecycle/resources/update.go`
- [Resource delete](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/delete.go): `tools/lifecycle/resources/delete.go`
- [Resource refresh](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/refresh.go): `tools/lifecycle/resources/refresh.go`
- [Resource import](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/import.go): `tools/lifecycle/resources/import.go`
- [Operation history](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/lifecycle/resources/operations.go): `tools/lifecycle/resources/operations.go`

### State management

- [State tools](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/state/get.go): `tools/state/get.go`
- [Dependencies](https://github.com/spacelift-io/spacelift-intent/tree/main/tools/lifecycle/resources/dependencies): `tools/lifecycle/resources/dependencies`
- [State timeline](https://github.com/spacelift-io/spacelift-intent/blob/main/tools/state/timeline.go): `tools/state/timeline.go`

### Provider and storage

- [OpenTofu adapter](https://github.com/spacelift-io/spacelift-intent/blob/main/provider/opentofu_adapter.go): `provider/opentofu_adapter.go`
- [Schema conversion](https://github.com/spacelift-io/spacelift-intent/blob/main/provider/schema_converter.go): `provider/schema_converter.go`
- [OpenTofu registry](https://github.com/spacelift-io/spacelift-intent/blob/main/registry/opentofu.go): `registry/opentofu.go`
- [SQLite state store](https://github.com/spacelift-io/spacelift-intent/blob/main/storage/sqlite.go): `storage/sqlite.go`

### Other components

- **MCP host**
- **Provider APIs**
- **OpenTofu registry service**

## Connections

- MCP host → Stdio server: invokes over stdio (evidence: `cmd/spacelift-intent/server.go`)
- Stdio server → Tool registration: registers tools (evidence: `cmd/spacelift-intent/server.go`)
- Tool registration → Provider search: registers (evidence: `tools/handlers.go`)
- Tool registration → Provider description: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource schema: registers (evidence: `tools/handlers.go`)
- Tool registration → Data source schema: registers (evidence: `tools/handlers.go`)
- Tool registration → Data source read: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource create: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource update: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource delete: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource refresh: registers (evidence: `tools/handlers.go`)
- Tool registration → Resource import: registers (evidence: `tools/handlers.go`)
- Tool registration → Operation history: registers (evidence: `tools/handlers.go`)
- Tool registration → State tools: registers (evidence: `tools/handlers.go`)
- Tool registration → Dependencies: registers (evidence: `tools/handlers.go`)
- Tool registration → State timeline: registers (evidence: `tools/handlers.go`)
- Provider search → OpenTofu registry: searches providers (evidence: `tools/provider/search.go`)
- OpenTofu registry → OpenTofu registry service: queries registry (evidence: `registry/opentofu.go`)
- Stdio server → OpenTofu registry: creates client (evidence: `cmd/spacelift-intent/server.go`)
- Stdio server → OpenTofu adapter: creates adapter (evidence: `cmd/spacelift-intent/server.go`)
- OpenTofu adapter → OpenTofu registry: uses client
- OpenTofu adapter → Provider APIs: calls provider APIs (evidence: `README.md`)
- Stdio server → SQLite state store: receives storage (evidence: `cmd/spacelift-intent/server.go`)
- Tool registration → SQLite state store: passes storage (evidence: `tools/handlers.go`)
- Resource schema → OpenTofu adapter: requests schema (evidence: `tools/provider/resources/describe.go`)
- Data source read → OpenTofu adapter: reads data (evidence: `tools/lifecycle/datasources/read.go`)
- Resource import → SQLite state store: saves state (evidence: `tools/lifecycle/resources/import.go`)
- State tools → SQLite state store: reads state (evidence: `tools/state/get.go`)
