MCPcopy
hub / github.com/github/github-mcp-server / main

Function main

script/print-mcp-diff-configs/main.go:71–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69const httpServerURL = "http://localhost:8082/mcp"
70
71func main() {
72 transport := flag.String("transport", "stdio", "Transport to target: stdio or http-headers")
73 flag.Parse()
74
75 entries := baseEntries()
76
77 var out []config
78 switch *transport {
79 case "stdio":
80 for _, e := range entries {
81 out = append(out, config{Name: e.name, Args: e.settings.toArgs()})
82 }
83 case "http-headers":
84 for _, e := range entries {
85 h := e.settings.toHeaders()
86 if h == nil {
87 h = map[string]string{}
88 }
89 // The action's top-level headers may be replaced (not merged) by
90 // per-config headers, so always include the bearer token here.
91 // The token must match a recognized GitHub prefix so the server's
92 // Authorization parser accepts it without contacting the API.
93 h[mcphdr.AuthorizationHeader] = "Bearer ghp_test"
94 out = append(out, config{
95 Name: e.name,
96 Transport: "streamable-http",
97 ServerURL: httpServerURL,
98 Headers: h,
99 })
100 }
101 default:
102 fmt.Fprintf(os.Stderr, "unknown transport %q (want stdio or http-headers)\n", *transport)
103 os.Exit(2)
104 }
105
106 enc := json.NewEncoder(os.Stdout)
107 enc.SetIndent("", " ")
108 if err := enc.Encode(out); err != nil {
109 fmt.Fprintln(os.Stderr, err)
110 os.Exit(1)
111 }
112}
113
114func baseEntries() []baseEntry {
115 entries := []baseEntry{

Callers

nothing calls this directly

Calls 4

baseEntriesFunction · 0.85
toArgsMethod · 0.80
toHeadersMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected