mcpserver

package
v0.1.101 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package mcpserver is `lidza mcp`: a Model Context Protocol server over stdio that gives an agent the project's route map, context, diagnostics, configuration and the runtime log of `lidza dev`, so it asks instead of grepping.

Index

Constants

View Source
const LogFile = devserver.BuildDir + "/dev.log"

LogFile is where `lidza dev` writes its combined output, relative to the project root; lidza_logs reads it.

Variables

View Source
var CommandTools = map[string][]string{
	"ship":        {"lidza_ship"},
	"build":       {"lidza_build"},
	"check":       {"lidza_check"},
	"gen":         {"lidza_gen", "lidza_gen_resource", "lidza_gen_llms"},
	"pack":        {"lidza_pack_add", "lidza_pack_build", "lidza_pack_scaffold", "lidza_packs"},
	"db":          {"lidza_db_migrate", "lidza_db_rollback", "lidza_db_status", "lidza_db_new"},
	"test":        {"lidza_test"},
	"verify":      {"lidza_verify"},
	"audit":       {"lidza_audit_layout", "lidza_audit_performance"},
	"doctor":      {"lidza_doctor"},
	"context":     {"lidza_context"},
	"api":         {"lidza_api"},
	"snippet":     {"lidza_snippet"},
	"credentials": {"lidza_credentials_list", "lidza_credentials_set"},
	"admin":       {"lidza_admins", "lidza_owner_status"},
	"decision":    {"lidza_decision_add"},
	"brief":       {"lidza_brief", "lidza_brief_answer", "lidza_brief_skip"},
	"note":        {"lidza_note_add"},
	"recipe":      {"lidza_recipe_add", "lidza_recipes"},
}

CommandTools maps each lidza command to the tools that do its work.

View Source
var PackNoTool = map[string]string{
	"cache":    "entries expire; nothing an agent needs to read back",
	"i18n":     "the catalogs are files in locales/ the agent reads",
	"realtime": "messages are not kept; publish and watch them in the app",
}

PackNoTool are the official Go packs with nothing stored to inspect, and why.

View Source
var PackTools = map[string][]string{
	"db":        {"lidza_db_status"},
	"auth":      {"lidza_workspaces", "lidza_owner_status", "lidza_admins"},
	"jobs":      {"lidza_jobs"},
	"mail":      {"lidza_mail"},
	"llm":       {"lidza_llm", "lidza_llm_usage"},
	"storage":   {"lidza_storage"},
	"analytics": {"lidza_errors"},
	"audit":     {"lidza_audit"},
	"hooks":     {"lidza_hooks"},
	"billing":   {"lidza_billing"},
}

PackTools maps each official Go pack to the tools that show what it holds or does.

View Source
var TerminalOnly = map[string]string{
	"new":       "creates a project; an agent works inside one",
	"install":   "installs dependencies, services and databases on the developer's machine",
	"setup":     "the old name of install",
	"dev":       "a long-running server; the agent reads its output with lidza_logs",
	"benchmark": "a load test against the running app, run deliberately",
	"update":    "moves the app to another framework version: the developer's decision",
	"mcp":       "is this server",
	"version":   "printed by the server's initialize reply",
	"help":      "the tools describe themselves",
}

TerminalOnly are the commands with no tool, and why.

Functions

func Serve

func Serve(dir string, cfg *config.Config) error

Serve runs the server on stdin/stdout until the client disconnects, refreshing its lists as the project changes.

Types

type Server

type Server struct {
	*server.MCPServer
	// contains filtered or unexported fields
}

Server is the MCP server of one project. Its pack tools follow lidza.json, its prompts the guide, its app tools tools.go: Refresh reads them again and connected clients are told the lists changed, so an agent sees a pack it just added or a recipe it just recorded without a restart. Only a newer CLI binary needs a reconnect.

func New

func New(dir string, cfg *config.Config) *Server

New builds the server for the project in dir. cfg may be nil for a plain Go module.

func (*Server) Refresh

func (srv *Server) Refresh()

Refresh reads lidza.json, the guide and tools.go again and re-registers what changed: the pack tools, the prompts, the app tools. Command tools that change the project call it; Watch calls it when a file changes.

func (*Server) Watch

func (srv *Server) Watch(ctx context.Context)

Watch calls Refresh every two seconds while a watched file changes, until ctx ends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL