Add cmd/ entrypoints, fix auth, deploy to K8s
- cmd/indexer/main.go: CLI with full/repo/webhook/search subcommands Clones repos via Gitea API, walks files, indexes to MeiliSearch. Webhook HTTP server on :8080 for real-time push reindexing. - cmd/mcp-server/main.go: MCP stdio server wiring meili + mcp packages - internal/gitea/client.go: Use Authorization header instead of ?token= query param (required by current Gitea API) - k8s/indexer-cronjob.yaml: Remove embedded secret (foot-gun), pin image to v1.0.1, add imagePullPolicy: IfNotPresent - .gitignore: Anchor binary patterns to root so cmd/ dirs aren't ignored Deployed: 1,003 documents from 39 repos indexed in 83s. Global Gitea webhook configured for real-time reindexing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
34
cmd/mcp-server/main.go
Normal file
34
cmd/mcp-server/main.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"gitea.rspworks.tech/rpert/gitea-search/internal/mcp"
|
||||
"gitea.rspworks.tech/rpert/gitea-search/internal/meili"
|
||||
)
|
||||
|
||||
const version = "1.0.0"
|
||||
|
||||
func main() {
|
||||
meiliURL := envOr("MEILI_URL", "http://localhost:7700")
|
||||
meiliKey := os.Getenv("MEILI_KEY")
|
||||
indexName := envOr("INDEX_NAME", "gitea-code")
|
||||
|
||||
client, err := meili.NewClient(meiliURL, meiliKey, indexName)
|
||||
if err != nil {
|
||||
log.Fatalf("connecting to MeiliSearch: %v", err)
|
||||
}
|
||||
|
||||
server := mcp.NewServer(client, version)
|
||||
if err := server.Run(); err != nil {
|
||||
log.Fatalf("server error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func envOr(key, fallback string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
Reference in New Issue
Block a user