|
|
3 недель назад | |
|---|---|---|
| .. | ||
| src | 3 недель назад | |
| README.md | 3 недель назад | |
| package.json | 3 недель назад | |
| tsconfig.json | 3 недель назад | |
MCP (Model Context Protocol) server for admin backend API integration. This server enables AI agents to interact with the admin system through well-defined tools.
cd packages/admin-mcp-server
pnpm install
Set environment variables:
# API backend URL (default: http://localhost:8080)
export API_BASE_URL="http://localhost:8080"
# MCP server port (default: 3000)
export PORT="3000"
pnpm run dev
# Build
pnpm run build
# Start
pnpm start
curl http://localhost:3000/health
admin_login - Authenticate with username and passwordadmin_logout - Logout and clear sessionadmin_get_current_user - Get current authenticated user infoadmin_list_users - List users with pagination and filteringadmin_get_user - Get user by IDadmin_create_user - Create a new useradmin_update_user - Update existing useradmin_delete_user - Delete a useradmin_list_roles - List roles with paginationadmin_get_role - Get role by IDadmin_create_role - Create a new roleadmin_update_role - Update existing roleadmin_delete_role - Delete a roleadmin_list_system_configs - List system configurationsadmin_get_system_config - Get config by IDadmin_create_system_config - Create a new configadmin_update_system_config - Update existing configadmin_delete_system_config - Delete a configadmin_list_orders - List orders with paginationadmin_get_order - Get order by IDTo connect to this MCP server, use:
http://localhost:3000/mcp
npx @modelcontextprotocol/inspector http://localhost:3000/mcp
Add to your Claude Desktop config:
{
"mcpServers": {
"admin": {
"url": "http://localhost:3000/mcp",
"transport": "streamable_http"
}
}
}
The MCP server connects to the following backend API endpoints:
/api/auth/login - Admin login/api/auth/me - Get current user/api/users - User management/api/roles - Role management/api/system-configs - System configuration/api/orders - Order managementadmin-mcp-server/
├── src/
│ ├── index.ts # Main entry point
│ ├── constants.ts # Constants and enums
│ ├── types.ts # Type definitions
│ ├── schemas/ # Zod validation schemas
│ ├── services/ # API client service
│ └── tools/ # MCP tool implementations
├── dist/ # Built JavaScript files
├── package.json
├── tsconfig.json
└── README.md
MIT