This MCP server exposes the Sub2API admin HTTP API as a small set of resource-oriented tools. It is limited to admin CRUD and non-streaming admin query or action endpoints. Gateway streaming routes are intentionally excluded.
sub2api_admin_describe_resourcesReturns the supported resources, CRUD coverage, named actions, documented params, call templates, and examples.sub2api_admin_listCalls the list or collection route for a resource.sub2api_admin_getCalls the get route for a resource.sub2api_admin_createCalls the create route for a resource.sub2api_admin_updateCalls the update route for a resource.sub2api_admin_deleteCalls the delete route for a resource.sub2api_admin_actionCalls a named non-CRUD action such as stats, resets, exports, or OAuth helpers.sub2api_admin_find_capabilitySearches task recipes, resources, and actions by keyword, intent, path, or parameter name and returns a recommended route, reasoning hints, workflows, and call templates.
Run:
node tools/sub2api-admin-mcp/server.mjs --print-resourcesThat prints the exact resource catalog, every named action, and any documented parameter metadata or examples. Current top-level resources include:
dashboardusersgroupsaccountsannouncementsproxiesredeem_codespromo_codessubscriptionsusageuser_attributeserror_passthrough_rulesapi_keysscheduled_test_planssettingsdata_managementbackupssystemopsopenai_oauthsora_oauthgemini_oauthantigravity_oauth
Auth precedence is:
SUB2API_ADMIN_API_KEYSUB2API_ADMIN_JWTSUB2API_ADMIN_EMAIL+SUB2API_ADMIN_PASSWORD
Recommended: use SUB2API_ADMIN_API_KEY.
The admin middleware accepts it directly through x-api-key.
Optional credential-login variables:
SUB2API_ADMIN_TURNSTILE_TOKENSUB2API_ADMIN_TOTP_CODE
Required base URL:
SUB2API_BASE_URL
Optional timeout:
SUB2API_TIMEOUT_MS
{
"mcpServers": {
"sub2api-admin": {
"command": "node",
"args": [
"C:/path/to/sub2api/tools/sub2api-admin-mcp/server.mjs"
],
"env": {
"SUB2API_BASE_URL": "http://127.0.0.1:8080",
"SUB2API_ADMIN_API_KEY": "replace-with-your-admin-api-key"
}
}
}
}Replace the example script path above with your own local absolute path.
- Run
sub2api_admin_find_capabilityfirst when you know the intent but not the exact resource or action name. It now prefers task recipes and bulk-safe workflows over raw keyword matches. sub2api_admin_find_capabilitynow returns arecommendedmatch plus per-resultwhyhints so the agent can pick a route directly instead of re-probing nearby endpoints.- Run
sub2api_admin_describe_resourceswhen you know the resource and need the precise call shape, documented params, path placeholders, examples, or warnings. sub2api_admin_describe_resourcesreturns a compact catalog by default. Passview: "full"when you need the full resource catalog in one response. Aliases such assummary,detail,detailed, oractionsare accepted and normalized.- When
resourceis provided,sub2api_admin_describe_resourcesdefaults to the full detail view for that one resource. - CRUD operations do not go through
sub2api_admin_action. Use the explicit tool named inoperations.<name>.tool, such assub2api_admin_listforaccounts.listorsub2api_admin_getforusers.get. - Use
idfor routes that use:id. - Use
path_paramsfor routes that need placeholders such asprofile_id,source_type,job_id, oridx. - Use
queryfor query string filters. - Use
bodyfor JSON payloads on create, update, and action calls. - The MCP now performs local validation for documented query and body fields before sending requests. Unknown keys produce either a hard error or a warning depending on how complete the endpoint metadata is.
- Documented
call_templatepayloads can now include starter query/body args for common safe defaults such aspage_size,lite=true, orwith_count=true, so agents need fewer exploratory calls. - Compact
describe_resourcesoutput now includesoperation_toolsandoperation_summariesso callers can route an operation to the correct MCP tool without expanding every resource into full detail. - For per-user or per-API-key cost snapshots, prefer
dashboard.users_usageordashboard.api_keys_usage; the matching*_trendendpoints are better suited to trend and chart views than guaranteed cost snapshots. - For account questions about what remains, what is usable now, or whether quota windows still allow scheduling, combine
accounts.listwithops.account_availabilityinstead of treating usage/today stats as a complete answer. - For filters like
attr[12], use the literal key inquery. - High-signal resources such as
usage,dashboard,accounts,users,groups,proxies,subscriptions,settings,backups, anddata_managementinclude richer metadata derived from the admin frontend API layer. - Task-oriented discovery now understands common goals such as account usage reports, API key ranking, group usage, account inventory, error triage, proxy health checks, subscription inspection, backup health checks, and batch account refreshes.
accounts.listandaccounts.getresponses are sanitized by the MCP to avoid flooding the agent with nested credentials during exploratory reads.
node --check tools/sub2api-admin-mcp/server.mjs
node tools/sub2api-admin-mcp/server.mjs --print-tools
node tools/sub2api-admin-mcp/server.mjs --print-resources
node tools/sub2api-admin-mcp/server.mjs --find-capability "看下今天我们sub2api的账号使用情况" --limit 5