Skip to content

Commit 96a9c63

Browse files
committed
Clarify authorization header format in share panels
- Change 'Authorization Header:' to 'HEADER Authorization:' - Makes it crystal clear this is an HTTP header - Users can easily copy the exact header name and value - Format: HEADER Authorization: Bearer <api-key>
1 parent 8eee2c8 commit 96a9c63

File tree

4 files changed

+68
-35
lines changed

4 files changed

+68
-35
lines changed

src/mcpm/commands/profile/run.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import click
77
from rich.console import Console
8+
from rich.panel import Panel
89

910
from mcpm.fastmcp_integration.proxy import create_mcpm_proxy
1011
from mcpm.profile.profile_config import ProfileConfigManager
@@ -72,17 +73,22 @@ async def run_profile_fastmcp(profile_servers, profile_name, http_mode=False, po
7273
if actual_port != port:
7374
logger.debug(f"Port {port} is busy, using port {actual_port} instead")
7475

75-
# Display server information
76+
# Display profile information in a nice panel
7677
http_url = f"http://127.0.0.1:{actual_port}/mcp/"
77-
console.print(f"[bold green]Profile '{profile_name}' is now running at:[/]")
78-
console.print(f"[cyan]{http_url}[/]")
79-
80-
# Show servers in the profile
81-
console.print("[bold green]Servers:[/]")
82-
for server_config in profile_servers:
83-
console.print(f" • [cyan]{server_config.name}[/]")
84-
85-
console.print("[dim]Press Ctrl+C to stop the profile[/]")
78+
79+
# Build server list
80+
server_list = "\n".join([f" • [cyan]{server.name}[/]" for server in profile_servers])
81+
82+
panel_content = f"[bold]Profile:[/] {profile_name}\n[bold]URL:[/] [cyan]{http_url}[/cyan]\n\n[bold]Servers:[/]\n{server_list}\n\n[dim]Press Ctrl+C to stop the profile[/]"
83+
84+
panel = Panel(
85+
panel_content,
86+
title="📁 Profile Running Locally",
87+
title_align="left",
88+
border_style="green",
89+
padding=(1, 2)
90+
)
91+
console.print(panel)
8692

8793
logger.debug(f"Starting FastMCP proxy for profile '{profile_name}' on port {actual_port}")
8894

src/mcpm/commands/profile/share.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import click
88
from rich.console import Console
9+
from rich.panel import Panel
910

1011
from mcpm.core.tunnel import Tunnel
1112
from mcpm.fastmcp_integration.proxy import create_mcpm_proxy
@@ -118,22 +119,30 @@ async def share_profile_fastmcp(profile_servers, profile_name, port, address, ht
118119
public_url = tunnel.start_tunnel()
119120

120121
if public_url:
121-
# Display critical information only
122+
# Display critical information in a nice panel
122123
http_url = f"{public_url}/mcp/"
123-
console.print(f"[bold green]Profile '{profile_name}' is now shared at:[/]")
124-
console.print(f"[cyan]{http_url}[/]")
125-
124+
125+
# Build server list
126+
server_list = "\n".join([f" • [cyan]{server.name}[/]" for server in profile_servers])
127+
128+
# Build panel content based on auth status
129+
panel_content = f"[bold]Profile:[/] {profile_name}\n[bold]URL:[/] [cyan]{http_url}[/cyan]\n"
130+
126131
if not no_auth and api_key:
127-
console.print(f"[bold green]API Key:[/] [cyan]{api_key}[/]")
132+
panel_content += f"[bold]HEADER Authorization:[/] [cyan]Bearer {api_key}[/cyan]\n"
128133
else:
129-
console.print("[bold red]Warning:[/] Anyone with the URL can access your servers.")
130-
131-
# Show available servers
132-
console.print("[bold green]Shared servers:[/]")
133-
for server_config in profile_servers:
134-
console.print(f" • [cyan]{server_config.name}[/]")
135-
136-
console.print("[dim]Press Ctrl+C to stop sharing[/]")
134+
panel_content += "[bold red]⚠️ Warning:[/] Anyone with the URL can access your servers\n"
135+
136+
panel_content += f"\n[bold]Shared servers:[/]\n{server_list}\n\n[dim]Press Ctrl+C to stop sharing[/]"
137+
138+
panel = Panel(
139+
panel_content,
140+
title="📁 Profile Shared Publicly",
141+
title_align="left",
142+
border_style="blue",
143+
padding=(1, 2)
144+
)
145+
console.print(panel)
137146

138147
# Keep running until interrupted
139148
try:

src/mcpm/commands/run.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import click
1010
from rich.console import Console
11+
from rich.panel import Panel
1112

1213
from mcpm.fastmcp_integration.proxy import create_mcpm_proxy
1314
from mcpm.global_config import GlobalConfigManager
@@ -115,11 +116,17 @@ async def run_server_with_fastmcp(server_config, server_name, http_mode=False, p
115116
if actual_port != port:
116117
logger.debug(f"Port {port} is busy, using port {actual_port} instead")
117118

118-
# Display server information
119+
# Display server information in a nice panel
119120
http_url = f"http://127.0.0.1:{actual_port}/mcp/"
120-
console.print(f"[bold green]Server '{server_name}' is now running at:[/]")
121-
console.print(f"[cyan]{http_url}[/]")
122-
console.print("[dim]Press Ctrl+C to stop the server[/]")
121+
panel_content = f"[bold]Server:[/] {server_name}\n[bold]URL:[/] [cyan]{http_url}[/cyan]\n\n[dim]Press Ctrl+C to stop the server[/]"
122+
panel = Panel(
123+
panel_content,
124+
title="🌐 Local Server Running",
125+
title_align="left",
126+
border_style="green",
127+
padding=(1, 2)
128+
)
129+
console.print(panel)
123130

124131
logger.debug(f"Starting FastMCP proxy for server '{server_name}' on port {actual_port}")
125132

src/mcpm/commands/share.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import click
1212
from rich.console import Console
13+
from rich.panel import Panel
1314

1415
from mcpm.core.tunnel import Tunnel
1516
from mcpm.fastmcp_integration.proxy import create_mcpm_proxy
@@ -230,17 +231,27 @@ async def _share_async(server_config, server_name, port, remote_host, remote_por
230231
if not share_url:
231232
raise RuntimeError("Could not get share URL from tunnel.")
232233

233-
# Display critical information only
234+
# Display critical information in a nice panel
234235
http_url = f"{share_url}/mcp/"
235-
console.print(f"[bold green]Server '{server_name}' is now shared at:[/]")
236-
console.print(f"[cyan]{http_url}[/]")
237-
236+
237+
# Build panel content based on auth status
238+
panel_content = f"[bold]Server:[/] {server_name}\n[bold]URL:[/] [cyan]{http_url}[/cyan]\n"
239+
238240
if not no_auth and api_key:
239-
console.print(f"[bold green]API Key:[/] [cyan]{api_key}[/]")
241+
panel_content += f"[bold]HEADER Authorization:[/] [cyan]Bearer {api_key}[/cyan]\n"
240242
else:
241-
console.print("[bold red]Warning:[/] Anyone with the URL can access your server.")
242-
243-
console.print("[dim]Press Ctrl+C to stop sharing[/]")
243+
panel_content += "[bold red]⚠️ Warning:[/] Anyone with the URL can access your server\n"
244+
245+
panel_content += "\n[dim]Press Ctrl+C to stop sharing[/]"
246+
247+
panel = Panel(
248+
panel_content,
249+
title="🌍 Server Shared Publicly",
250+
title_align="left",
251+
border_style="blue",
252+
padding=(1, 2)
253+
)
254+
console.print(panel)
244255

245256
# Keep running until interrupted
246257
await server_task

0 commit comments

Comments
 (0)