Migrate to mcpgen

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-11-20 18:36:59 +01:00
parent d6278da0d6
commit 0b5d4f1cd3
17 changed files with 719 additions and 568 deletions

View File

@@ -0,0 +1,76 @@
// Code generated by mcpgen. DO NOT EDIT.
package server
import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp"
"go.probo.inc/probo/pkg/server/api/mcp/v1/types"
)
// ResolverInterface defines the interface that must be implemented by the parent resolver
type ResolverInterface interface {
ListOrganizationsTool(ctx context.Context, req *mcp.CallToolRequest, input *types.ListOrganizationsInput) (*mcp.CallToolResult, types.ListOrganizationsOutput, error)
ListVendorsTool(ctx context.Context, req *mcp.CallToolRequest, input *types.ListVendorsInput) (*mcp.CallToolResult, types.ListVendorsOutput, error)
AddVendorTool(ctx context.Context, req *mcp.CallToolRequest, input *types.AddVendorInput) (*mcp.CallToolResult, types.AddVendorOutput, error)
UpdateVendorTool(ctx context.Context, req *mcp.CallToolRequest, input *types.UpdateVendorInput) (*mcp.CallToolResult, types.UpdateVendorOutput, error)
}
// New creates a new MCP server instance with all handlers registered.
// Returns a fully configured *mcp.Server ready to be used with any transport.
func New(resolver ResolverInterface) *mcp.Server {
server := mcp.NewServer(
&mcp.Implementation{
Name: "Probo MCP Server",
Version: "1.0.0",
},
nil,
)
registerToolHandlers(server, resolver)
return server
}
func registerToolHandlers(server *mcp.Server, resolver ResolverInterface) {
mcp.AddTool(
server,
&mcp.Tool{
Name: "listOrganizations",
Description: "List all organizations the user has access to",
InputSchema: types.ListOrganizationsToolInputSchema,
OutputSchema: types.ListOrganizationsToolOutputSchema,
},
resolver.ListOrganizationsTool,
)
mcp.AddTool(
server,
&mcp.Tool{
Name: "listVendors",
Description: "List all vendors for the organization",
InputSchema: types.ListVendorsToolInputSchema,
OutputSchema: types.ListVendorsToolOutputSchema,
},
resolver.ListVendorsTool,
)
mcp.AddTool(
server,
&mcp.Tool{
Name: "addVendor",
Description: "Add a new vendor to the organization",
InputSchema: types.AddVendorToolInputSchema,
OutputSchema: types.AddVendorToolOutputSchema,
},
resolver.AddVendorTool,
)
mcp.AddTool(
server,
&mcp.Tool{
Name: "updateVendor",
Description: "Update an existing vendor",
InputSchema: types.UpdateVendorToolInputSchema,
OutputSchema: types.UpdateVendorToolOutputSchema,
},
resolver.UpdateVendorTool,
)
}