mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
62 lines
1.6 KiB
Go
62 lines
1.6 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var serveCmd = &cobra.Command{
|
|
Use: "serve",
|
|
Short: "Start the MCP server",
|
|
Long: `Start the Devour MCP server.
|
|
|
|
In local mode (default), the server communicates via stdio, making it
|
|
suitable for use as an OpenCode skill.
|
|
|
|
In remote mode (--remote flag), the server listens on HTTP and exposes
|
|
a REST API for multi-user access.
|
|
|
|
Examples:
|
|
devour serve # Local mode (stdio)
|
|
devour serve --remote # Remote mode on default port
|
|
devour serve --remote --port 3000`,
|
|
RunE: runServe,
|
|
}
|
|
|
|
var (
|
|
serveRemote bool
|
|
servePort int
|
|
serveHost string
|
|
)
|
|
|
|
func init() {
|
|
serveCmd.Flags().BoolVar(&serveRemote, "remote", false, "run as remote HTTP server")
|
|
serveCmd.Flags().IntVarP(&servePort, "port", "p", 8080, "HTTP port (remote mode only)")
|
|
serveCmd.Flags().StringVar(&serveHost, "host", "localhost", "HTTP host (remote mode only)")
|
|
}
|
|
|
|
func runServe(cmd *cobra.Command, args []string) error {
|
|
if serveRemote {
|
|
fmt.Printf("🚀 Starting Devour server in remote mode\n")
|
|
fmt.Printf(" Host: %s\n", serveHost)
|
|
fmt.Printf(" Port: %d\n", servePort)
|
|
fmt.Printf(" URL: http://%s:%d\n", serveHost, servePort)
|
|
|
|
// TODO: Start HTTP MCP server
|
|
return fmt.Errorf("remote mode not yet implemented")
|
|
}
|
|
|
|
fmt.Println("🚀 Starting Devour server in local mode (stdio)")
|
|
fmt.Println(" Communicating via JSON-RPC over stdin/stdout")
|
|
|
|
// TODO: Start stdio MCP server
|
|
// Should handle JSON-RPC messages for:
|
|
// - devour_query
|
|
// - devour_add
|
|
// - devour_status
|
|
// - devour_sync
|
|
|
|
return fmt.Errorf("local mode not yet implemented")
|
|
}
|