Skip to main content
Glama

MCPJungle mcp gateway

by mcpjungle
Mozilla Public License 2.0
638
  • Apple
admin.go•1.51 kB
package client import ( "bytes" "encoding/json" "fmt" "net/http" "net/url" "github.com/mcpjungle/mcpjungle/internal/model" ) type InitServerResponse struct { AdminAccessToken string `json:"admin_access_token"` } // InitServer sends a request to initialize the server in enterprise mode func (c *Client) InitServer() (*InitServerResponse, error) { u, _ := url.JoinPath(c.baseURL, "/init") // TODO: Replace ModeProd with ModeEnterprise in future. // For backward compatibility, the client sends ModeProd to indicate enterprise mode. // This is because mcpjungle server versions < 0.2.12 do not recognize ModeEnterprise. // We want to avoid breaking the client's compatibility with older server versions. // Servers >= 0.2.12 will treat ModeProd as enterprise mode. // In future, once we drop support for older server versions, we can switch to ModeEnterprise. payload := struct { Mode string `json:"mode"` }{ Mode: string(model.ModeProd), } body, err := json.Marshal(payload) if err != nil { return nil, err } resp, err := c.httpClient.Post(u, "application/json", bytes.NewBuffer(body)) if err != nil { return nil, fmt.Errorf("failed to send request to %s: %w", u, err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return nil, c.parseErrorResponse(resp) } var initResp InitServerResponse if err := json.NewDecoder(resp.Body).Decode(&initResp); err != nil { return nil, fmt.Errorf("failed to decode response: %w", err) } return &initResp, nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpjungle/MCPJungle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server