MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / NewAPI

Function NewAPI

internal/agent/api.go:520–543  ·  view source on GitHub ↗
(store *identity.Store, sender *outbound.Sender, smtpRelay *outbound.SMTPRelay, userAuth *auth.UserAuth, usage usage.UsageTracker, smtpDomain, fromDomain, sharedDomain, publicURL string, production bool)

Source from the content-addressed store, hash-verified

518}
519
520func NewAPI(store *identity.Store, sender *outbound.Sender, smtpRelay *outbound.SMTPRelay, userAuth *auth.UserAuth, usage usage.UsageTracker, smtpDomain, fromDomain, sharedDomain, publicURL string, production bool) *API {
521 return &API{
522 store: store,
523 sender: sender,
524 screen: piguard.NewEngine(piguard.EngineConfig{}, piguard.NewHeuristicsDetector()),
525 smtpRelay: smtpRelay,
526 userAuth: userAuth,
527 usage: usage,
528 smtpDomain: smtpDomain,
529 fromDomain: fromDomain,
530 sharedDomain: sharedDomain,
531 publicURL: publicURL,
532 // Default the API/issuer URL to the web URL; SetAPIURL overrides it
533 // for split web/API-host deployments.
534 apiURL: publicURL,
535 production: production,
536 sendLimit: ratelimit.New(1*time.Minute, 60), // 60 sends per agent per minute
537 regLimit: ratelimit.New(1*time.Hour, 200), // 200 registrations per IP per hour
538 pollLimit: ratelimit.New(1*time.Minute, 60), // 60 poll requests per user per minute
539 feedbackLimit: ratelimit.New(1*time.Hour, 10), // 10 feedback submissions per IP per hour
540 dcrLimit: ratelimit.New(1*time.Hour, 10), // 10 OAuth client registrations per IP per hour
541 downloadLimit: ratelimit.New(1*time.Minute, 120), // 120 attachment downloads per IP per minute
542 }
543}
544
545// SetAPIURL overrides the API/issuer base URL (default: publicURL). Set it
546// when the programmatic API + MCP are served on a different host than the web

Callers 15

TestServerFunction · 0.92
NewEventsAPIHarnessFunction · 0.92
StartContractServerFunction · 0.92
bareDiscoveryServerFunction · 0.92
setupAPIFunction · 0.92
setupAPIWithSMTPFunction · 0.92
newAPIWithIdempotencyFunction · 0.92
setupMagicLinkAPIFunction · 0.92

Calls 3

NewEngineFunction · 0.92
NewHeuristicsDetectorFunction · 0.92
NewFunction · 0.92

Tested by 15

TestServerFunction · 0.74
bareDiscoveryServerFunction · 0.74
setupAPIFunction · 0.74
setupAPIWithSMTPFunction · 0.74
newAPIWithIdempotencyFunction · 0.74
setupMagicLinkAPIFunction · 0.74
newConsentFixtureFunction · 0.74
setupCoreAPIFunction · 0.74