The different consoles have different support for keyboard and mouse.
All the consoles, PS3, PS4, Xbox 360 and Xbox one, support a keyboard for textual input. You can thus use it to type in messages to friends, naming things like characters in games, etc. Most places where you can enter text a keyboard can be used. Some of the consoles even have built-in bluetooth support, but they should all support a keyboard that uses a wireless usb plug. Some games build their own quirky text input on-screen keyboards and sometimes these doesn't support a physical keyboard.
For mouse, it depends. Xbox 360 and Xbox One has no support for mouse at all, in fact Microsoft has not enabled / made available drivers that can communicate with a mouse. That is not to say that a developer cannot access the USB drivers and talk to a mouse directly, and thus just implement basic support themselves, but there is no system support for it. I have no idea how close a developer might come if they tried though.
For PS3 and PS4 the case is apparently different, as is evident from the other answer here, even having 2-3 games that support it. (there are probably more than 2-3, but this is something each game will need to add themselves, the platform doesn't give you built-in always-on support for playing games with a mouse and keyboard).
Microsoft has, with their release of Windows 10, promised to reevaluate mouse and keyboard support on Xbox One, but this would be to control games on a PC, streaming them to a console and thus playing on a big-screen TV. You would then still be playing "on a PC", only using the Xbox One as a networked thin client for the PC. This would not be the same as allowing games on the console to use keyboard and mouse.
As such, in general, almost no games on the consoles allow keyboard and mouse. Microsoft has, to my knowledge, been asked a couple of times by games developers and have denied access to this each time, Sony with Playstation has apparently opened up somewhat.
It is, however, really rare that a console game would allow a keyboard and mouse, as this would no longer be a level playing field between people with and people without that hardware connected.
Microsoft had a brief stint when they experimented with Shadowrun where they enabled cross-platform playing between PC gamers and Xbox 360 gamers.
The PC gamers used a keyboard and mouse, and the Xbox 360 gamers used their controller. They could, however, play against and with each other on common servers.
Some mitigating factors were introduced in an attempt to level the playing field, notably increased hitboxes for console gamers. Thus PC gamers was both expected and required to be more accurate when shooting, compared to their console opponents.
While the game had mixed reviews for the game that it delivered, I consider it telling that Microsoft, or anyone else, has to this date not yet released another competitive AA-game with this kind of support.
The exact same problem with a level playing field would be present if a game on a console allowed people to play with both a keyboard and mouse, as well as a controller, thus "nobody" does it, or at least that is my theory. If you want to know why 343 Studios didn't develop Halo 5 with keyboard and mouse support you probably will have to ask them directly.
So, as the other answer here proves, technologically, Playstation allows both mouse and keyboard, while very few games actually take advantage of it, and the Microsoft platform doesn't support it at all.
In the spirit of the original question, which asked "can i connect keyboard and mouse to the new ps4 or xbox One and play games", I still feel the correct answer is no. You can't. Not because you technically can't, but because "nobody" builds games that support this and Microsoft even goes as far as not allowing it.
In a comment to this answer I also said that there are 3rd party solutions to this. These have varying support for the different consoles, some are specialized towards one console platform or even just one console, some are for every console and platform ("every" in this context means PS3, PS4, Xbox 360 and Xbox One).
These work by allowing you to connect a keyboard and a mouse to a 3rd party device, usually also connecting said device to a real controller, and connecting the whole shebang into the console. Whenever you press a key on the keyboard, or move the mouse, the device will translate this into the appropriate controller button or stick and simulate the player using the real controller.
Some of these "solutions" are clunky, where the "device" is basically a USB device which has to be plugged into a full computer, others are better and probably more expensive.
They all fall prey to the "level playing field" problem, in which a game that has no concept of keyboard and mouse control suddenly has players that can play with a lot higher accuracy than their opponents has entered the game. Example: XIM3: Mouse and Keyboard on Xbox 360. Yes, there are really good players out there there are plenty of Youtube videos where you can hear the person playing bragging about "upping his game with a XIM3".