MCPcopy Index your code
hub / github.com/coder/coder / NewManager

Function NewManager

agent/x/agentmcp/manager.go:143–163  ·  view source on GitHub ↗

NewManager creates a new MCP client manager. The ctx bounds subprocess lifetime. The execer applies resource limits to MCP server subprocesses. The updateEnv callback enriches the subprocess environment to match interactive sessions.

(
	ctx context.Context,
	logger slog.Logger,
	execer agentexec.Execer,
	updateEnv func([]string) ([]string, error),
)

Source from the content-addressed store, hash-verified

141// MCP server subprocesses. The updateEnv callback enriches the
142// subprocess environment to match interactive sessions.
143func NewManager(
144 ctx context.Context,
145 logger slog.Logger,
146 execer agentexec.Execer,
147 updateEnv func([]string) ([]string, error),
148) *Manager {
149 managerCtx, cancel := context.WithCancel(ctx)
150 return &Manager{
151 ctx: managerCtx,
152 cancel: cancel,
153 logger: logger,
154 clock: quartz.NewReal(),
155 execer: execer,
156 updateEnv: updateEnv,
157 servers: make(map[string]*serverEntry),
158 snapshot: make(map[string]fileSnapshot),
159 startupSettled: make(chan struct{}),
160 closedCh: make(chan struct{}),
161 watchDebounce: defaultWatchDebounce,
162 }
163}
164
165// Reload ensures the tool cache reflects the current config.
166//

Calls

no outgoing calls