In this paper, an inverse optimal control problem of multi-agent systems is investigated based on partial stability and structured Lyapunov matrix. Agents with general linear dynamics are considered. The communication graph of the agents is assumed to be undirected and fixed. A cooperative optimal control protocol is designed to guarantee consensus based on static output feedback. It is demonstrated that, given the stabilizing static output feedback control input, a performance index function can be found such that the control input is optimal. A structured quadratic performance index is derived that is related to the topology of the communication graph. It allows for global optimal control that is implemented using the proposed distributed consensus protocol. INDEX TERMS Multi-agent system, inverse optimality, static output feedback, structured Lyapunov matrix, undirected graph.