Integrations
MCP Integration
Connect AI assistants to your Redelay application via Model Context Protocol.
MCP Integration
The MCP module turns your Redelay application into an MCP server — any AI assistant that speaks the Model Context Protocol can discover your modules, validate flows, scaffold code, and invoke API operations.
How it works
text
┌──────────────┐ JSON-RPC / HTTP ┌─────────────────────────┐
│ AI Client │ ──────────────────▶ │ Redelay MCP Server │
│ (VS Code, │ │ POST /mcp │
│ Claude, │ ◀────────────────── │ │
│ Cursor) │ tools/resources │ ┌─ Introspection (9) │
└──────────────┘ │ ├─ Dev tools (5) │
│ ├─ Route tools (auto) │
│ └─ Module tools (ext) │
└─────────────────────────┘
- Introspection tools —
list_modules,describe_module,list_flowdsl_nodes,describe_flowdsl_node,list_events,describe_event,list_packets,describe_packet,search_redelay - Developer tools —
validate_flowdsl,validate_module,scaffold_module,list_api_routes,explain_flowdsl_node - Route tools — every HTTP route from
RoutesProvidermodules becomes a callable tool - Module-contributed tools — any module implementing
MCPProvideradds its own tools
Setup
1. Enable the MCP module
go
import _ "github.com/redelay/go-framework/modules/mcp"
The module auto-mounts at POST /mcp.
2. Connect your IDE
VS Code — create .vscode/mcp.json in your project:
json
{
"servers": {
"my-app": {
"type": "http",
"url": "http://localhost:8000/mcp"
}
}
}
Claude Desktop — add to claude_desktop_config.json:
json
{
"mcpServers": {
"my-app": {
"transport": "http",
"url": "http://localhost:8000/mcp"
}
}
}
3. Verify connection
Once connected, your AI assistant can call tools like list_modules to explore the application.
Extending MCP from your module
Implement MCPProvider to contribute tools and resources:
go
func (m *Module) MCPTools() []modules.MCPTool {
return []modules.MCPTool{
{
Name: "search_products",
Description: "Search products by name or category",
InputSchema: map[string]any{
"type": "object",
"required": []string{"query"},
"properties": map[string]any{
"query": map[string]any{
"type": "string",
"description": "Search term",
},
"category": map[string]any{
"type": "string",
"description": "Filter by category",
},
},
},
Handler: func(ctx context.Context, args map[string]any) (any, error) {
query, _ := args["query"].(string)
return m.service.Search(ctx, query)
},
},
}
}
func (m *Module) MCPResources() []modules.MCPResource { return nil }
Guidelines for MCP tools
- Name — use
snake_case, prefix with your module name for uniqueness (e.g.products_search) - Description — write for AI consumption: explain when to use the tool, not just what it does
- InputSchema — use JSON Schema with
descriptionon each property so the AI knows what to pass - Handler — return structured data (maps, slices, structs); the MCP server serializes it as JSON
Exposing resources
Resources are read-only data that AI clients can fetch by URI:
go
func (m *Module) MCPResources() []modules.MCPResource {
return []modules.MCPResource{
{
URI: "products://catalog",
Name: "product-catalog",
MimeType: "application/json",
Description: "Full product catalog with pricing and availability",
Handler: func(ctx context.Context) (any, error) {
return m.service.FullCatalog(ctx)
},
},
}
}
Protocol
The MCP server implements the Streamable HTTP transport (protocol version 2025-03-26):
| Method | Description |
|---|---|
initialize | Handshake — returns protocol version, capabilities, server info |
notifications/initialized | Accepted silently (202) |
ping | Returns {} |
tools/list | Returns {tools: [...]} |
tools/call | Returns {content: [{type: "text", text: "..."}]} |
resources/list | Returns {resources: [...]} |
resources/read | Returns {contents: [{uri, mimeType, text}]} |
Tool reference
Introspection tools
| Tool | Parameters | Description |
|---|---|---|
list_modules | — | Summary of every module with event/route/node counts |
describe_module | name | Full IR for a single module |
list_flowdsl_nodes | kind?, module? | All FlowDSL nodes, optionally filtered |
describe_flowdsl_node | id | Full node spec with settings schema and ports |
list_events | — | All events with entity type, action, topic |
describe_event | name | Full event definition with payload schema |
list_packets | — | All packet/schema definitions |
describe_packet | name | Full packet with fields |
search_redelay | query, limit? | Keyword search across all entities |
Developer tools
| Tool | Parameters | Description |
|---|---|---|
validate_flowdsl | yaml | Parse and validate FlowDSL YAML (codes FDL001–FDL062) |
validate_module | yaml | Validate module YAML (codes MV001–MV072) |
scaffold_module | yaml, package?, framework_module? | Generate Go module code from YAML |
list_api_routes | module? | HTTP routes with request types and security |
explain_flowdsl_node | id | Human-friendly explanation with usage snippet |