File mcp-server-postgresql.spec of Package mcp-server-postgresql

#
# spec file for package mcphost
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define gitname		postgresql-mcp
%define gitversion	0.2.0
Name:           mcp-server-postgresql
Version:        0.2.0
Release:        1.mge
Summary:        MCP server for PostgreSQL
License:        MIT
URL:           	https://github.com/sgaunet/postgresql-mcp
Source0:        %{gitname}-%{gitversion}.tar.gz
Source1:        %{gitname}-%{gitversion}-vendor.tar.gz
### Patch0:		%{gitname}-%{gitversion}-tidy.diff
%if 0%{?suse_version}
%if 0%{?sle_version} == 120500 && !0%{?is_opensuse}
BuildRequires:  go = 1.24.4
%else
BuildRequires:  go >= 1.24
%endif
%else
BuildRequires:  go >= 1.24
%endif

%description
A Model Context Protocol (MCP) server that provides secure PostgreSQL database
integration tools for Claude Code. Features read-only query execution, schema
exploration, and performance analysis.

%prep
%autosetup -p1 -a1 -n %{gitname}-%{gitversion}

sed -i -e "s/go 1.25.0/go 1.24/g" vendor/modules.txt
sed -i -e "s/go 1.24.6/go 1.24/g" vendor/modules.txt
sed -i -e "s/go 1.25.0/go 1.24/g" go.mod

%build
CGO_ENABLED=0 go build 		\
	-o %{name}		\
	-mod=vendor 		\
	-buildmode=pie 		\
	main.go

%install
install -D -m0755 %{name} %{buildroot}%{_bindir}/%{name}
ln %{buildroot}/%{_bindir}/%{name} %{buildroot}/%{_bindir}/%{gitname} 

%files
%license LICENSE
%doc README.md docs/tools.md
%{_bindir}/%{name}
%{_bindir}/%{gitname}

%changelog
* Tue Dec 02 2025 - Matthias G. Eckermann <mge@suse.com>
- Initial package creation for version 0.0.30
openSUSE Build Service is sponsored by