# Maintainer: Markus Fritsche <mfritsche@reauktion.de>
# Lightweight MCP server in pure Lua.
# Source of truth: git.reauktion.de/marfrit/lmcp

pkgname=lmcp
pkgver=1.0.0_rc1
pkgrel=1
pkgdesc="Lightweight MCP (Model Context Protocol) server in pure Lua"
arch=('any')
url="https://git.reauktion.de/marfrit/lmcp"
license=('MIT')
depends=('lua' 'lua-socket')
# Arch pkgver disallows '-'; encode v1.0.0-rc1 upstream tag as 1.0.0_rc1.
# Translate back for the source URL.
_tag="v${pkgver//_/-}"
source=("${pkgname}-${pkgver}.tar.gz::https://git.reauktion.de/marfrit/lmcp/archive/${_tag}.tar.gz")
sha256sums=('81f9222264371735c196664382460261ef60a259348766bbd6fd2f49ea9d1e7e')

package() {
    cd "${pkgname}"
    install -Dm644 lmcp.lua           "${pkgdir}/usr/share/lua/5.4/lmcp.lua"
    install -Dm644 json.lua           "${pkgdir}/usr/share/lua/5.4/json.lua"
    install -Dm644 server.lua         "${pkgdir}/usr/share/lua/5.4/server.lua"
    install -Dm644 hub.lua            "${pkgdir}/usr/share/lua/5.4/hub.lua"
    install -Dm644 examples/lmcp-hub.service          "${pkgdir}/usr/share/doc/${pkgname}/examples/lmcp-hub.service"
    install -Dm644 examples/lmcp.service              "${pkgdir}/usr/share/doc/${pkgname}/examples/lmcp.service"
    install -Dm644 examples/hub-backends.conf.example "${pkgdir}/usr/share/doc/${pkgname}/examples/hub-backends.conf.example"
    install -Dm755 example_server.lua "${pkgdir}/usr/bin/lmcp-example"
    install -Dm644 README.md          "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}
