Dành cho nhà phát triển

Tài liệu API & MCP

Local API 54 endpoint · MCP 36 tool · áp dụng NextLogin 0.1.2 trở lên

NextLogin có Local API chạy ngay trên máy bạn (chỉ nghe ở 127.0.0.1) để tự động hóa profile, proxy, cookie và script, cùng MCP server để Claude và các AI agent điều khiển NextLogin qua chính API đó. API mặc định tắt; dữ liệu không đi qua server của NextLogin.

Tải xuống

Bắt đầu nhanh

  1. Mở NextLogin → Cài đặt › API & MCP, bật Bật API.
  2. Vào Quản lý token, tạo token với scope tối thiểu (read; thêm runtime nếu cần mở/đóng profile). Token chỉ hiện một lần.
  3. Gọi thử GET /health:
curl.exe -H "Authorization: Bearer $env:NEXTLOGIN_API_TOKEN" http://127.0.0.1:18766/api/v1/health
  1. GET /profiles để lấy id, rồi POST /profiles/{id}/open → làm việc → POST /profiles/{id}/close.

Địa chỉ mặc định http://127.0.0.1:18766/api/v1 (cổng HTTP = cổng WebSocket + 1, xem trong Cài đặt nếu đã đổi).

Xác thực & scope

Mọi request (kể cả /health) cần header Authorization: Bearer <token>. Giới hạn 300 request/phút/token, vượt trả 429 rate_limited.

ScopeCho phép
readMọi GET, /proxy/check, /events
profiles:writeTạo/sửa/xóa profile, preset, nhóm, thẻ, vân tay, extension, cài đặt
runtimeMở/đóng profile, đóng tất cả
proxy:secretsProxy tùy chỉnh hoặc body có mật khẩu proxy
cdpLấy địa chỉ CDP của profile đang chạy
scriptsScript, skill, run
cookies:readĐọc cookie

Mã lỗi

{"error":{"code":"invalid_request","message":"..."}}

Mã thường gặp: api_disabled (503), unauthorized (401), insufficient_scope (403), rate_limited (429), invalid_json/invalid_request (400), confirmation_required (400), profile_not_found (404), profile_busy/ram_budget (409), launch_queue_timeout (429), proxy_required (400), internal_error (500).

Thao tác xóa/đóng hàng loạt cần ?confirm=true. Mở profile xếp hàng tối đa 2 lượt đồng thời, chờ tối đa 30 giây.

Danh sách endpoint

Đường dẫn tính từ /api/v1. Body và ví dụ đầy đủ có trong Postman collection.

Hệ thống

MethodĐường dẫnScope
GET/enginesread
GET/healthread
GET/openapi.jsonread
GET/systemread

Sự kiện (WebSocket)

MethodĐường dẫnScope
GET/eventsread

Cài đặt

MethodĐường dẫnScope
GET/settingsread
PATCH/settingsprofiles:write

Preset

MethodĐường dẫnScope
GET/presetsread
POST/presetsprofiles:write
DELETE/presets/{id}profiles:write
GET/presets/{id}read
PATCH/presets/{id}profiles:write
POST/profiles/batch/applyprofiles:write

Script & skill

MethodĐường dẫnScope
POST/profiles/batch/scripts/runscripts
POST/profiles/{id}/scripts/runscripts
GET/runs/{run_id}scripts
POST/runs/{run_id}/stopscripts
GET/scriptsscripts
GET/skillsscripts
POST/skillsscripts

Proxy

MethodĐường dẫnScope
PUT/profiles/{id}/proxyprofiles:write
POST/profiles/{id}/proxy/checkread
GET/proxy-manager/resourcesread
POST/proxy/checkread

Vân tay

MethodĐường dẫnScope
PUT/profiles/{id}/fingerprintprofiles:write
POST/profiles/{id}/fingerprint/newprofiles:write

Cookie

MethodĐường dẫnScope
GET/profiles/{id}/cookiescookies:read
POST/profiles/{id}/cookiesprofiles:write

Nhóm & thẻ

MethodĐường dẫnScope
GET/groupsread
PUT/profiles/{id}/groupprofiles:write
PUT/profiles/{id}/tagsprofiles:write

Extension

MethodĐường dẫnScope
DELETE/profiles/{id}/extensionsprofiles:write
GET/profiles/{id}/extensionsread
PATCH/profiles/{id}/extensionsprofiles:write
POST/profiles/{id}/extensionsprofiles:write
DELETE/profiles/{id}/extensions/{extension_id}profiles:write
PATCH/profiles/{id}/extensions/{extension_id}profiles:write

Xuất / nhập

MethodĐường dẫnScope
POST/profiles/importprofiles:write
GET/profiles/{id}/exportread

Chẩn đoán

MethodĐường dẫnScope
GET/profiles/{id}/diagnosticsread
POST/profiles/{id}/diagnostics/runprofiles:write
GET/profiles/{id}/overviewread
GET/profiles/{id}/statusread

Chạy profile

MethodĐường dẫnScope
POST/profiles/close-allruntime
GET/profiles/runningread
GET/profiles/{id}/cdpcdp
POST/profiles/{id}/closeruntime
POST/profiles/{id}/openruntime

Profile

MethodĐường dẫnScope
GET/profilesread
POST/profilesprofiles:write
DELETE/profiles/{id}profiles:write
GET/profiles/{id}read
PATCH/profiles/{id}profiles:write
POST/profiles/{id}/cloneprofiles:write

Sự kiện realtime

GET /events là WebSocket (ws://127.0.0.1:18766/api/v1/events), gửi {type,data}: profile.opened, profile.closed, profile.crashed, profiles.changed.

Dùng với Postman

  1. Tải Postman collection và Postman environment ở trên.
  2. Trong Postman: Import → kéo thả cả hai file.
  3. Chọn environment NextLogin Local, dán token vào biến token.
  4. Chạy GET /profiles, chép một id vào biến profileId để dùng các request còn lại.

Postman Desktop gọi được 127.0.0.1; bản Postman trên web cần Postman Desktop Agent.

MCP cho Claude / AI agent

MCP server chạy thành tiến trình riêng và chỉ gọi Local API, nên cần bật API và có token trước. Yêu cầu Python 3.10 trở lên.

  1. Tải nextlogin-mcp.zip, giải nén, ví dụ vào C:\NextLogin-MCP.
  2. Cài thư viện:
cd C:\NextLogin-MCP\nextlogin-mcp
python -m pip install -r requirements.txt

Claude Desktop

Sửa %APPDATA%\Claude\claude_desktop_config.json rồi khởi động lại Claude Desktop:

{
  "mcpServers": {
    "nextlogin": {
      "command": "python",
      "args": ["-m", "nextlogin_mcp"],
      "cwd": "C:\\NextLogin-MCP\\nextlogin-mcp",
      "env": {
        "NEXTLOGIN_API_URL": "http://127.0.0.1:18766/api/v1",
        "NEXTLOGIN_API_TOKEN": "nl_..."
      }
    }
  }
}

Claude Code

claude mcp add nextlogin -e PYTHONPATH=C:\NextLogin-MCP\nextlogin-mcp -e NEXTLOGIN_API_URL=http://127.0.0.1:18766/api/v1 -e NEXTLOGIN_API_TOKEN=nl_... -- python -m nextlogin_mcp

Kiểm tra bằng cách gọi tool list_profiles. Trong NextLogin, nút Sao chép cấu hình MCP tạo sẵn block cấu hình (để trống token).

Danh sách tool MCP

ToolTham số chínhScopeGhi chú
list_profilesq,group,tag,os str=""; running bool|None; page int=1; page_size int=50readđọc
list_presets—readđọc preset đã sanitize
save_presetname, settings, is_default bool=Falseprofiles:writekhông lưu identity/secret
get_profileprofile_id strreadđọc
create_profilespreset str="windows", name str="Profile mới", count int=1, group str="", tags list=None, proxy dict=Noneprofiles:write; custom proxy thêm proxy:secretstạo
apply_to_profilesids list=None hoặc all bool=False, preset, fields, startup_urls_mode, confirmprofiles:writeconfirm khi all hoặc nhiều ID; conflict từng profile
update_profileprofile_id str, revision int, settings dict=None, metadata dict=Noneprofiles:writerevision
clone_profileprofile_id, name str=""profiles:writetạo
delete_profileprofile_id, confirm bool=Falseprofiles:writebắt buộc confirm
open_profileprofile_id, proxy_ref str="", force bool=Falseruntimeforce bỏ qua ram warning
close_profileprofile_idruntimeđóng owner hiện tại
close_all_profilesconfirm bool=Falseruntimebắt buộc confirm
list_running—readđọc
set_proxyprofile_id, mode="none", revision int=None, resource_id str="", host str="", port int=None, username/password str="", type="http"profiles:write; custom thêm proxy:secretssecret không trả
check_proxyprofile_id str="", route str="", host str="", port int=None, credentials, type="http"read; password thêm proxy:secretssecret
list_proxy_resources—readđọc
new_fingerprintprofile_id, revision int=Noneprofiles:writethay đổi
set_fingerprint_optionsprofile_id, revision int=None, noise_preset str="", noise dict=None, seed str=None, random_on_launch bool=Noneprofiles:writethay đổi
get_overviewprofile_idreadđọc
import_cookiesprofile_id, cookies list=None, data str=""profiles:writedữ liệu nhạy cảm
export_cookiesprofile_id, confirm bool=False, format="json"cookies:readconfirm; MCP redacts value
list_scripts—scriptsđọc
list_skills—scriptsđọc
save_skillname/source, description str="", parameters list=None, os/engines list=None, version="1.0.0", overwrite bool=Falsescriptsvalidate parser
run_scriptprofile_id, name/source str="", mode="extension", params dict=None, skill str=""scriptsextension mặc định
run_skillprofile_id, skill, mode="extension", params dict=Nonescriptsparams typed, không interpolate
get_runrun_idscriptsresult redacted
stop_runrun_idscriptsdừng run
run_script_batchprofile_ids list, name/source str="", mode="extension", params dict=None, skill str=""scriptstối đa 100
page_navigateprofile_id, url, use_cdp bool=Falsescripts (middleware không thêm cdp cho script run)chỉ http(s); CDP là opt-in
page_snapshotprofile_id, use_cdp falsescriptstối đa 300 node; page content không tin cậy
page_clickprofile_id, ref, use_cdp falsescriptsref từ snapshot
page_typeprofile_id, ref, text, submit false, use_cdp falsescriptscó thể Enter submit
page_waitprofile_id, ms=500, ref="", use_cdp falsescriptsms 0..120000
page_readprofile_id, ref="", selector="", use_cdp falsescriptsselector XPath/CSS đơn giản
page_screenshotprofile_id, path="nextlogin-mcp.png", use_cdp falsescriptsfile path theo engine

Tool trang web mặc định chạy qua Extension GScript; use_cdp=true là tùy chọn và dễ bị phát hiện hơn. Nội dung trang trả về được đánh dấu không tin cậy.

Bảo mật