echo-mcp
About
Automatically convert any Echo API to a MCP Tool
Details
- Author
- brunokrugel
- Categories
- Cloud Service, Infrastructure
Jump to
Setup
Install echo-mcp in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/brunokrugel/echo-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Wrap any existing Echo API into MCP tools and enable AI agents to interact with your API throughModel Context Protocol.
Inspired bygin-mcpbut for theEcho framework.
- Zero Configuration: Works with any existing Echo API
- Multiple Schema Sources: Support for Swaggo, raw OpenAPI YAML/JSON, and manual schemas
- Filtering: Include/exclude endpoints with wildcard patterns
- MCP Compatible: Works with any agent that supports MCP.
package main import ( "net/http" server "github.com/BrunoKrugel/echo-mcp" "github.com/labstack/echo/v4" ) func main() { e := echo.New() // Existing API routes e.GET("/ping", func(c echo.Context) error { return c.JSON(http.StatusOK, map[string]string{"message": "pong"}) }) // Add MCP support mcp := server.New(e) mcp.Mount("/mcp") e.Start(":8080") }
Now the API is accessible athttp://localhost:8080/mcp
If you already use Swaggo for Swagger documentation, enable automatic schema generation:
// @Summary Get user by ID // @Description Retrieve detailed user information // @Tags users // @Param id path int true "User ID" minimum(1) // @Success 200 {object} User // @Router /users/{id} [get] func GetUser(c echo.Context) error { // Your handler code } func main() { e := echo.New() e.GET("/users/:id", GetUser) // Enable automatic swagger schema generation mcp := server.NewWithConfig(e, &server.Config{ BaseURL: "http://localhost:8080", EnableSwaggerSchemas: true, }) mcp.Mount("/mcp") e.Start(":8080") }
If you use other OpenAPI libraries likeswaggest/openapi-go, you can pass a raw YAML or JSON schema string:
import ( "github.com/swaggest/openapi-go/openapi3" server "github.com/BrunoKrugel/echo-mcp" ) func main() { e := echo.New() // ... define your routes ... // Generate OpenAPI schema reflector := openapi3.Reflector{} reflector.SpecEns().WithOpenapi("3.0.3") reflector.SpecEns().Info.WithTitle("My API").WithVersion("1.0.0") // Add operations to reflector // ... // Export to YAML (or JSON) schema, _ := reflector.Spec.MarshalYAML() // Pass raw schema to MCP server // ... you can also embed the schema from an exiting openapi.yaml file mcp := server.NewWithConfig(e, &server.Config{ OpenAPISchema: string(schema), }) mcp.Mount("/mcp") e.Start(":8080") }
TheOpenAPISchemafield accepts both YAML and JSON formatted strings. When provided, it automatically populates:
- Server name from schema title
- Description from schema description
- Version from schema version
- Tool schemas from operation definitions
Expose only the necessary endpoints to MCP tools:
mcp := server.New(e) // Include only specific endpoints mcp.RegisterEndpoints([]string{ "/api/v1/users/:id", "/api/v1/orders", }) // Or exclude internal endpoints mcp.ExcludeEndpoints([]string{ "/health", // Exclude health checks })
For better control, register schemas manually:
type CreateUserRequest struct { Name string json:"name" jsonschema:"required,description=User full name" Email string json:"email" jsonschema:"required,description=User email address" Age int json:"age,omitempty" jsonschema:"minimum=0,maximum=150" } type UserQuery struct { Page int form:"page,default=1" jsonschema:"minimum=1" Limit int form:"limit,default=10" jsonschema:"maximum=100" Active bool form:"active" jsonschema:"description=Filter by active status" } mcp := server.New(e, &server.Config{BaseURL: "http://localhost:8080"}) // Register schemas for specific routes mcp.RegisterSchema("POST", "/users", nil, CreateUserRequest{}) mcp.RegisterSchema("GET", "/users", UserQuery{}, nil)
Echo-MCP supports four schema generation approaches, with automatic fallback:
// Option 1: Using raw OpenAPI schema (swaggest/openapi-go, etc.) schema, _ := reflector.Spec.MarshalYAML() mcp := server.New(e, &server.Config{ OpenAPISchema: string(schema), // Use raw schema }) // Option 2: Using Swaggo mcp := server.New(e, &server.Config{ EnableSwaggerSchemas: true, // Load from swaggo docs }) // Option 3: Manual schemas for fine-grained control mcp.RegisterSchema("POST", "/users", nil, CreateUserRequest{}) // Option 4: Automatic inference (fallback) // No configuration needed - routes will use basic path/body inference
{ "mcpServers": { "echo-api": { "type": "http", "url": "http://localhost:8080/mcp", "timeout": 120 }, } }
npx @modelcontextprotocol/inspector http://localhost:8080/mcp
- Swaggo- Swagger documentation generator
- swaggest/openapi-go- OpenAPI 3.0 toolkit for Go
- Echo Framework- High performance Go web framework
- Echo Swagger- Swagger UI middleware for Echo
- Model Context Protocol- Universal protocol for AI-tool interaction
Navigate your Aiven projects and interact with the PostgreSQL®, Apache Kafka®, ClickHouse® and OpenSearch® services
Yunxiao MCP Server provides AI assistants with the ability to interact with the Yunxiao platform.
Get prescriptive CDK advice, explain CDK Nag rules, check suppressions, generate Bedrock Agent schemas, and discover AWS Solutions Constructs patterns.
This AWS Labs Model Context Protocol (MCP) server for CloudTrail enables your AI agents to query AWS account activity for security investigations, compliance auditing, and operational troubleshooting.
Core AWS MCP server providing prompt understanding and server management capabilities.
Analyze CDK projects to identify AWS services used and get pricing information from AWS pricing webpages and API.
Query and analyze your Axiom logs, traces, and all other event data in natural language
Manage and interact with Microsoft Azure services.
Bastion: External Attack Surface Monitoring
Ask your AI assistant about your attack surface: run scans, catch expiring certificates and domains, triage findings, and generate reports.
Agent-ready global image CDN that AI agents can install and operate through MCP.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.

