Skip to content

Commit 4317613

Browse files
committed
Update: packages.Package => Server
* Aligned packages.Server further with Mozilla AI model * Updated terminal text output for specific deprecated versions
1 parent bf69e6c commit 4317613

23 files changed

+427
-265
lines changed

cmd/add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func selectRuntime(
209209
}
210210

211211
func parseServerEntry(
212-
pkg packages.Package,
212+
pkg packages.Server,
213213
requestedRuntime runtime.Runtime,
214214
requestedTools []string,
215215
supportedRuntimes []runtime.Runtime,

cmd/add_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ func (f *fakeLoader) Load(_ string) (config.Modifier, error) {
4747
}
4848

4949
type fakeRegistry struct {
50-
pkg packages.Package
50+
pkg packages.Server
5151
err error
5252
}
5353

54-
func (f *fakeRegistry) Resolve(_ string, _ ...options.ResolveOption) (packages.Package, error) {
54+
func (f *fakeRegistry) Resolve(_ string, _ ...options.ResolveOption) (packages.Server, error) {
5555
return f.pkg, f.err
5656
}
5757

58-
func (f *fakeRegistry) Search(_ string, _ map[string]string, _ ...options.SearchOption) ([]packages.Package, error) {
59-
return []packages.Package{f.pkg}, f.err
58+
func (f *fakeRegistry) Search(_ string, _ map[string]string, _ ...options.SearchOption) ([]packages.Server, error) {
59+
return []packages.Server{f.pkg}, f.err
6060
}
6161

6262
func (f *fakeRegistry) ID() string {
@@ -74,7 +74,7 @@ func (f *fakeBuilder) Build() (registry.PackageProvider, error) {
7474

7575
func TestAddCmd_Success(t *testing.T) {
7676
cfg := &fakeConfig{}
77-
pkg := packages.Package{
77+
pkg := packages.Server{
7878
ID: "server1",
7979
Name: "Server1",
8080
Tools: []packages.Tool{
@@ -83,7 +83,7 @@ func TestAddCmd_Success(t *testing.T) {
8383
},
8484
Installations: map[runtime.Runtime]packages.Installation{
8585
runtime.UVX: {
86-
Command: "uvx",
86+
Runtime: "uvx",
8787
Package: "mcp-server-1",
8888
Version: "1.2.3",
8989
Recommended: true,
@@ -141,7 +141,7 @@ func TestAddCmd_RegistryFails(t *testing.T) {
141141
func TestAddCmd_BasicServerAdd(t *testing.T) {
142142
o := &bytes.Buffer{}
143143

144-
pkg := packages.Package{
144+
pkg := packages.Server{
145145
ID: "testserver",
146146
Name: "testserver",
147147
Tools: []packages.Tool{
@@ -151,7 +151,7 @@ func TestAddCmd_BasicServerAdd(t *testing.T) {
151151
},
152152
Installations: map[runtime.Runtime]packages.Installation{
153153
"uvx": {
154-
Command: "uvx",
154+
Runtime: "uvx",
155155
Package: "mcp-server-testserver",
156156
Version: "latest",
157157
Recommended: true,
@@ -192,14 +192,14 @@ func TestAddCmd_ServerWithArguments(t *testing.T) {
192192

193193
tests := []struct {
194194
name string
195-
pkg packages.Package
195+
pkg packages.Server
196196
expectedRequiredEnvs []string
197197
expectedRequiredValues []string
198198
expectedRequiredBools []string
199199
}{
200200
{
201201
name: "server with all argument types",
202-
pkg: packages.Package{
202+
pkg: packages.Server{
203203
ID: "github-server",
204204
Name: "GitHub Server",
205205
Tools: []packages.Tool{
@@ -208,7 +208,7 @@ func TestAddCmd_ServerWithArguments(t *testing.T) {
208208
},
209209
Installations: map[runtime.Runtime]packages.Installation{
210210
runtime.UVX: {
211-
Command: "uvx",
211+
Runtime: "uvx",
212212
Package: "mcp-server-github",
213213
Version: "1.0.0",
214214
Recommended: true,
@@ -229,15 +229,15 @@ func TestAddCmd_ServerWithArguments(t *testing.T) {
229229
},
230230
{
231231
name: "server with only env vars",
232-
pkg: packages.Package{
232+
pkg: packages.Server{
233233
ID: "db-server",
234234
Name: "Database Server",
235235
Tools: []packages.Tool{
236236
{Name: "query"},
237237
},
238238
Installations: map[runtime.Runtime]packages.Installation{
239239
runtime.UVX: {
240-
Command: "uvx",
240+
Runtime: "uvx",
241241
Package: "mcp-server-db",
242242
Version: "2.0.0",
243243
Recommended: true,
@@ -254,15 +254,15 @@ func TestAddCmd_ServerWithArguments(t *testing.T) {
254254
},
255255
{
256256
name: "server with mixed value and bool args",
257-
pkg: packages.Package{
257+
pkg: packages.Server{
258258
ID: "api-server",
259259
Name: "API Server",
260260
Tools: []packages.Tool{
261261
{Name: "call_api"},
262262
},
263263
Installations: map[runtime.Runtime]packages.Installation{
264264
runtime.UVX: {
265-
Command: "uvx",
265+
Runtime: "uvx",
266266
Package: "mcp-server-api",
267267
Version: "3.0.0",
268268
Recommended: true,
@@ -281,15 +281,15 @@ func TestAddCmd_ServerWithArguments(t *testing.T) {
281281
},
282282
{
283283
name: "server with no required arguments",
284-
pkg: packages.Package{
284+
pkg: packages.Server{
285285
ID: "simple-server",
286286
Name: "Simple Server",
287287
Tools: []packages.Tool{
288288
{Name: "hello"},
289289
},
290290
Installations: map[runtime.Runtime]packages.Installation{
291291
runtime.UVX: {
292-
Command: "uvx",
292+
Runtime: "uvx",
293293
Package: "mcp-server-simple",
294294
Version: "1.0.0",
295295
Recommended: true,
@@ -618,7 +618,7 @@ func TestParseServerEntry(t *testing.T) {
618618
tools[i] = packages.Tool{Name: tool}
619619
}
620620

621-
pkg := packages.Package{
621+
pkg := packages.Server{
622622
ID: tc.pkgID,
623623
Name: tc.pkgName,
624624
Tools: tools,

cmd/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type SearchCmd struct {
2727
Format internalcmd.OutputFormat
2828
IsOfficial bool
2929
registryBuilder registry.Builder
30-
packagePrinter output.Printer[packages.Package]
30+
packagePrinter output.Printer[packages.Server]
3131
}
3232

3333
func NewSearchCmd(baseCmd *internalcmd.BaseCmd, opt ...cmdopts.CmdOption) (*cobra.Command, error) {

0 commit comments

Comments
 (0)