Documentation
¶
Overview ¶
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT Package mcpinstall registers and removes sting's MCP server entry in the config files of agent runtimes (Claude Code, Codex, OpenCode, Grok). Each runtime has an adapter translating the runtime-agnostic Entry into that runtime's native config shape, with atomic, format-preserving writes.
SPDX-License-Identifier: MIT
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrScopeUnsupported = errors.New("scope not supported by this runtime")
ErrScopeUnsupported is returned by adapters that do not support a given Scope (e.g. Codex has no project scope).
Functions ¶
func ClaudePermissionToolName ¶
ClaudePermissionToolName returns the identifier Claude Code matches in permissions.allow for a sting MCP tool: mcp__<server>__<tool>.
func ClaudePermissionsSnippet ¶
ClaudePermissionsSnippet renders a ~/.claude/settings.json fragment that allow-lists the given tools under permissions.allow. sting's tools are all read-only, so auto-approving them is safe.
func Snippet ¶
Snippet returns a self-contained config fragment that registers sting under the named runtime, matching what the adapter would write. Intended for `sting install --manual`, so a user can paste it verbatim.
func WriteAtomic ¶
WriteAtomic writes data to path via a temp-file-plus-rename so readers never observe a truncated file. If path already exists as a regular file (or a symlink to one), its mode is preserved; otherwise mode is used. Symlinks are resolved and the write lands on the target, leaving the link in place. The parent directory must already exist.
Types ¶
type Entry ¶
Entry is the runtime-agnostic MCP server entry written into each agent's config. Adapters translate it to their native shape (JSON object vs TOML table, command+args vs argv array). Enabled is honored by runtimes that have the concept (OpenCode, Grok); others always write it as true.
type Runtime ¶
type Runtime interface {
Name() string
Detect() (bool, error)
ConfigPath(scope Scope) (string, error)
ReadEntry(path string) (entry Entry, present bool, err error)
WriteEntry(path string, entry Entry) error
RemoveEntry(path string) (removed bool, err error)
}
Runtime is the adapter contract; implementations live in the per-runtime files in this package.
type Selection ¶
type Selection struct {
Explicit []string
}
Selection expresses which runtimes a CLI invocation targets. An empty Explicit list means auto-detect; otherwise only the named runtimes apply.
func SelectionFromFlags ¶
SelectionFromFlags builds a Selection from per-runtime bool flags, in a deterministic order.