mcp_settings.json (or the mcphub_user table when the database backend is enabled). All endpoints require an authenticated admin (isAdmin: true).
For OAuth/social accounts created via Better Auth, see /api/better-auth/* instead — those records live in a separate table and are not managed through this API.
GET /api/users
List all users.
GET /api/users/:username
Get a single user.
POST /api/users
Create a user.
PUT /api/users/:username
Update a user.
DELETE /api/users/:username
Delete a user.
GET /api/users-stats
Aggregate user counts.
Get All Users
- Endpoint:
GET /api/users - Authentication: Required (admin only)
- Response: The
passwordfield is stripped from every record.
Get a User
- Endpoint:
GET /api/users/:username - Authentication: Required (admin only)
- Response:
404 if the user does not exist.
Create a User
- Endpoint:
POST /api/users - Authentication: Required (admin only)
- Body:
| Field | Type | Required | Description |
|---|---|---|---|
username | string | yes | Must be unique. |
password | string | yes | Must satisfy the configured password policy (see src/utils/passwordValidation.ts). |
isAdmin | boolean | no | Defaults to false. |
- Returns
400ifusername/passwordare missing, the password is too weak, or the username is already taken. - Returns
201with the new user (password stripped) on success.
The user model does not have per-user
servers or groups lists. Server visibility is governed by the owner field on each server and by the group membership recorded on the group itself. See Group Management and MCP Settings.Update a User
- Endpoint:
PUT /api/users/:username - Authentication: Required (admin only)
- Body (at least one field is required):
| Field | Type | Description |
|---|---|---|
isAdmin | boolean | Promote/demote the user. |
newPassword | string | Replace the user’s password. Must satisfy the password policy. |
- Returns
400if neither field is supplied, the password fails validation, or the request would demote the last remaining admin. - Returns
404if the username does not exist.
Delete a User
- Endpoint:
DELETE /api/users/:username - Authentication: Required (admin only)
- Restrictions:
- You cannot delete your own account.
- You cannot delete the last admin.
Get User Statistics
- Endpoint:
GET /api/users-stats - Authentication: Required (admin only)