Skip to content

Commit c57facf

Browse files
feat: update module name to github.com/1Panel-dev/mcp-1panel
1 parent 1a6930e commit c57facf

15 files changed

+72
-76
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module mcp-1panel
1+
module github.com/1Panel-dev/mcp-1panel
22

33
go 1.23
44

55
toolchain go1.23.7
66

7-
require github.com/mark3labs/mcp-go v0.14.1
7+
require github.com/mark3labs/mcp-go v0.16.0
88

99
require (
1010
github.com/google/uuid v1.6.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
44
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5-
github.com/mark3labs/mcp-go v0.14.1 h1:NsieyFbuWQaeZSWSHPvJ5TwJdQwu+1jmivAIVljeouY=
6-
github.com/mark3labs/mcp-go v0.14.1/go.mod h1:xBB350hekQsJAK7gJAii8bcEoWemboLm2mRm5/+KBaU=
5+
github.com/mark3labs/mcp-go v0.16.0 h1:hNOr0EqhSUra5jm1Wv6+BOynzIa+bMtfP3zgde70MvY=
6+
github.com/mark3labs/mcp-go v0.16.0/go.mod h1:KmJndYv7GIgcPVwEKJjNcbhVQ+hJGJhrCCB/9xITzpE=
77
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
88
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
99
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=

main.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package main
33
import (
44
"flag"
55
"fmt"
6+
"github.com/1Panel-dev/mcp-1panel/operations/app"
7+
"github.com/1Panel-dev/mcp-1panel/operations/database"
8+
"github.com/1Panel-dev/mcp-1panel/operations/ssl"
9+
"github.com/1Panel-dev/mcp-1panel/operations/system"
10+
"github.com/1Panel-dev/mcp-1panel/operations/website"
11+
"github.com/1Panel-dev/mcp-1panel/utils"
612
"log"
7-
"mcp-1panel/operations/app"
8-
"mcp-1panel/operations/database"
9-
"mcp-1panel/operations/ssl"
10-
"mcp-1panel/operations/system"
11-
"mcp-1panel/operations/website"
12-
"mcp-1panel/utils"
1313
"os"
1414
"path/filepath"
1515

@@ -41,7 +41,7 @@ func setupLogger() (*os.File, error) {
4141

4242
func newMCPServer() *server.MCPServer {
4343
return server.NewMCPServer(
44-
"mcp-1panel",
44+
"github.com/1Panel-dev/mcp-1panel",
4545
Version,
4646
server.WithToolCapabilities(true),
4747
server.WithLogging(),
@@ -62,20 +62,17 @@ func addTools(s *server.MCPServer) {
6262
s.AddTool(database.CreateDatabaseTool, database.CreateDatabaseHandle)
6363
}
6464

65-
66-
67-
6865
func runServer(transport string, addr string) error {
6966
mcpServer := newMCPServer()
7067
addTools(mcpServer)
7168

7269
if transport == "sse" {
73-
port,err := utils.GetPortFromAddr(addr)
70+
port, err := utils.GetPortFromAddr(addr)
7471
if err != nil {
7572
return err
7673
}
7774
log.Printf("SSE server listening on :%s", port)
78-
sseServer := server.NewSSEServer(mcpServer,server.WithBaseURL(addr))
75+
sseServer := server.NewSSEServer(mcpServer, server.WithBaseURL(addr))
7976
if err := sseServer.Start(fmt.Sprintf(":%s", port)); err != nil {
8077
log.Fatalf("Server error: %v", err)
8178
}
@@ -93,7 +90,7 @@ func main() {
9390
transport string
9491
accessToken string
9592
host string
96-
addr string
93+
addr string
9794
)
9895
flag.StringVar(&transport, "transport", "sse", "Transport type (stdio or sse)")
9996
flag.StringVar(&addr, "addr", "http://localhost:8000", "The base URL for mcp Server")

operations/app/install_mysql.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"mcp-1panel/operations/types"
8-
"mcp-1panel/utils"
7+
"github.com/1Panel-dev/mcp-1panel/operations/types"
8+
"github.com/1Panel-dev/mcp-1panel/utils"
99
"strings"
1010

1111
"github.com/mark3labs/mcp-go/mcp"
@@ -19,9 +19,9 @@ var InstallMySQLTool = mcp.NewTool(
1919
InstallMySQL,
2020
mcp.WithDescription("install mysql, if not set name, default is mysql, if not set version, default is '', if not set root_password, default is '')"),
2121
mcp.WithString("name", mcp.Description("mysql name")),
22-
mcp.WithString("version", mcp.Description("mysql version, not support latest version"),mcp.DefaultString("")),
23-
mcp.WithString("root_password", mcp.Description("mysql root password"),mcp.DefaultString("")),
24-
mcp.WithNumber("port", mcp.Description("mysql port"),mcp.DefaultNumber(3306)),
22+
mcp.WithString("version", mcp.Description("mysql version, not support latest version"), mcp.DefaultString("")),
23+
mcp.WithString("root_password", mcp.Description("mysql root password"), mcp.DefaultString("")),
24+
mcp.WithNumber("port", mcp.Description("mysql port"), mcp.DefaultNumber(3306)),
2525
)
2626

2727
func InstallMySQLHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
@@ -37,15 +37,15 @@ func InstallMySQLHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.
3737
if version == "latest" {
3838
version = ""
3939
}
40-
}
40+
}
4141
appRes := &types.AppRes{}
4242
_, err := utils.NewPanelClient("GET", "/apps/mysql").Request(appRes)
4343
if err != nil {
4444
return nil, err
4545
}
4646
exist := false
4747
for _, v := range appRes.Data.Versions {
48-
if v == version || strings.Contains(v, version){
48+
if v == version || strings.Contains(v, version) {
4949
version = v
5050
exist = true
5151
break
@@ -82,9 +82,9 @@ func InstallMySQLHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.
8282

8383
req := &types.AppInstallCreate{
8484
AppDetailID: appDetailID,
85-
Name: name,
85+
Name: name,
8686
Params: map[string]interface{}{
87-
"PANEL_APP_PORT_HTTP": port,
87+
"PANEL_APP_PORT_HTTP": port,
8888
"PANEL_DB_ROOT_PASSWORD": rootPassword,
8989
},
9090
}

operations/app/install_openresty.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package app
33
import (
44
"context"
55
"fmt"
6-
"mcp-1panel/operations/types"
7-
"mcp-1panel/utils"
6+
"github.com/1Panel-dev/mcp-1panel/operations/types"
7+
"github.com/1Panel-dev/mcp-1panel/utils"
88

99
"github.com/mark3labs/mcp-go/mcp"
1010
)
@@ -63,7 +63,7 @@ func InstallOpenRestyHandle(ctx context.Context, request mcp.CallToolRequest) (*
6363

6464
req := &types.AppInstallCreate{
6565
AppDetailID: appDetailID,
66-
Name: name,
66+
Name: name,
6767
Params: map[string]interface{}{
6868
"PANEL_APP_PORT_HTTP": httpPort,
6969
"PANEL_APP_PORT_HTTPS": httpsPort,

operations/app/list_install.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package app
22

33
import (
44
"context"
5-
"mcp-1panel/operations/types"
6-
"mcp-1panel/utils"
5+
"github.com/1Panel-dev/mcp-1panel/operations/types"
6+
"github.com/1Panel-dev/mcp-1panel/utils"
77

88
"github.com/mark3labs/mcp-go/mcp"
99
)
@@ -16,6 +16,7 @@ var ListInstalledAppsTool = mcp.NewTool(
1616
ListInstalledApps,
1717
mcp.WithDescription("list installed apps"),
1818
)
19+
1920
func ListInstalledAppsHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
2021
req := &types.PageRequest{
2122
Page: 1,

operations/database/create.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"encoding/base64"
66
"errors"
7-
"mcp-1panel/operations/types"
8-
"mcp-1panel/utils"
7+
"github.com/1Panel-dev/mcp-1panel/operations/types"
8+
"github.com/1Panel-dev/mcp-1panel/utils"
99

1010
"github.com/mark3labs/mcp-go/mcp"
1111
)
@@ -14,7 +14,6 @@ const (
1414
CreateDatabase = "create_database"
1515
)
1616

17-
1817
var CreateDatabaseTool = mcp.NewTool(
1918
CreateDatabase,
2019
mcp.WithDescription("create a database by type name and password"),
@@ -27,13 +26,13 @@ var CreateDatabaseTool = mcp.NewTool(
2726

2827
func CreateDatabaseHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
2928
var (
30-
database string
31-
password string
32-
name string
29+
database string
30+
password string
31+
name string
3332
databaseType string
34-
username string
33+
username string
3534
)
36-
if request.Params.Arguments["database"] == nil {
35+
if request.Params.Arguments["database"] == nil {
3736
return nil, errors.New("database name is required")
3837
}
3938
database = request.Params.Arguments["database"].(string)
@@ -50,17 +49,17 @@ func CreateDatabaseHandle(ctx context.Context, request mcp.CallToolRequest) (*mc
5049
name = request.Params.Arguments["name"].(string)
5150
if request.Params.Arguments["password"] == nil {
5251
password = utils.GetRandomStr(12)
53-
}else {
52+
} else {
5453
password = request.Params.Arguments["password"].(string)
5554
}
5655
encodedPassword := base64.StdEncoding.EncodeToString([]byte(password))
5756

5857
if request.Params.Arguments["username"] == nil {
5958
username = name
60-
}else {
59+
} else {
6160
username = request.Params.Arguments["username"].(string)
6261
}
63-
62+
6463
createReq := &types.CreateDatabaseRequest{
6564
Database: database,
6665
Password: encodedPassword,
@@ -74,12 +73,11 @@ func CreateDatabaseHandle(ctx context.Context, request mcp.CallToolRequest) (*mc
7473
createUrl = "/databases"
7574
createReq.Format = "utf8mb4"
7675
createReq.Permission = "%"
77-
}else {
76+
} else {
7877
createUrl = "/databases/pg"
7978
createReq.Format = "UTF8"
8079
}
8180
client := utils.NewPanelClient("POST", createUrl, utils.WithPayload(createReq))
8281
res := &types.Response{}
8382
return client.Request(res)
8483
}
85-

operations/database/list.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package database
33
import (
44
"context"
55
"errors"
6-
"mcp-1panel/operations/types"
7-
"mcp-1panel/utils"
6+
"github.com/1Panel-dev/mcp-1panel/operations/types"
7+
"github.com/1Panel-dev/mcp-1panel/utils"
88

99
"github.com/mark3labs/mcp-go/mcp"
1010
)
@@ -16,7 +16,7 @@ const (
1616
var ListDatabasesTool = mcp.NewTool(
1717
ListDatabases,
1818
mcp.WithDescription("list databases by name"),
19-
mcp.WithString("name", mcp.Description("database name"), mcp.DefaultString(""),mcp.Required()),
19+
mcp.WithString("name", mcp.Description("database name"), mcp.DefaultString(""), mcp.Required()),
2020
)
2121

2222
func ListDatabasesHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
@@ -32,11 +32,11 @@ func ListDatabasesHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp
3232
Page: 1,
3333
PageSize: 500,
3434
},
35-
Order: "null",
36-
OrderBy: "created_at",
37-
Database: database,
35+
Order: "null",
36+
OrderBy: "created_at",
37+
Database: database,
3838
}
3939
databaseListRes := &types.DatabaseListResponse{}
4040
client := utils.NewPanelClient("POST", "/databases/search", utils.WithPayload(pageReq))
4141
return client.Request(databaseListRes)
42-
}
42+
}

operations/ssl/create.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package ssl
33
import (
44
"context"
55
"errors"
6-
"mcp-1panel/operations/types"
7-
"mcp-1panel/utils"
6+
"github.com/1Panel-dev/mcp-1panel/operations/types"
7+
"github.com/1Panel-dev/mcp-1panel/utils"
88
"strings"
99

1010
"github.com/mark3labs/mcp-go/mcp"
@@ -18,7 +18,7 @@ var CreateSSLTool = mcp.NewTool(
1818
CreateSSL,
1919
mcp.WithDescription("create ssl"),
2020
mcp.WithString("domain", mcp.Description("domain"), mcp.Required()),
21-
mcp.WithString("provider", mcp.Description("provider support dnsAccount,http"), mcp.Required(),mcp.DefaultString("dnsAccount")),
21+
mcp.WithString("provider", mcp.Description("provider support dnsAccount,http"), mcp.Required(), mcp.DefaultString("dnsAccount")),
2222
mcp.WithString("dnsAccount", mcp.Description("dnsAccount"), mcp.DefaultString("")),
2323
)
2424

@@ -41,7 +41,7 @@ func CreateSSLHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
4141
PageSize: 500,
4242
}
4343
client := utils.NewPanelClient("POST", "/websites/acme/search", utils.WithPayload(pageReq))
44-
_,err := client.Request(acmeRes)
44+
_, err := client.Request(acmeRes)
4545
if err != nil {
4646
return nil, err
4747
}
@@ -54,7 +54,7 @@ func CreateSSLHandle(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
5454
if provider == "dnsAccount" {
5555
dnsAccountRes := &types.ListDNSAccountRes{}
5656
client = utils.NewPanelClient("POST", "/websites/dns/search", utils.WithPayload(pageReq))
57-
_,err = client.Request(dnsAccountRes)
57+
_, err = client.Request(dnsAccountRes)
5858
if err != nil {
5959
return nil, err
6060
}

operations/ssl/list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package ssl
22

33
import (
44
"context"
5-
"mcp-1panel/operations/types"
6-
"mcp-1panel/utils"
5+
"github.com/1Panel-dev/mcp-1panel/operations/types"
6+
"github.com/1Panel-dev/mcp-1panel/utils"
77

88
"github.com/mark3labs/mcp-go/mcp"
99
)
@@ -13,7 +13,7 @@ const (
1313
)
1414

1515
var ListSSLsTool = mcp.NewTool(
16-
ListSSLs,
16+
ListSSLs,
1717
mcp.WithDescription("list ssls"),
1818
)
1919

operations/system/dashboard.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package system
22

33
import (
44
"context"
5-
"mcp-1panel/operations/types"
6-
"mcp-1panel/utils"
5+
"github.com/1Panel-dev/mcp-1panel/operations/types"
6+
"github.com/1Panel-dev/mcp-1panel/utils"
77

88
"github.com/mark3labs/mcp-go/mcp"
99
)

operations/system/info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package system
22

33
import (
44
"context"
5-
"mcp-1panel/operations/types"
6-
"mcp-1panel/utils"
5+
"github.com/1Panel-dev/mcp-1panel/operations/types"
6+
"github.com/1Panel-dev/mcp-1panel/utils"
77

88
"github.com/mark3labs/mcp-go/mcp"
99
)

operations/website/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package website
33
import (
44
"context"
55
"errors"
6-
"mcp-1panel/operations/types"
7-
"mcp-1panel/utils"
6+
"github.com/1Panel-dev/mcp-1panel/operations/types"
7+
"github.com/1Panel-dev/mcp-1panel/utils"
88

99
"github.com/mark3labs/mcp-go/mcp"
1010
)

0 commit comments

Comments
 (0)