Add scripts/lmcp-install-macos.sh + LMCP_TOKEN env fallback
lmcp.lua: if opts.auth_token and opts.conf are both unset, fall back to the LMCP_TOKEN environment variable. Empty string treated as unset. This is the primitive launchd/systemd drop-ins need — no conf file bookkeeping on hosts that don't already use one. scripts/lmcp-install-macos.sh: macOS installer via Homebrew. Drops the Lua library files into $(brew --prefix)/share/lua/5.4/, mints (or reuses) a Bearer token stored at $(brew --prefix)/etc/lmcp/token, installs a ~/Library/LaunchAgents/ plist with LMCP_TOKEN baked in, launchctl-loads it, and smoke-tests. Prints the Claude Code ~/.claude.json snippet at the end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,12 +33,17 @@ function lmcp.new(name, opts)
|
||||
self.port = opts.port or 8080
|
||||
self.tools = {}
|
||||
self._session_id = nil
|
||||
-- Auth: explicit opt > conf file > nil (no auth)
|
||||
-- Auth: explicit opt > conf file > LMCP_TOKEN env > nil (no auth)
|
||||
if opts.auth_token then
|
||||
self._auth_token = opts.auth_token
|
||||
elseif opts.conf then
|
||||
local conf = read_conf(opts.conf)
|
||||
self._auth_token = conf['.godparticle']
|
||||
else
|
||||
local env_token = os.getenv("LMCP_TOKEN")
|
||||
if env_token and env_token ~= "" then
|
||||
self._auth_token = env_token
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user