So there are a few ways to do this.
all of them that i know of talk to a client than to a server.
This may be the official Client or others but it is three steps.
https://casparcgforum.org/t/gpio-howto/507
This Tread talks about setting up an arduino to build a GPI for the official client.
it works i have used it. it took me a min to get the hang of it, but it was easy to set up, cheep, and just worked.
most recently i have been using Ross Dashboard (its free) it uses OG script and ross talk
and you can use it to send commands directly to the server.
i use it with a Ross Switcher but you could get it to talk to others as well.
and you would need to know some of the AMPC commands (for CasparCG Link) to do what ever yo need to get the server to do.
but once again the switcher talks to a Client client talks to the server.
And Dashboard is great for making customs control panels as well. and if you have a good tablet or touch screen its like geek heaven.
Ross Dashboard