mcp-c
by ZenWayne
mcp-c is a server framework written in C that allows for efficient and effortless development. It utilizes annotations to automatically generate code, allowing developers to focus on the core server functions.
Last updated: N/A
What is mcp-c?
mcp-c is a C-based server framework designed to streamline server development by automating code generation through annotations. It simplifies the process of creating MCP (Minecraft Protocol) servers or other network applications.
How to use mcp-c?
To use mcp-c, you need to write your MCP tools under the src/mcp_server
directory, adding EXPORT
and EXPORT_AS(name)
attributes to the functions and structs you want to expose. Then, build the project using CMake (cmake -B build -S . && cmake --build .
). The build process generates code automatically, and you can run the server using ./mcpc
.
Key features of mcp-c
Automatic code generation via annotations
Struct export with JSON serialization
Function signature export
Support for defining input schemas
Easy integration with CJSON
Use cases of mcp-c
Developing Minecraft Protocol servers
Creating network applications
Building command-line tools
Generating API endpoints
Rapid prototyping of server functionalities
FAQ from mcp-c
What are the prerequisites for building mcp-c?
What are the prerequisites for building mcp-c?
You need vcpkg (only for Windows), CMake, Clang, and cJSON.
How do I export a struct?
How do I export a struct?
Add the EXPORT
or EXPORT_AS(name)
macro to the struct definition. The build process will generate the necessary serialization code.
How do I export a function signature?
How do I export a function signature?
Add the EXPORT_AS(name)
macro to the function definition. This will generate the function signature JSON.
What does the EXPORT_AS(tools, list)
macro do?
What does the EXPORT_AS(tools, list)
macro do?
This macro exports a function as a handler for the tools/list
tool, which returns a JSON representation of all available function signatures.
Where can I find the generated code?
Where can I find the generated code?
The generated code is located under the src
folder, specifically in generated_bridge_code.c
and generated_function_signatures.c
.