how to add rewrite rule to wordpress default post type

The p query var expects a post ID, use name instead. Also note that rules should only be flushed when they change, as it’s a computationally expensive operation. It’s best to do that on theme change or plugin activation, whichever is appropriate for where your code is located. You can also do this by just visiting the Settings > Permalinks page in admin.

add_action('init', 'add_my_rewrite');
function add_my_rewrite() {
    add_rewrite_rule(
        '^(.*)/server/([^/]+)',
        'index.php?name=$matches[1]&server=$matches[2]',
        'top'
    );
}
function add_query_vars_filter($vars){
    $vars[] = "server";
    return $vars;
}
add_filter('query_vars','add_query_vars_filter');