How does a Microbial Fuel Cell work?
A microbial fuel cell (MFC) is an electrochemical cell that converts chemical into electrical energy, and in which one redox half-reaction is catalyzed by enzymes of microorganisms. The fuel cell consists of anode and cathode compartments which are separated by a membrane that is only permeable for specific cations. At the anode, bioorganic fuel is oxidized to $\ce{CO2}$ and $\ce{H3O+}$. The gained electrons flow from the anode through an external electrical circuit to the cathode, where they are consumed together with protons by the reduction of $\ce{O2}$ to $\ce{H2O}$. The $\ce{H3O+}$ ions are transferred from the anode to the cathode compartment through the membrane.

The fuel is a medium rich in nutrients which can be oxidatively degraded by the microbes, like, for example, sugars (in the following formula, $\ce{C12H22O11}$ stands for a variety of disaccharides):

$$\ce{C12H22O11 + 13H2O -&gt; 12CO2 + 48H+ + 48e-}$$

The electrons from this half-reaction are either transferred directly to the anode (mediator-free MFC) or via a mediator (mediator MFC), which integrates into the electron transport chain of the cell and transfers electrons to the anode by passing the cell membrane. The mediator gains and loses electrons in every transport cycle, and switches between its reduced form (laden with electrons from the cell) and oxidized form (has given up electrons at the anode).

The scheme below (image source: MFCGuy2010/Wikimedia Commons) shows a MFC which uses soil as biofuel. Nutrients from the soil, like acetic acid, are oxidized by microbes in the anodic biofilm to $\ce{CO2}$ and $\ce{H3O+}$. Protons are then consumed in the reduction of supplied oxygen at the cathode, and electrons flow through the external circuit from anode to cathode. In this case, the soil acts simultaneously as nutrient medium and proton exchange membrane.