Skip to content

Commit 345f08a

Browse files
niechenclaude
andcommitted
Clean up deprecated configuration fields and imports
Remove unused configuration fields and deprecated modules: - Remove deprecated REQUIRED_FIELDS and OPTIONAL_FIELDS ClassVar from FullServerConfig - Delete deprecated server_config.py module - Remove deprecated --target options from add.py and list.py commands - Fix import order and remove unused variables to pass ruff checks - Update test expectations for new help output format - Restore rich-click command grouping configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 38d54d5 commit 345f08a

File tree

7 files changed

+52
-63
lines changed

7 files changed

+52
-63
lines changed

src/mcpm/cli.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from mcpm.commands.share import share
2828
from mcpm.migration import V1ConfigDetector, V1ToV2Migrator
2929
from mcpm.utils.logging_config import setup_logging
30-
from mcpm.utils.rich_click_config import click, get_header_text, get_footer_text
30+
from mcpm.utils.rich_click_config import click, get_footer_text, get_header_text
3131

3232
console = Console()
3333
client_config_manager = ClientConfigManager()
@@ -60,25 +60,22 @@ def print_logo():
6060

6161
# Purple-to-pink gradient palette
6262
primary_colors = ["#8F87F1", "#C68EFD", "#E9A5F1", "#FED2E2"]
63-
accent_colors = ["#3B82F6", "#EF4444"] # Blue to red
64-
warm_colors = ["#10B981", "#F59E0B"] # Green to orange
65-
tagline_colors = ["#06B6D4", "#EF4444"] # Cyan to red
6663

6764
# Create gradient using rich-gradient with narrow console for better gradient distribution
6865
temp_console = Console(width=50) # Close to ASCII art width
6966
logo_gradient_obj = Gradient(logo_text, colors=primary_colors)
70-
67+
7168
# Capture the rendered gradient
7269
with temp_console.capture() as capture:
7370
temp_console.print(logo_gradient_obj, justify="center")
7471
logo_gradient = Text.from_ansi(capture.get())
7572

76-
# Create solid color text for title and tagline - harmonized with gradient
73+
# Create solid color text for title and tagline - harmonized with gradient
7774
title_text = Text()
7875
title_text.append("Model Context Protocol Manager", style="#8F87F1 bold")
7976
title_text.append(" v", style="#C68EFD")
8077
title_text.append(__version__, style="#E9A5F1 bold")
81-
78+
8279
tagline_text = Text()
8380
tagline_text.append("Open Source with ", style="#FED2E2")
8481
tagline_text.append("♥", style="#E9A5F1")
@@ -131,7 +128,7 @@ def wrapper(*args, **kwargs):
131128
help="""
132129
Centralized MCP server management - discover, install, run, and share servers.
133130
134-
Manage servers globally, organize with profiles, monitor usage, and integrate
131+
Manage servers globally, organize with profiles, monitor usage, and integrate
135132
with all MCP clients.
136133
""",
137134
)
@@ -144,7 +141,7 @@ def main(ctx, version, help_flag):
144141
if version:
145142
print_logo()
146143
return
147-
144+
148145
if help_flag:
149146
# Show custom help with header and footer for main command only
150147
console.print(get_header_text())

src/mcpm/commands/list.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515

1616
@click.command()
17-
@click.option("--target", "-t", help="[DEPRECATED] Ignored in v2.0", hidden=True)
1817
@click.option("--verbose", "-v", is_flag=True, help="Show detailed server configuration")
1918
@click.help_option("-h", "--help")
20-
def list(target: str | None = None, verbose: bool = False):
19+
def list(verbose: bool = False):
2120
"""List all installed MCP servers from global configuration.
2221
2322
Examples:

src/mcpm/commands/target_operations/add.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ def prompt_with_default(prompt_text, default="", hide_input=False, required=Fals
9090
@click.argument("server_name")
9191
@click.option("--force", is_flag=True, help="Force reinstall if server is already installed")
9292
@click.option("--alias", help="Alias for the server", required=False)
93-
@click.option("--target", "-t", help="[DEPRECATED] Ignored in v2.0", required=False, hidden=True)
9493
@click.help_option("-h", "--help")
95-
def add(server_name, force=False, alias=None, target: str | None = None):
94+
def add(server_name, force=False, alias=None):
9695
"""Install an MCP server to the global configuration.
9796
9897
Installs servers to the global MCPM configuration where they can be
@@ -106,7 +105,7 @@ def add(server_name, force=False, alias=None, target: str | None = None):
106105
mcpm add youtube --alias yt
107106
"""
108107

109-
# v2.0: ignore target parameter - use global config
108+
# v2.0: use global config
110109

111110
# Check if this is a profile (starts with %)
112111
if server_name.startswith("%"):

src/mcpm/schemas/full_server_config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Server configuration utilities for MCPM"""
22

3-
from typing import ClassVar, Dict, List, Optional
3+
from typing import Dict, List, Optional
44

55
from pydantic import BaseModel, Field, model_validator
66

@@ -26,10 +26,6 @@ class FullServerConfig(BaseModel):
2626
description: str = ""
2727
installation: Optional[str] = None
2828

29-
# Lists of field names for compatibility with existing code
30-
REQUIRED_FIELDS: ClassVar[List[str]] = ["name", "command", "args", "env_vars"]
31-
OPTIONAL_FIELDS: ClassVar[List[str]] = ["display_name", "description", "installation"]
32-
3329
model_config = {
3430
"populate_by_name": True,
3531
"extra": "ignore",

src/mcpm/schemas/server_config.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/mcpm/utils/rich_click_config.py

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"""
44

55
import rich_click as click
6+
from rich.console import Console
67
from rich.text import Text
78
from rich_gradient import Gradient
8-
from rich.align import Align
9-
from rich.panel import Panel
10-
from rich import box
9+
10+
from mcpm import __version__
1111

1212
# Configure rich-click globally for beautiful CLI formatting
1313
click.rich_click.USE_RICH_MARKUP = True
@@ -17,7 +17,6 @@
1717
click.rich_click.APPEND_METAVARS_HELP = True
1818

1919
# Get version dynamically
20-
from mcpm import __version__
2120

2221
# ASCII art logo - simplified with light shades
2322
ASCII_ART = """
@@ -37,7 +36,6 @@
3736
gradient_colors = ["#8F87F1", "#C68EFD", "#E9A5F1", "#FED2E2"]
3837

3938
# Create a console with narrower width to force gradient calculation over ASCII width
40-
from rich.console import Console
4139
temp_console = Console(width=50) # Close to ASCII art width
4240

4341
# Create gradient and render it with the narrow console
@@ -65,58 +63,40 @@
6563
footer_text = Text()
6664
footer_text.append("")
6765

66+
6867
# Export header and footer for use in main command
6968
def get_header_text():
7069
return header_text
7170

71+
7272
def get_footer_text():
7373
return footer_text
7474

75+
7576
# Add subtle footer to all commands using Text object to avoid literal markup
7677
global_footer_text = Text()
7778
global_footer_text.append("💬 Report bugs or request features: ", style="#8B7DB8")
7879
global_footer_text.append("https://github.com/pathintegral-institute/mcpm.sh/issues", style="#8B7DB8")
7980

8081
click.rich_click.FOOTER_TEXT = global_footer_text
8182

82-
# Enable custom formatting
83+
# Enable custom formatting
8384
click.rich_click.GROUP_ARGUMENTS_OPTIONS = True
8485
click.rich_click.SHOW_METAVARS_COLUMN = False
8586
click.rich_click.APPEND_METAVARS_HELP = True
86-
87-
# Error styling
88-
click.rich_click.STYLE_ERRORS_SUGGESTION = "magenta italic"
89-
click.rich_click.ERRORS_SUGGESTION = "💡 Try running the '--help' flag for more information."
90-
click.rich_click.ERRORS_EPILOGUE = ""
91-
92-
# Color scheme
93-
click.rich_click.STYLE_OPTION = "bold cyan"
94-
click.rich_click.STYLE_ARGUMENT = "bold cyan"
95-
click.rich_click.STYLE_COMMAND = "bold cyan"
96-
click.rich_click.STYLE_SWITCH = "bold green"
97-
click.rich_click.STYLE_METAVAR = "bold yellow"
98-
click.rich_click.STYLE_METAVAR_BRACKET = "dim"
99-
click.rich_click.STYLE_HELPTEXT = ""
100-
click.rich_click.STYLE_HELPTEXT_FIRST_LINE = "bold"
101-
click.rich_click.STYLE_OPTION_HELP = ""
102-
click.rich_click.STYLE_USAGE = "bold"
103-
click.rich_click.STYLE_USAGE_COMMAND = "bold cyan"
104-
105-
# Layout
106-
click.rich_click.ALIGN_ERRORS_LEFT = True
107-
click.rich_click.WIDTH = None # Use terminal width
108-
click.rich_click.MAX_WIDTH = 100 # Maximum width for better readability
87+
click.rich_click.SHOW_ARGUMENTS = True
88+
click.rich_click.SHOW_HELP_FOR_ORPHAN_COMMAND = False
89+
click.rich_click.GROUP_COMMANDS_BEFORE_USAGE = True
10990

11091
# Command groups for organized help
111-
# Rich-click uses the context name, which can vary
11292
click.rich_click.COMMAND_GROUPS = {
11393
"main": [ # This matches the function name
11494
{
11595
"name": "Server Management",
11696
"commands": ["search", "info", "install", "uninstall", "ls", "edit", "inspect"],
11797
},
11898
{
119-
"name": "Server Execution",
99+
"name": "Server Execution",
120100
"commands": ["run", "share", "inspect", "usage"],
121101
},
122102
{
@@ -138,7 +118,7 @@ def get_footer_text():
138118
"commands": ["search", "info", "install", "uninstall", "ls", "edit", "inspect"],
139119
},
140120
{
141-
"name": "Server Execution",
121+
"name": "Server Execution",
142122
"commands": ["run", "share", "inspect", "usage"],
143123
},
144124
{
@@ -153,10 +133,35 @@ def get_footer_text():
153133
"name": "System & Configuration",
154134
"commands": ["doctor", "config", "migrate"],
155135
},
156-
]
136+
],
157137
}
158138

159-
# Option groupings for subcommands
139+
# Error styling
140+
click.rich_click.STYLE_ERRORS_SUGGESTION = "magenta italic"
141+
click.rich_click.ERRORS_SUGGESTION = "💡 Try running the '--help' flag for more information."
142+
click.rich_click.ERRORS_EPILOGUE = ""
143+
144+
# Color scheme
145+
click.rich_click.STYLE_OPTION = "bold cyan"
146+
click.rich_click.STYLE_ARGUMENT = "bold cyan"
147+
click.rich_click.STYLE_COMMAND = "bold cyan"
148+
click.rich_click.STYLE_SWITCH = "bold green"
149+
click.rich_click.STYLE_METAVAR = "bold yellow"
150+
click.rich_click.STYLE_METAVAR_BRACKET = "dim"
151+
click.rich_click.STYLE_HELPTEXT = ""
152+
click.rich_click.STYLE_HELPTEXT_FIRST_LINE = "bold"
153+
click.rich_click.STYLE_OPTION_HELP = ""
154+
click.rich_click.STYLE_USAGE = "bold"
155+
click.rich_click.STYLE_USAGE_COMMAND = "bold cyan"
156+
157+
# Layout
158+
click.rich_click.ALIGN_ERRORS_LEFT = True
159+
click.rich_click.WIDTH = None # Use terminal width
160+
click.rich_click.MAX_WIDTH = 100 # Maximum width for better readability
161+
162+
# Command groups for organized help
163+
164+
# Option groupings for subcommands
160165
click.rich_click.OPTION_GROUPS = {
161166
"mcpm run": [
162167
{

tests/test_global_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_v2_help_shows_global_model():
5050
assert result.exit_code == 0
5151
assert "global configuration" in result.output.lower()
5252
assert "profile" in result.output.lower()
53-
assert "mcpm install" in result.output
54-
assert "mcpm run" in result.output
53+
assert "install" in result.output
54+
assert "run" in result.output
5555

5656

5757
def test_deprecated_commands_removed():
@@ -60,7 +60,7 @@ def test_deprecated_commands_removed():
6060

6161
# Test that deprecated commands no longer exist
6262
deprecated_commands = ["stash", "pop", "mv", "cp", "target", "add", "rm"]
63-
63+
6464
for cmd in deprecated_commands:
6565
result = runner.invoke(main, [cmd, "--help"])
6666
assert result.exit_code == 2 # Click's "No such command" exit code

0 commit comments

Comments
 (0)