remove_server
Delete an MCP server configuration from AWS Q Developer and Claude Desktop to manage server settings and maintain clean configuration files.
Instructions
MCPサーバー設定を削除する。
Args:
name: 削除するサーバーの名前
Returns:
Dict[str, Any]: 成功メッセージと残りのサーバーリスト、またはエラー情報
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- Implementation of the remove_server tool handler. This async function, decorated with @mcp.tool, removes a specified MCP server from the configuration file by loading the config, deleting the server entry if it exists, saving the updated config, and returning appropriate success or error responses.@mcp.tool(name="remove_server") async def remove_server(name: str) -> Dict[str, Any]: """MCPサーバー設定を削除する。 Args: name: 削除するサーバーの名前 Returns: Dict[str, Any]: 成功メッセージと残りのサーバーリスト、またはエラー情報 """ config = load_config() if name not in config.mcpServers: # サーバーが見つからない場合はエラーを返す logger.warning(f"Attempted to remove non-existent server: {name}") return {"error": f"Server '{name}' not found", "available_servers": list(config.mcpServers.keys())} # サーバーを削除して保存 del config.mcpServers[name] try: save_config(config) logger.info(f"Successfully removed server: {name}") return {"message": f"Server '{name}' removed successfully", "remaining_servers": list(config.mcpServers.keys())} except Exception as e: logger.error(f"Failed to save configuration after removing server {name}: {e}") return {"error": f"Failed to save configuration: {str(e)}", "hint": "Check file permissions and disk space"}