sitebay-mcp 0.1.1751179164__tar.gz → 0.1.1751189381__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/PKG-INFO +1 -1
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/pyproject.toml +1 -1
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/exceptions.py +4 -2
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/resources.py +6 -6
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/server.py +57 -69
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/tools/sites.py +18 -3
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/.flake8 +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/.github/workflows/python-pytest.yml +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/.github/workflows/testpypi.yaml +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/.gitignore +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/Dockerfile +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/LICENSE +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/PLAN.md +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/README.md +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/example-config.json +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/smithery.yaml +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/__init__.py +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/auth.py +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/client.py +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/tools/__init__.py +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/tools/operations.py +0 -0
- {sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/uv.lock +0 -0
@@ -2,6 +2,8 @@
|
|
2
2
|
Custom exceptions for SiteBay MCP Server
|
3
3
|
"""
|
4
4
|
|
5
|
+
from typing import Optional, Dict, Any
|
6
|
+
|
5
7
|
|
6
8
|
class SiteBayError(Exception):
|
7
9
|
"""Base exception for SiteBay MCP operations"""
|
@@ -16,7 +18,7 @@ class AuthenticationError(SiteBayError):
|
|
16
18
|
class APIError(SiteBayError):
|
17
19
|
"""Raised when SiteBay API returns an error"""
|
18
20
|
|
19
|
-
def __init__(self, message: str, status_code: int = None, response_data:
|
21
|
+
def __init__(self, message: str, status_code: Optional[int] = None, response_data: Optional[Dict[Any, Any]] = None):
|
20
22
|
super().__init__(message)
|
21
23
|
self.status_code = status_code
|
22
24
|
self.response_data = response_data
|
@@ -25,7 +27,7 @@ class APIError(SiteBayError):
|
|
25
27
|
class ValidationError(SiteBayError):
|
26
28
|
"""Raised when request validation fails"""
|
27
29
|
|
28
|
-
def __init__(self, message: str, field_errors:
|
30
|
+
def __init__(self, message: str, field_errors: Optional[Dict[Any, Any]] = None):
|
29
31
|
super().__init__(message)
|
30
32
|
self.field_errors = field_errors or {}
|
31
33
|
|
@@ -23,7 +23,7 @@ async def get_site_config_resource(ctx: Context, site_fqdn: str) -> str:
|
|
23
23
|
JSON formatted site configuration
|
24
24
|
"""
|
25
25
|
try:
|
26
|
-
ctx.
|
26
|
+
await ctx.info(f"Fetching configuration resource for: {site_fqdn}")
|
27
27
|
|
28
28
|
from .server import initialize_client
|
29
29
|
client = await initialize_client()
|
@@ -60,7 +60,7 @@ async def get_site_config_resource(ctx: Context, site_fqdn: str) -> str:
|
|
60
60
|
return json.dumps(config, indent=2)
|
61
61
|
|
62
62
|
except SiteBayError as e:
|
63
|
-
ctx.
|
63
|
+
await ctx.error(f"Error fetching config for {site_fqdn}: {str(e)}")
|
64
64
|
return f"Error: {str(e)}"
|
65
65
|
|
66
66
|
|
@@ -77,7 +77,7 @@ async def get_site_events_resource(ctx: Context, site_fqdn: str, limit: int = 50
|
|
77
77
|
JSON formatted site events
|
78
78
|
"""
|
79
79
|
try:
|
80
|
-
ctx.
|
80
|
+
await ctx.info(f"Fetching events resource for: {site_fqdn}")
|
81
81
|
|
82
82
|
from .server import initialize_client
|
83
83
|
client = await initialize_client()
|
@@ -106,7 +106,7 @@ async def get_site_events_resource(ctx: Context, site_fqdn: str, limit: int = 50
|
|
106
106
|
return json.dumps(formatted_events, indent=2)
|
107
107
|
|
108
108
|
except SiteBayError as e:
|
109
|
-
ctx.
|
109
|
+
await ctx.error(f"Error fetching events for {site_fqdn}: {str(e)}")
|
110
110
|
return f"Error: {str(e)}"
|
111
111
|
|
112
112
|
|
@@ -121,7 +121,7 @@ async def get_account_summary_resource(ctx: Context) -> str:
|
|
121
121
|
JSON formatted account summary
|
122
122
|
"""
|
123
123
|
try:
|
124
|
-
ctx.
|
124
|
+
await ctx.info("Fetching account summary resource")
|
125
125
|
|
126
126
|
from .server import initialize_client
|
127
127
|
client = await initialize_client()
|
@@ -167,5 +167,5 @@ async def get_account_summary_resource(ctx: Context) -> str:
|
|
167
167
|
return json.dumps(summary, indent=2)
|
168
168
|
|
169
169
|
except SiteBayError as e:
|
170
|
-
ctx.
|
170
|
+
await ctx.error(f"Error fetching account summary: {str(e)}")
|
171
171
|
return f"Error: {str(e)}"
|
@@ -18,7 +18,7 @@ from . import resources
|
|
18
18
|
|
19
19
|
|
20
20
|
# Create the MCP server instance
|
21
|
-
mcp = FastMCP("SiteBay WordPress Hosting")
|
21
|
+
mcp: FastMCP = FastMCP("SiteBay WordPress Hosting")
|
22
22
|
|
23
23
|
|
24
24
|
# Global client instance (will be initialized on startup)
|
@@ -69,6 +69,9 @@ async def sitebay_list_sites(ctx: Context, team_id: Optional[str] = None) -> str
|
|
69
69
|
except SiteBayError as e:
|
70
70
|
await ctx.error(f"SiteBay API error: {str(e)}")
|
71
71
|
return f"❌ SiteBay Error: {str(e)}"
|
72
|
+
except ValueError as e:
|
73
|
+
await ctx.error(f"Validation error listing sites: {str(e)}")
|
74
|
+
return f"❌ Validation Error: {str(e)}"
|
72
75
|
except Exception as e:
|
73
76
|
await ctx.error(f"Unexpected error listing sites: {str(e)}")
|
74
77
|
return f"❌ Unexpected error: {str(e)}"
|
@@ -86,19 +89,19 @@ async def sitebay_get_site(ctx: Context, fqdn: str) -> str:
|
|
86
89
|
Detailed site information including status, versions, URLs, and configuration
|
87
90
|
"""
|
88
91
|
try:
|
89
|
-
ctx.
|
92
|
+
await ctx.info(f"Fetching details for site: {fqdn}")
|
90
93
|
|
91
94
|
client = await initialize_client()
|
92
95
|
result = await sites.sitebay_get_site(client, fqdn)
|
93
96
|
|
94
|
-
ctx.
|
97
|
+
await ctx.info(f"Successfully retrieved details for {fqdn}")
|
95
98
|
return result
|
96
99
|
|
97
100
|
except SiteBayError as e:
|
98
|
-
ctx.
|
101
|
+
await ctx.error(f"SiteBay API error for {fqdn}: {str(e)}")
|
99
102
|
return f"❌ SiteBay Error: {str(e)}"
|
100
103
|
except Exception as e:
|
101
|
-
ctx.
|
104
|
+
await ctx.error(f"Unexpected error getting site {fqdn}: {str(e)}")
|
102
105
|
return f"❌ Unexpected error: {str(e)}"
|
103
106
|
|
104
107
|
|
@@ -131,37 +134,32 @@ async def sitebay_create_site(
|
|
131
134
|
Success message with new site details and access information
|
132
135
|
"""
|
133
136
|
try:
|
134
|
-
ctx.
|
137
|
+
await ctx.info(f"Starting site creation for: {fqdn}")
|
135
138
|
|
136
139
|
# Progress reporting
|
137
|
-
progress = ctx.create_progress_token("site-creation")
|
138
|
-
await ctx.report_progress(progress, "Initializing site creation...", 0.1)
|
139
140
|
|
140
141
|
client = await initialize_client()
|
141
142
|
|
142
|
-
await ctx.report_progress(progress, "Validating site configuration...", 0.2)
|
143
143
|
|
144
144
|
# Basic validation
|
145
145
|
if not fqdn or '.' not in fqdn:
|
146
146
|
raise ValueError("Invalid domain name provided")
|
147
147
|
|
148
|
-
await ctx.report_progress(progress, "Submitting site creation request to SiteBay...", 0.4)
|
149
148
|
|
150
149
|
result = await sites.sitebay_create_site(
|
151
150
|
client, fqdn, wp_title, wp_username, wp_password, wp_email,
|
152
151
|
region_name, template_id, team_id
|
153
152
|
)
|
154
153
|
|
155
|
-
await ctx.report_progress(progress, "Site creation submitted successfully!", 1.0)
|
156
154
|
|
157
|
-
ctx.
|
155
|
+
await ctx.info(f"Successfully created site: {fqdn}")
|
158
156
|
return result
|
159
157
|
|
160
158
|
except ValueError as e:
|
161
|
-
ctx.
|
159
|
+
await ctx.error(f"Validation error creating site {fqdn}: {str(e)}")
|
162
160
|
return f"❌ Validation Error: {str(e)}"
|
163
161
|
except ValidationError as e:
|
164
|
-
ctx.
|
162
|
+
await ctx.error(f"SiteBay validation error creating site {fqdn}: {str(e)}")
|
165
163
|
|
166
164
|
# Provide detailed feedback for the agent with field-specific errors
|
167
165
|
error_msg = f"❌ Validation Error - Please check your input:\n{str(e)}\n"
|
@@ -174,10 +172,10 @@ async def sitebay_create_site(
|
|
174
172
|
error_msg += "\nPlease adjust your parameters and try again."
|
175
173
|
return error_msg
|
176
174
|
except SiteBayError as e:
|
177
|
-
ctx.
|
175
|
+
await ctx.error(f"SiteBay API error creating site {fqdn}: {str(e)}")
|
178
176
|
return f"❌ SiteBay Error: {str(e)}"
|
179
177
|
except Exception as e:
|
180
|
-
ctx.
|
178
|
+
await ctx.error(f"Unexpected error creating site {fqdn}: {str(e)}")
|
181
179
|
return f"❌ Unexpected error: {str(e)}"
|
182
180
|
|
183
181
|
|
@@ -399,7 +397,7 @@ async def sitebay_list_teams(ctx: Context) -> str:
|
|
399
397
|
Formatted list of teams with their details and member information
|
400
398
|
"""
|
401
399
|
try:
|
402
|
-
ctx.
|
400
|
+
await ctx.info("Fetching teams from SiteBay")
|
403
401
|
|
404
402
|
client = await initialize_client()
|
405
403
|
teams = await client.list_teams()
|
@@ -420,14 +418,14 @@ async def sitebay_list_teams(ctx: Context) -> str:
|
|
420
418
|
|
421
419
|
result += "\n"
|
422
420
|
|
423
|
-
ctx.
|
421
|
+
await ctx.info("Successfully retrieved teams list")
|
424
422
|
return result
|
425
423
|
|
426
424
|
except SiteBayError as e:
|
427
|
-
ctx.
|
425
|
+
await ctx.error(f"SiteBay API error: {str(e)}")
|
428
426
|
return f"❌ SiteBay Error: {str(e)}"
|
429
427
|
except Exception as e:
|
430
|
-
ctx.
|
428
|
+
await ctx.error(f"Unexpected error listing teams: {str(e)}")
|
431
429
|
return f"❌ Unexpected error: {str(e)}"
|
432
430
|
|
433
431
|
|
@@ -438,7 +436,7 @@ async def sitebay_wordpress_proxy(
|
|
438
436
|
site_fqdn: str,
|
439
437
|
endpoint: str,
|
440
438
|
method: str = "GET",
|
441
|
-
data: dict = None
|
439
|
+
data: Optional[dict] = None
|
442
440
|
) -> str:
|
443
441
|
"""
|
444
442
|
Proxy requests to a WordPress site's REST API.
|
@@ -453,7 +451,7 @@ async def sitebay_wordpress_proxy(
|
|
453
451
|
WordPress API response
|
454
452
|
"""
|
455
453
|
try:
|
456
|
-
ctx.
|
454
|
+
await ctx.info(f"WordPress proxy request to {site_fqdn}{endpoint}")
|
457
455
|
|
458
456
|
client = await initialize_client()
|
459
457
|
proxy_data = {
|
@@ -468,10 +466,10 @@ async def sitebay_wordpress_proxy(
|
|
468
466
|
return f"✅ WordPress API Response:\n```json\n{result}\n```"
|
469
467
|
|
470
468
|
except SiteBayError as e:
|
471
|
-
ctx.
|
469
|
+
await ctx.error(f"WordPress proxy error: {str(e)}")
|
472
470
|
return f"❌ WordPress Proxy Error: {str(e)}"
|
473
471
|
except Exception as e:
|
474
|
-
ctx.
|
472
|
+
await ctx.error(f"Unexpected proxy error: {str(e)}")
|
475
473
|
return f"❌ Unexpected error: {str(e)}"
|
476
474
|
|
477
475
|
|
@@ -482,7 +480,7 @@ async def sitebay_shopify_proxy(
|
|
482
480
|
endpoint: str,
|
483
481
|
access_token: str,
|
484
482
|
method: str = "GET",
|
485
|
-
data: dict = None
|
483
|
+
data: Optional[dict] = None
|
486
484
|
) -> str:
|
487
485
|
"""
|
488
486
|
Proxy requests to a Shopify Admin API.
|
@@ -498,7 +496,7 @@ async def sitebay_shopify_proxy(
|
|
498
496
|
Shopify API response
|
499
497
|
"""
|
500
498
|
try:
|
501
|
-
ctx.
|
499
|
+
await ctx.info(f"Shopify proxy request to {shop_domain}{endpoint}")
|
502
500
|
|
503
501
|
client = await initialize_client()
|
504
502
|
proxy_data = {
|
@@ -514,10 +512,10 @@ async def sitebay_shopify_proxy(
|
|
514
512
|
return f"✅ Shopify API Response:\n```json\n{result}\n```"
|
515
513
|
|
516
514
|
except SiteBayError as e:
|
517
|
-
ctx.
|
515
|
+
await ctx.error(f"Shopify proxy error: {str(e)}")
|
518
516
|
return f"❌ Shopify Proxy Error: {str(e)}"
|
519
517
|
except Exception as e:
|
520
|
-
ctx.
|
518
|
+
await ctx.error(f"Unexpected proxy error: {str(e)}")
|
521
519
|
return f"❌ Unexpected error: {str(e)}"
|
522
520
|
|
523
521
|
|
@@ -540,7 +538,7 @@ async def sitebay_posthog_proxy(
|
|
540
538
|
PostHog API response
|
541
539
|
"""
|
542
540
|
try:
|
543
|
-
ctx.
|
541
|
+
await ctx.info(f"PostHog proxy request to {endpoint}")
|
544
542
|
|
545
543
|
client = await initialize_client()
|
546
544
|
proxy_data = {
|
@@ -554,10 +552,10 @@ async def sitebay_posthog_proxy(
|
|
554
552
|
return f"✅ PostHog API Response:\n```json\n{result}\n```"
|
555
553
|
|
556
554
|
except SiteBayError as e:
|
557
|
-
ctx.
|
555
|
+
await ctx.error(f"PostHog proxy error: {str(e)}")
|
558
556
|
return f"❌ PostHog Proxy Error: {str(e)}"
|
559
557
|
except Exception as e:
|
560
|
-
ctx.
|
558
|
+
await ctx.error(f"Unexpected proxy error: {str(e)}")
|
561
559
|
return f"❌ Unexpected error: {str(e)}"
|
562
560
|
|
563
561
|
|
@@ -579,10 +577,8 @@ async def sitebay_staging_create(
|
|
579
577
|
Staging site creation confirmation
|
580
578
|
"""
|
581
579
|
try:
|
582
|
-
ctx.
|
580
|
+
await ctx.info(f"Creating staging site for {fqdn}")
|
583
581
|
|
584
|
-
progress = ctx.create_progress_token("staging-creation")
|
585
|
-
await ctx.report_progress(progress, "Creating staging environment...", 0.3)
|
586
582
|
|
587
583
|
client = await initialize_client()
|
588
584
|
staging_data = {}
|
@@ -591,16 +587,15 @@ async def sitebay_staging_create(
|
|
591
587
|
|
592
588
|
result = await client.create_staging_site(fqdn, staging_data)
|
593
589
|
|
594
|
-
await ctx.report_progress(progress, "Staging site created successfully!", 1.0)
|
595
590
|
|
596
|
-
ctx.
|
591
|
+
await ctx.info(f"Successfully created staging site for {fqdn}")
|
597
592
|
return f"✅ **Staging Site Created**\n\nStaging environment for {fqdn} is now available for testing changes safely."
|
598
593
|
|
599
594
|
except SiteBayError as e:
|
600
|
-
ctx.
|
595
|
+
await ctx.error(f"Error creating staging site: {str(e)}")
|
601
596
|
return f"❌ Staging Creation Error: {str(e)}"
|
602
597
|
except Exception as e:
|
603
|
-
ctx.
|
598
|
+
await ctx.error(f"Unexpected staging error: {str(e)}")
|
604
599
|
return f"❌ Unexpected error: {str(e)}"
|
605
600
|
|
606
601
|
|
@@ -616,19 +611,19 @@ async def sitebay_staging_delete(ctx: Context, fqdn: str) -> str:
|
|
616
611
|
Staging deletion confirmation
|
617
612
|
"""
|
618
613
|
try:
|
619
|
-
ctx.
|
614
|
+
await ctx.info(f"Deleting staging site for {fqdn}")
|
620
615
|
|
621
616
|
client = await initialize_client()
|
622
617
|
await client.delete_staging_site(fqdn)
|
623
618
|
|
624
|
-
ctx.
|
619
|
+
await ctx.info(f"Successfully deleted staging site for {fqdn}")
|
625
620
|
return f"✅ **Staging Site Deleted**\n\nThe staging environment for {fqdn} has been removed."
|
626
621
|
|
627
622
|
except SiteBayError as e:
|
628
|
-
ctx.
|
623
|
+
await ctx.error(f"Error deleting staging site: {str(e)}")
|
629
624
|
return f"❌ Staging Deletion Error: {str(e)}"
|
630
625
|
except Exception as e:
|
631
|
-
ctx.
|
626
|
+
await ctx.error(f"Unexpected staging error: {str(e)}")
|
632
627
|
return f"❌ Unexpected error: {str(e)}"
|
633
628
|
|
634
629
|
|
@@ -644,24 +639,21 @@ async def sitebay_staging_commit(ctx: Context, fqdn: str) -> str:
|
|
644
639
|
Staging commit confirmation
|
645
640
|
"""
|
646
641
|
try:
|
647
|
-
ctx.
|
642
|
+
await ctx.info(f"Committing staging changes for {fqdn}")
|
648
643
|
|
649
|
-
progress = ctx.create_progress_token("staging-commit")
|
650
|
-
await ctx.report_progress(progress, "Syncing staging to live...", 0.5)
|
651
644
|
|
652
645
|
client = await initialize_client()
|
653
646
|
result = await client.commit_staging_site(fqdn)
|
654
647
|
|
655
|
-
await ctx.report_progress(progress, "Staging committed to live successfully!", 1.0)
|
656
648
|
|
657
|
-
ctx.
|
649
|
+
await ctx.info(f"Successfully committed staging for {fqdn}")
|
658
650
|
return f"✅ **Staging Committed to Live**\n\nChanges from staging have been synchronized to the live site {fqdn}."
|
659
651
|
|
660
652
|
except SiteBayError as e:
|
661
|
-
ctx.
|
653
|
+
await ctx.error(f"Error committing staging: {str(e)}")
|
662
654
|
return f"❌ Staging Commit Error: {str(e)}"
|
663
655
|
except Exception as e:
|
664
|
-
ctx.
|
656
|
+
await ctx.error(f"Unexpected staging error: {str(e)}")
|
665
657
|
return f"❌ Unexpected error: {str(e)}"
|
666
658
|
|
667
659
|
|
@@ -683,7 +675,7 @@ async def sitebay_backup_list_commits(
|
|
683
675
|
List of available backup commits
|
684
676
|
"""
|
685
677
|
try:
|
686
|
-
ctx.
|
678
|
+
await ctx.info(f"Fetching backup commits for {fqdn}")
|
687
679
|
|
688
680
|
client = await initialize_client()
|
689
681
|
commits = await client.get_backup_commits(fqdn, number_to_fetch)
|
@@ -701,14 +693,14 @@ async def sitebay_backup_list_commits(
|
|
701
693
|
result += f" - Status: {'Completed' if commit.get('finished_at') else 'In Progress'}\n"
|
702
694
|
result += "\n"
|
703
695
|
|
704
|
-
ctx.
|
696
|
+
await ctx.info(f"Successfully retrieved backup commits for {fqdn}")
|
705
697
|
return result
|
706
698
|
|
707
699
|
except SiteBayError as e:
|
708
|
-
ctx.
|
700
|
+
await ctx.error(f"Error fetching backup commits: {str(e)}")
|
709
701
|
return f"❌ Backup Error: {str(e)}"
|
710
702
|
except Exception as e:
|
711
|
-
ctx.
|
703
|
+
await ctx.error(f"Unexpected backup error: {str(e)}")
|
712
704
|
return f"❌ Unexpected error: {str(e)}"
|
713
705
|
|
714
706
|
|
@@ -731,10 +723,8 @@ async def sitebay_backup_restore(
|
|
731
723
|
Restore operation confirmation
|
732
724
|
"""
|
733
725
|
try:
|
734
|
-
ctx.
|
726
|
+
await ctx.info(f"Starting point-in-time restore for {fqdn}")
|
735
727
|
|
736
|
-
progress = ctx.create_progress_token("backup-restore")
|
737
|
-
await ctx.report_progress(progress, "Initializing restore operation...", 0.1)
|
738
728
|
|
739
729
|
client = await initialize_client()
|
740
730
|
restore_data = {
|
@@ -742,20 +732,18 @@ async def sitebay_backup_restore(
|
|
742
732
|
"restore_type": restore_type
|
743
733
|
}
|
744
734
|
|
745
|
-
await ctx.report_progress(progress, "Submitting restore request...", 0.3)
|
746
735
|
|
747
736
|
result = await client.create_restore(fqdn, restore_data)
|
748
737
|
|
749
|
-
await ctx.report_progress(progress, "Restore operation initiated!", 1.0)
|
750
738
|
|
751
|
-
ctx.
|
739
|
+
await ctx.info(f"Successfully initiated restore for {fqdn}")
|
752
740
|
return f"✅ **Point-in-Time Restore Initiated**\n\nRestore operation for {fqdn} has been started. The site will be restored to the selected backup point."
|
753
741
|
|
754
742
|
except SiteBayError as e:
|
755
|
-
ctx.
|
743
|
+
await ctx.error(f"Error starting restore: {str(e)}")
|
756
744
|
return f"❌ Restore Error: {str(e)}"
|
757
745
|
except Exception as e:
|
758
|
-
ctx.
|
746
|
+
await ctx.error(f"Unexpected restore error: {str(e)}")
|
759
747
|
return f"❌ Unexpected error: {str(e)}"
|
760
748
|
|
761
749
|
|
@@ -769,7 +757,7 @@ async def sitebay_account_affiliates(ctx: Context) -> str:
|
|
769
757
|
List of users who signed up using your affiliate links
|
770
758
|
"""
|
771
759
|
try:
|
772
|
-
ctx.
|
760
|
+
await ctx.info("Fetching affiliate referrals")
|
773
761
|
|
774
762
|
client = await initialize_client()
|
775
763
|
affiliates = await client.get_affiliate_referrals()
|
@@ -785,14 +773,14 @@ async def sitebay_account_affiliates(ctx: Context) -> str:
|
|
785
773
|
result += f" - Status: {affiliate.get('status', 'Unknown')}\n"
|
786
774
|
result += "\n"
|
787
775
|
|
788
|
-
ctx.
|
776
|
+
await ctx.info("Successfully retrieved affiliate referrals")
|
789
777
|
return result
|
790
778
|
|
791
779
|
except SiteBayError as e:
|
792
|
-
ctx.
|
780
|
+
await ctx.error(f"Error fetching affiliates: {str(e)}")
|
793
781
|
return f"❌ Affiliate Error: {str(e)}"
|
794
782
|
except Exception as e:
|
795
|
-
ctx.
|
783
|
+
await ctx.error(f"Unexpected affiliate error: {str(e)}")
|
796
784
|
return f"❌ Unexpected error: {str(e)}"
|
797
785
|
|
798
786
|
|
@@ -815,7 +803,7 @@ async def sitebay_account_create_checkout(
|
|
815
803
|
Stripe checkout URL
|
816
804
|
"""
|
817
805
|
try:
|
818
|
-
ctx.
|
806
|
+
await ctx.info(f"Creating checkout session for {plan_name} plan")
|
819
807
|
|
820
808
|
client = await initialize_client()
|
821
809
|
checkout_data = {
|
@@ -827,14 +815,14 @@ async def sitebay_account_create_checkout(
|
|
827
815
|
|
828
816
|
result = await client.create_checkout_session(checkout_data)
|
829
817
|
|
830
|
-
ctx.
|
818
|
+
await ctx.info("Successfully created checkout session")
|
831
819
|
return f"✅ **Checkout Session Created**\n\nPlan: {plan_name} ({interval}ly)\nCheckout URL: {result.get('url', 'URL not provided')}"
|
832
820
|
|
833
821
|
except SiteBayError as e:
|
834
|
-
ctx.
|
822
|
+
await ctx.error(f"Error creating checkout: {str(e)}")
|
835
823
|
return f"❌ Checkout Error: {str(e)}"
|
836
824
|
except Exception as e:
|
837
|
-
ctx.
|
825
|
+
await ctx.error(f"Unexpected checkout error: {str(e)}")
|
838
826
|
return f"❌ Unexpected error: {str(e)}"
|
839
827
|
|
840
828
|
|
@@ -3,8 +3,8 @@ Site management tools for SiteBay MCP Server
|
|
3
3
|
"""
|
4
4
|
|
5
5
|
from typing import Optional, Dict, Any, List
|
6
|
-
from
|
7
|
-
from
|
6
|
+
from sitebay_mcp.client import SiteBayClient
|
7
|
+
from sitebay_mcp.exceptions import SiteBayError
|
8
8
|
|
9
9
|
|
10
10
|
async def sitebay_list_sites(
|
@@ -21,7 +21,17 @@ async def sitebay_list_sites(
|
|
21
21
|
Formatted string with site details
|
22
22
|
"""
|
23
23
|
try:
|
24
|
+
if team_id is not None and not isinstance(team_id, str):
|
25
|
+
msg = "team_id must be a string if provided"
|
26
|
+
raise ValueError(msg)
|
27
|
+
|
24
28
|
sites = await client.list_sites(team_id=team_id)
|
29
|
+
|
30
|
+
if isinstance(sites, str):
|
31
|
+
return f"Error listing sites: {sites}"
|
32
|
+
|
33
|
+
if not isinstance(sites, list) or not all(isinstance(s, dict) for s in sites):
|
34
|
+
return f"Unexpected response format when listing sites: {sites}"
|
25
35
|
|
26
36
|
if not sites:
|
27
37
|
return "No sites found for your account."
|
@@ -43,6 +53,8 @@ async def sitebay_list_sites(
|
|
43
53
|
|
44
54
|
except SiteBayError as e:
|
45
55
|
return f"Error listing sites: {str(e)}"
|
56
|
+
except ValueError as e:
|
57
|
+
return f"Error listing sites: {str(e)}"
|
46
58
|
|
47
59
|
|
48
60
|
async def sitebay_get_site(
|
@@ -242,7 +254,10 @@ async def sitebay_delete_site(
|
|
242
254
|
try:
|
243
255
|
await client.delete_site(fqdn)
|
244
256
|
|
245
|
-
return
|
257
|
+
return (
|
258
|
+
"✅ **Site Deleted Successfully**\n\n"
|
259
|
+
f"The site {fqdn} has been permanently deleted."
|
260
|
+
)
|
246
261
|
|
247
262
|
except SiteBayError as e:
|
248
263
|
return f"Error deleting site: {str(e)}"
|
File without changes
|
{sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/.github/workflows/python-pytest.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sitebay_mcp-0.1.1751179164 → sitebay_mcp-0.1.1751189381}/src/sitebay_mcp/tools/operations.py
RENAMED
File without changes
|
File without changes
|