Documentation
¶
Overview ¶
@index Compile-time MCP dependency checks owned by the server runtime.
Index ¶
- func ConfiguredCloneBaseURLs(cfg Config) []string
- func EnvDuration(name string, fallback time.Duration) time.Duration
- func EnvInt(name string, fallback int) int
- func EnvIsSet(name string) bool
- func HandleHealth(w http.ResponseWriter, r *http.Request)
- func IsLoopbackHTTPAddr(addr string) bool
- func MCPAuthMiddleware(token string, next http.Handler) http.Handler
- func ReadyHandler(check func(*http.Request) error) http.Handler
- func Run(rt *core.Runtime, cfg Config, ...) error
- func RunStreamableHTTP(rt *core.Runtime, srv *mcpgo.MCPServer, cfg Config, cache *mcp.Cache, ...) error
- func StatusHandler(dbCheck func(*http.Request) error, webhookTimeout time.Duration, ...) http.Handler
- func ValidateBearerToken(header, expected string) bool
- func ValidateConfig(cfg Config) error
- func ValidateHTTPExposure(cfg Config) error
- func WebhookBlockingReadyCheck(q *webhook.SyncQueue, timeout time.Duration) error
- func WebhookRepoStatsDegraded(stats webhook.RepoStats) bool
- func WebhookStatsBlockingReady(stats webhook.SyncQueueStats, timeout time.Duration) error
- func WebhookStatsDegraded(stats webhook.SyncQueueStats) bool
- func WithHTTPTraceContext(next http.Handler) http.Handler
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfiguredCloneBaseURLs ¶
ConfiguredCloneBaseURLs merges singular and repeatable clone base URL settings. @intent preserve legacy singular URL behavior while exposing one ordered clone URL list.
func EnvDuration ¶
EnvDuration reads a time.Duration from an environment variable, returning fallback if unset or unparseable. @intent provide env-based defaults for server timeout and retry flags without panicking on bad input.
func EnvInt ¶
EnvInt reads an integer from an environment variable, returning fallback if unset or unparseable. @intent provide env-based defaults for server flags without panicking on bad input.
func EnvIsSet ¶
EnvIsSet reports whether an environment variable is present in the process environment. @intent distinguish between an unset variable and one explicitly set to empty string.
func HandleHealth ¶
func HandleHealth(w http.ResponseWriter, r *http.Request)
HandleHealth responds to HTTP health checks. @intent 가장 가벼운 liveness probe로 프로세스 응답 가능 여부만 반환한다. @sideEffect JSON 응답을 기록한다.
func IsLoopbackHTTPAddr ¶
IsLoopbackHTTPAddr checks if an address is a loopback address. @intent HTTP listen 주소가 로컬 테스트 전용인지 판별해 보안 규칙에 재사용한다.
func MCPAuthMiddleware ¶
MCPAuthMiddleware provides bearer token authentication for MCP HTTP endpoints. @intent /mcp 요청에 선택적 bearer 인증을 적용해 외부 접근을 제한한다. @domainRule token이 비어 있으면 인증을 강제하지 않는다.
func ReadyHandler ¶
ReadyHandler handles HTTP ready checks. @intent 호출자가 제공한 readiness 조건을 HTTP probe 응답으로 변환한다. @sideEffect ready 또는 not_ready JSON 응답을 기록한다.
func Run ¶
Run starts the self-hosted MCP server over Streamable HTTP. @intent keep HTTP/webhook transport setup isolated from the local ccg stdio binary. @sideEffect initializes shared MCP runtime resources and starts the HTTP server.
func RunStreamableHTTP ¶
func RunStreamableHTTP(rt *core.Runtime, srv *mcpgo.MCPServer, cfg Config, cache *mcp.Cache, postprocessSummary func(context.Context) (*postprocesspolicy.StatusSummary, error)) error
RunStreamableHTTP serves the MCP server over streamable HTTP. @intent MCP, health, readiness, status, webhook 엔드포인트를 하나의 HTTP 런타임으로 노출한다. @sideEffect HTTP 서버, 시그널 핸들러, 웹훅 동기화 큐를 생성하고 종료 시 drain한다.
func StatusHandler ¶
func StatusHandler(dbCheck func(*http.Request) error, webhookTimeout time.Duration, queue func() *webhook.SyncQueue, postprocessSummary func(context.Context) (*postprocesspolicy.StatusSummary, error)) http.Handler
StatusHandler provides detailed system status including DB, webhooks, and postprocess state. @intent 운영 진단용 상태를 종합해 HTTP 상태 코드와 JSON payload로 노출한다. @sideEffect DB 상태, webhook 큐 상태, 후처리 상태를 읽고 JSON 응답을 기록한다.
func ValidateBearerToken ¶
ValidateBearerToken validates a bearer token against an expected value. @intent Authorization 헤더가 기대한 bearer 토큰과 정확히 일치하는지만 판단한다. @domainRule 접두사나 길이가 다르면 constant-time 비교 전에 실패 처리한다.
func ValidateConfig ¶
ValidateConfig checks that the server configuration is self-consistent. @intent reject invalid webhook and HTTP exposure settings before opening listeners.
func ValidateHTTPExposure ¶
ValidateHTTPExposure ensures non-loopback streamable-http requires authentication. @intent 외부 바인딩된 HTTP MCP 서버가 인증 없이 노출되는 구성을 사전에 차단한다. @domainRule loopback이 아닌 주소는 bearer token 또는 insecure override가 필요하다.
func WebhookBlockingReadyCheck ¶
WebhookBlockingReadyCheck checks if the webhook queue is blocked. @intent readiness 판단에서 웹훅 큐가 트래픽 차단 상태인지 빠르게 판정한다.
func WebhookRepoStatsDegraded ¶
WebhookRepoStatsDegraded checks if a specific repo's stats indicate a degraded state. @intent 저장소별 최근 실패가 아직 성공으로 덮이지 않았는지 판정한다.
func WebhookStatsBlockingReady ¶
func WebhookStatsBlockingReady(stats webhook.SyncQueueStats, timeout time.Duration) error
WebhookStatsBlockingReady checks if webhook stats indicate a blocked state. @intent 큐 포화나 장시간 지연이 readiness 실패 조건인지 공통 규칙으로 판단한다. @domainRule tracked_repos가 max_tracked_repos에 도달하면 not_ready로 본다.
func WebhookStatsDegraded ¶
func WebhookStatsDegraded(stats webhook.SyncQueueStats) bool
WebhookStatsDegraded checks if webhook stats indicate a degraded state. @intent 최근 성공보다 최신 실패가 남아 있는 큐 상태를 degraded로 분류한다.
Types ¶
type Config ¶
type Config struct {
CacheTTL time.Duration
NoCache bool
Transport string // "stdio" | "streamable-http"
HTTPAddr string
HTTPBearerToken string
OTELEndpoint string
InsecureHTTP bool
Stateless bool
NamespaceRoot string
WorkspaceRoot string
WebhookWorkers int
AllowRepo []string
WebhookSecret string
InsecureWebhook bool
RepoCloneBaseURL string
RepoCloneBaseURLs []string
RepoRoot string
WebhookMaxTrackedRepos int
WebhookAttemptTimeout time.Duration
WebhookShutdownTimeout time.Duration
WebhookRetryAttempts int
WebhookRetryBaseDelay time.Duration
WebhookRetryMaxDelay time.Duration
MaxFileBytes int64
MaxTotalParsedBytes int64
WebhookFailOnUnreadable bool
}
Config holds self-hosted HTTP server runtime options. @intent keep long-running HTTP, webhook, cache, and parse-limit settings out of the local CLI layer.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the self-hosted server defaults. @intent centralize default server flag values for ccg-server.