Vehicle-to-Grid and a microgrid are emerging concepts which are expected to replace the conventional energy and transportation systems with more efficient and flexible ones. There have been research on the integration of these technologies, but a microgrid with fuel cell vehicles (FCVs) have hardly been studied at the moment in spite of the several technical advantages of FCVs as generating units. This paper therefore presents the mathematical model of a microgrid which includes FCVs, on-site hydrogen stations, solar photovoltaic systems and a wind turbine. The optimal scheduling of hydrogen production, hydrogen refueling to FCVs and electricity supply from FCVs which minimizes the power imported from the main grid is obtained by solving a mixed integer linear programming problem. The computation results of a test case indicate that the model can be used for identifying a bottleneck in the energy flow of a microgrid. The presented model can be extended by including important factors to consider for further research on the integration of microgrids and FCVs.