| 121 | return "mcp_server" |
| 122 | |
| 123 | def _static_warnings(self, server: dict[str, Any]) -> list[dict[str, str]]: |
| 124 | warnings: list[dict[str, str]] = [] |
| 125 | url = str(server.get("url") or "").strip() |
| 126 | command = str(server.get("command") or "").strip() |
| 127 | |
| 128 | if url: |
| 129 | parsed = urlparse(url) |
| 130 | if parsed.scheme not in {"http", "https"}: |
| 131 | warnings.append( |
| 132 | { |
| 133 | "level": "error", |
| 134 | "title": "Unsupported URL scheme", |
| 135 | "message": "Remote MCP URLs should use http or https.", |
| 136 | } |
| 137 | ) |
| 138 | elif parsed.scheme == "http" and parsed.hostname not in {"localhost", "127.0.0.1", "::1"}: |
| 139 | warnings.append( |
| 140 | { |
| 141 | "level": "warning", |
| 142 | "title": "Unencrypted remote URL", |
| 143 | "message": "Prefer HTTPS for remote MCP servers outside localhost.", |
| 144 | } |
| 145 | ) |
| 146 | if not parsed.netloc: |
| 147 | warnings.append( |
| 148 | { |
| 149 | "level": "error", |
| 150 | "title": "Invalid remote URL", |
| 151 | "message": "The remote MCP URL is missing a host.", |
| 152 | } |
| 153 | ) |
| 154 | elif command: |
| 155 | if which(command) is None: |
| 156 | warnings.append( |
| 157 | { |
| 158 | "level": "warning", |
| 159 | "title": "Command not found", |
| 160 | "message": f"'{command}' is not currently available on PATH.", |
| 161 | } |
| 162 | ) |
| 163 | if command in {"bash", "sh", "zsh", "fish", "python", "python3", "node"}: |
| 164 | warnings.append( |
| 165 | { |
| 166 | "level": "warning", |
| 167 | "title": "General-purpose interpreter", |
| 168 | "message": "Review the command and arguments carefully before running this local MCP server.", |
| 169 | } |
| 170 | ) |
| 171 | else: |
| 172 | warnings.append( |
| 173 | { |
| 174 | "level": "error", |
| 175 | "title": "Missing connection target", |
| 176 | "message": "Provide either a remote URL or a local command.", |
| 177 | } |
| 178 | ) |
| 179 | |
| 180 | if isinstance(server.get("headers"), dict) and server["headers"]: |