ToledoChess [0] has a few implementations of this in different languages. Some highlights:
2KB of JavaScript with castling, en passant, promotion, search and even a GUI
326 bytes of assembly, without the special rules
I don't think the author has a UCI-compliant one, but it should be easier than the GUI. There are forks of the JS one that might do it.