-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from helixml/feature/helix_mcp_proxy
Model Context Protocol (MCP) support
- Loading branch information
Showing
23 changed files
with
784 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package knowledge | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/helixml/helix/api/pkg/client" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
searchCmd.Flags().String("app", "", "App ID to search within") | ||
searchCmd.Flags().String("knowledge", "", "Knowledge ID to search within") | ||
searchCmd.Flags().String("prompt", "", "Search prompt") | ||
|
||
_ = searchCmd.MarkFlagRequired("app") | ||
_ = searchCmd.MarkFlagRequired("prompt") | ||
|
||
rootCmd.AddCommand(searchCmd) | ||
} | ||
|
||
var searchCmd = &cobra.Command{ | ||
Use: "search", | ||
Short: "Search knowledge", | ||
Long: `Search through knowledge using a prompt`, | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
apiClient, err := client.NewClientFromEnv() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
appID, _ := cmd.Flags().GetString("app") | ||
knowledgeID, _ := cmd.Flags().GetString("knowledge") | ||
prompt, _ := cmd.Flags().GetString("prompt") | ||
|
||
results, err := apiClient.SearchKnowledge(cmd.Context(), &client.KnowledgeSearchQuery{ | ||
AppID: appID, | ||
KnowledgeID: knowledgeID, | ||
Prompt: prompt, | ||
}) | ||
if err != nil { | ||
return fmt.Errorf("failed to search knowledge: %w", err) | ||
} | ||
|
||
jsonBytes, err := json.MarshalIndent(results, "", " ") | ||
if err != nil { | ||
return fmt.Errorf("failed to marshal results to JSON: %w", err) | ||
} | ||
|
||
fmt.Println(string(jsonBytes)) | ||
|
||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package mcp | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "mcp", | ||
Short: "Helix model context protocol proxy", | ||
Aliases: []string{"mcp"}, | ||
Long: `TODO`, | ||
Run: func(*cobra.Command, []string) { | ||
// Do Stuff Here | ||
}, | ||
} | ||
|
||
func New() *cobra.Command { | ||
return rootCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package mcp | ||
|
||
// TODO: add a command that configures the mcp server in the claude config file |
Oops, something went wrong.