Bake the former Python bridge.py into emby-mcp as internal/bridge.
/mcp and /call/{tool} share one process. Session init errors are
returned instead of swallowed, and 401/400/404 trigger a fresh
initialize plus retry with the caller's Authorization header.
21 lines
563 B
Go
21 lines
563 B
Go
package emby
|
|
|
|
import "context"
|
|
|
|
// PublicInfo is the subset of GET /System/Info/Public we use.
|
|
type PublicInfo struct {
|
|
ID string `json:"Id"`
|
|
ServerName string `json:"ServerName"`
|
|
Version string `json:"Version"`
|
|
}
|
|
|
|
// GetPublicInfo fetches the server's public info; it works unauthenticated and
|
|
// is used as the connectivity check in HTTP mode.
|
|
func (c *Client) GetPublicInfo(ctx context.Context) (*PublicInfo, error) {
|
|
var pi PublicInfo
|
|
if err := c.Get(ctx, "/System/Info/Public", nil, &pi); err != nil {
|
|
return nil, err
|
|
}
|
|
return &pi, nil
|
|
}
|