Skip to main content

Contributing to Station

This section covers Station’s internal architecture, development setup, and testing for contributors.

Architecture Overview

Station is a modular, service-oriented AI agent orchestration platform built in Go.

Four-Layer Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    PRESENTATION LAYER                            │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐          │
│  │   CLI        │  │   API        │  │  MCP Server  │          │
│  │  (cmd/main)  │  │   (:8585)    │  │  (stdio)     │          │
│  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘          │
├─────────┼─────────────────┼─────────────────┼───────────────────┤
│         └─────────────────┼─────────────────┘                   │
│                           ▼                                      │
│                    SERVICE LAYER                                 │
│         ┌─────────────────────────────────┐                     │
│         │    43+ Focused Service Modules   │                     │
│         │    (internal/services/)          │                     │
│         └─────────────────┬───────────────┘                     │
├───────────────────────────┼─────────────────────────────────────┤
│                           ▼                                      │
│                   DATA ACCESS LAYER                              │
│         ┌─────────────────────────────────┐                     │
│         │    11 Repository Modules         │                     │
│         │    (internal/db/repositories/)   │                     │
│         └─────────────────┬───────────────┘                     │
├───────────────────────────┼─────────────────────────────────────┤
│                           ▼                                      │
│                  PERSISTENCE LAYER                               │
│         ┌──────────────────┐  ┌──────────────────┐              │
│         │  SQLite Database │  │  File System     │              │
│         │  (station.db)    │  │  (environments/) │              │
│         └──────────────────┘  └──────────────────┘              │
└─────────────────────────────────────────────────────────────────┘

Unified Execution Engine

All entry points converge at the AgentExecutionEngine:
Entry PointPathHandler
CLIstn agent runcmd/main/handlers/agent/
APIPOST /api/v1/agents/:id/executeinternal/api/v1/
MCPcall_agent toolinternal/mcp/
SchedulerCron triggerinternal/services/scheduler.go

Core Services

CategoryServices
ExecutionAgentService, AgentExecutionEngine, GenKitProvider
MCPMCPConnectionManager, MCPToolDiscovery, ToolDiscoveryService
ConfigDeclarativeSync, EnvironmentManagementService, AgentFileSync
SchedulingSchedulerService
TelemetryTelemetryService, DeploymentContextService

Repository Structure

station/
├── cmd/main/              # CLI entry point
│   └── handlers/          # CLI command handlers
├── internal/
│   ├── api/v1/            # REST API handlers
│   ├── config/            # Configuration loading
│   ├── db/                # Database layer
│   │   ├── repositories/  # Data access
│   │   └── schema.sql     # Database schema
│   ├── mcp/               # MCP server implementation
│   ├── services/          # Business logic (43+ modules)
│   └── workflows/         # Workflow engine
├── pkg/                   # Public packages
├── bundles/               # Agent bundles
└── docs/
    └── architecture/      # Detailed architecture docs

Key Files

ComponentLocation
Agent executioninternal/services/agent_execution_engine.go
MCP managementinternal/services/mcp_*.go
Sync serviceinternal/services/declarative_sync.go
API handlersinternal/api/v1/*.go
CLI handlerscmd/main/handlers/
Database schemainternal/db/schema.sql
MCP serverinternal/mcp/server.go
Config loadinginternal/config/config.go

Next Steps