Skip to content

Commit 5a08b91

Browse files
niechenclaude
andcommitted
Format code with ruff and fix all linting issues
- Fixed 760 linting issues automatically with ruff check --fix --unsafe-fixes - Formatted 36 files with ruff format for consistent code style - Removed unused variables and improved code quality - Fixed whitespace, trailing spaces, and formatting inconsistencies - All 113 tests still passing after formatting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 4b8cd86 commit 5a08b91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1025
-1232
lines changed

scripts/get_manifest.py

Lines changed: 79 additions & 149 deletions
Large diffs are not rendered by default.

scripts/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
DOCKER_HUB_REPO_URL = "https://hub.docker.com/v2/repositories/"
1313

14+
1415
class McpClient:
1516
session: ClientSession
1617

@@ -162,7 +163,7 @@ def validate_docker_url(docker_url: str) -> bool:
162163

163164

164165
def inspect_docker_repo(installation: dict[str, Any]) -> Optional[str]:
165-
""" inspect the docker url from docker installation args, the args should pattern as {namespace}/{repo_name} where namespace=mcp
166+
"""inspect the docker url from docker installation args, the args should pattern as {namespace}/{repo_name} where namespace=mcp
166167
Example
167168
if args = ["run", "-i", "--rm", "-e", "PERPLEXITY_API_KEY", "mcp/perplexity-ask"]
168169
return "mcp/perplexity-ask"
@@ -176,6 +177,6 @@ def inspect_docker_repo(installation: dict[str, Any]) -> Optional[str]:
176177
if repo_match:
177178
repo_name = repo_match.group(1)
178179
if validate_docker_url(DOCKER_HUB_REPO_URL + repo_name):
179-
return repo_name # namespace/repo without tag
180+
return repo_name # namespace/repo without tag
180181

181182
return None

scripts/validate_manifest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def error_exit(message: str) -> None:
1414
print(f"❌ {message}")
1515
sys.exit(1)
1616

17+
1718
def load_schema(schema_path: Path) -> Dict:
1819
"""Load and parse the schema file"""
1920
if not schema_path.exists():
@@ -27,6 +28,7 @@ def load_schema(schema_path: Path) -> Dict:
2728
except Exception as e:
2829
error_exit(f"Error reading schema file: {e}")
2930

31+
3032
def validate_manifest(manifest_path: Path, schema: Dict) -> Tuple[bool, str]:
3133
"""Validate a single manifest file against the schema"""
3234
try:
@@ -45,6 +47,7 @@ def validate_manifest(manifest_path: Path, schema: Dict) -> Tuple[bool, str]:
4547
except jsonschema.exceptions.SchemaError as e:
4648
return False, f"Schema error: {e}"
4749

50+
4851
def find_server_files(servers_dir: Path) -> List[Path]:
4952
"""Find all server JSON files in the servers directory"""
5053
if not servers_dir.exists() or not servers_dir.is_dir():
@@ -57,6 +60,7 @@ def find_server_files(servers_dir: Path) -> List[Path]:
5760

5861
return server_files
5962

63+
6064
def main() -> int:
6165
"""Validate all MCP server JSON files"""
6266
# Determine the paths relative to this script
@@ -92,5 +96,6 @@ def main() -> int:
9296

9397
return 1 if any_errors else 0
9498

99+
95100
if __name__ == "__main__":
96101
sys.exit(main())

src/mcpm/cli.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def create_deprecated_command(command_name: str, replacement_suggestions=None):
3838
if replacement_suggestions is None:
3939
replacement_suggestions = [
4040
"mcpm install <server> # Install servers globally",
41-
"mcpm profile add <profile> <server> # Tag servers with profiles",
42-
"mcpm run <server> # Run servers directly"
41+
"mcpm profile add <profile> <server> # Tag servers with profiles",
42+
"mcpm run <server> # Run servers directly",
4343
]
44-
44+
4545
@click.command(context_settings=dict(ignore_unknown_options=True, help_option_names=[]))
46-
@click.option('--help', '-h', 'help_requested', is_flag=True, help='Show deprecation message.')
47-
@click.argument('args', nargs=-1, type=click.UNPROCESSED)
46+
@click.option("--help", "-h", "help_requested", is_flag=True, help="Show deprecation message.")
47+
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
4848
def deprecated_command(help_requested, args):
4949
f"""The '{command_name}' command has been removed in MCPM v2.0."""
5050
console.print(f"[bold red]Error:[/] The 'mcpm {command_name}' command has been removed in MCPM v2.0.")
@@ -55,7 +55,7 @@ def deprecated_command(help_requested, args):
5555
console.print(f" [dim]{suggestion}[/]")
5656
console.print()
5757
raise click.ClickException("Command has been removed in v2.0")
58-
58+
5959
# Set the name properly on the command
6060
deprecated_command.name = command_name
6161
return deprecated_command
@@ -127,17 +127,19 @@ def main(ctx, help_flag, version):
127127
# If no command was invoked or help is requested, show our custom help
128128
if ctx.invoked_subcommand is None or help_flag:
129129
print_logo()
130-
130+
131131
# Display usage info for new simplified model
132132
console.print("[bold green]Usage:[/] [white]mcpm [OPTIONS] COMMAND [ARGS]...[/]")
133133
console.print("")
134-
console.print("[bold green]Description:[/] [white]Manage MCP servers in a global configuration with profile organization.[/]")
134+
console.print(
135+
"[bold green]Description:[/] [white]Manage MCP servers in a global configuration with profile organization.[/]"
136+
)
135137
console.print("")
136-
138+
137139
# Show quick start examples
138140
console.print("[bold cyan]Quick Start:[/]")
139141
console.print(" [dim]mcpm search browser # Find available servers[/]")
140-
console.print(" [dim]mcpm install mcp-server-browse # Install a server[/]")
142+
console.print(" [dim]mcpm install mcp-server-browse # Install a server[/]")
141143
console.print(" [dim]mcpm run mcp-server-browse # Run server directly[/]")
142144
console.print(" [dim]mcpm profile create web-dev # Create a profile[/]")
143145
console.print(" [dim]mcpm profile add web-dev mcp-server-browse # Tag server[/]")
@@ -211,19 +213,31 @@ def main(ctx, help_flag, version):
211213
# Deprecated v1 commands - show migration guidance
212214
main.add_command(create_deprecated_command("stash"), name="stash")
213215
main.add_command(create_deprecated_command("pop"), name="pop")
214-
main.add_command(create_deprecated_command("mv", [
215-
"mcpm profile add <profile> <server> # Tag servers with profiles",
216-
"mcpm profile remove <profile> <server> # Remove tags from servers"
217-
]), name="mv")
218-
main.add_command(create_deprecated_command("cp", [
219-
"mcpm profile add <profile> <server> # Tag servers with profiles",
220-
"mcpm profile remove <profile> <server> # Remove tags from servers"
221-
]), name="cp")
216+
main.add_command(
217+
create_deprecated_command(
218+
"mv",
219+
[
220+
"mcpm profile add <profile> <server> # Tag servers with profiles",
221+
"mcpm profile remove <profile> <server> # Remove tags from servers",
222+
],
223+
),
224+
name="mv",
225+
)
226+
main.add_command(
227+
create_deprecated_command(
228+
"cp",
229+
[
230+
"mcpm profile add <profile> <server> # Tag servers with profiles",
231+
"mcpm profile remove <profile> <server> # Remove tags from servers",
232+
],
233+
),
234+
name="cp",
235+
)
222236
main.add_command(create_deprecated_command("target"), name="target")
223237

224238
# Keep these for now but they could be simplified later
225239
main.add_command(client.client)
226-
main.add_command(inspector.inspector, name="inspector")
240+
main.add_command(inspector.inspector, name="inspector")
227241

228242
if __name__ == "__main__":
229243
main()

src/mcpm/clients/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from mcpm.clients.base import BaseClientManager
88
from mcpm.clients.client_config import ClientConfigManager
99
from mcpm.clients.client_registry import ClientRegistry
10-
from mcpm.clients.managers.claude_desktop import ClaudeDesktopManager
1110
from mcpm.clients.managers.claude_code import ClaudeCodeManager
11+
from mcpm.clients.managers.claude_desktop import ClaudeDesktopManager
1212
from mcpm.clients.managers.cursor import CursorManager
1313
from mcpm.clients.managers.trae import TraeManager
1414
from mcpm.clients.managers.windsurf import WindsurfManager

src/mcpm/clients/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def is_client_installed(self) -> bool:
133133
"""
134134
pass
135135

136-
137136
def get_associated_profiles(self) -> List[str]:
138137
"""
139138
Get the associated profile for this client
@@ -378,7 +377,6 @@ def is_client_installed(self) -> bool:
378377
return os.path.isdir(os.path.dirname(self.config_path))
379378

380379

381-
382380
class YAMLClientManager(BaseClientManager):
383381
"""
384382
YAML-based implementation of the client manager interface.
@@ -617,4 +615,3 @@ def is_client_installed(self) -> bool:
617615
"""
618616
# Check if the config directory exists
619617
return os.path.isdir(os.path.dirname(self.config_path))
620-

src/mcpm/clients/managers/claude_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ def get_client_info(self) -> Dict[str, str]:
5555
"name": self.display_name,
5656
"download_url": self.download_url,
5757
"config_file": self.config_path,
58-
"description": "Anthropic's Claude Code CLI tool"
58+
"description": "Anthropic's Claude Code CLI tool",
5959
}

src/mcpm/clients/managers/claude_desktop.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def is_server_disabled(self, server_name: str) -> bool:
112112
config = self._load_config()
113113
return "disabledServers" in config and server_name in config["disabledServers"]
114114

115-
116115
def to_client_format(self, server_config: ServerConfig) -> Dict[str, Any]:
117116
if isinstance(server_config, RemoteServerConfig):
118117
# use mcp proxy to convert to stdio as sse is not supported for claude desktop yet

src/mcpm/clients/managers/cline.py

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

77
logger = logging.getLogger(__name__)
88

9+
910
class ClineManager(JSONClientManager):
1011
"""Manages Cline MCP server configurations"""
1112

@@ -27,12 +28,24 @@ def __init__(self, config_path=None):
2728
else:
2829
# Set config path based on detected platform
2930
if self._system == "Darwin": # macOS
30-
self.config_path = os.path.expanduser("~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json")
31+
self.config_path = os.path.expanduser(
32+
"~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json"
33+
)
3134
elif self._system == "Windows":
32-
self.config_path = os.path.join(os.environ.get("APPDATA", ""), "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json")
35+
self.config_path = os.path.join(
36+
os.environ.get("APPDATA", ""),
37+
"Code",
38+
"User",
39+
"globalStorage",
40+
"saoudrizwan.claude-dev",
41+
"settings",
42+
"cline_mcp_settings.json",
43+
)
3344
else:
3445
# Linux
35-
self.config_path = os.path.expanduser("~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json")
46+
self.config_path = os.path.expanduser(
47+
"~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json"
48+
)
3649

3750
def _get_empty_config(self) -> Dict[str, Any]:
3851
"""Get empty config structure for Cline"""
@@ -105,7 +118,6 @@ def is_server_disabled(self, server_name: str) -> bool:
105118

106119

107120
class RooCodeManager(ClineManager):
108-
109121
# Client information
110122
client_key = "roo-code"
111123
display_name = "Roo Code"
@@ -124,9 +136,21 @@ def __init__(self, config_path=None):
124136
else:
125137
# Set config path based on detected platform
126138
if self._system == "Darwin": # macOS
127-
self.config_path = os.path.expanduser("~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json")
139+
self.config_path = os.path.expanduser(
140+
"~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json"
141+
)
128142
elif self._system == "Windows":
129-
self.config_path = os.path.join(os.environ.get("APPDATA", ""), "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "mcp_settings.json")
143+
self.config_path = os.path.join(
144+
os.environ.get("APPDATA", ""),
145+
"Code",
146+
"User",
147+
"globalStorage",
148+
"rooveterinaryinc.roo-cline",
149+
"settings",
150+
"mcp_settings.json",
151+
)
130152
else:
131153
# Linux
132-
self.config_path = os.path.expanduser("~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json")
154+
self.config_path = os.path.expanduser(
155+
"~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json"
156+
)

src/mcpm/clients/managers/continue_extension.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,3 @@ def from_client_format(self, server_name: str, client_config: Dict[str, Any]) ->
201201
}
202202
server_data.update(client_config)
203203
return TypeAdapter(ServerConfig).validate_python(server_data)
204-

0 commit comments

Comments
 (0)