Show HN: Gin-MCP- All Gin APIs are now MCP-compatible without rewriting

github.com

4 points by ckanthony 2 days ago

(Just add two lines of code to integrate the library!)

I built gin-mcp to automatically expose existing Gin web APIs as Model Context Protocol (MCP) tools, making them usable by clients like Cursor with minimal effort.

It uses reflection on your *gin.Engine to discover endpoints and infers basic schemas for path and query parameters automatically. The idea is to be zero-configuration by default --- you add it to your existing Gin app, provide a BaseURL, mount the MCP handler (mcp.Mount("/mcp")), and your API becomes available as tools.

For more complex scenarios where inference isn't enough (e.g., specific struct validation, request body definitions), you can explicitly define schemas using mcp.RegisterSchema(method, path, querySchema, bodySchema). You can also filter which endpoints are exposed.

It aims to reduce the boilerplate needed to connect internal APIs to MCP-compatible AI tools, letting you leverage your existing backend services more easily.

Check out the repo for code, examples, and usage details: https://github.com/ckanthony/gin-mcp

Feedback is welcome!