npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

imt-mcp-server

v1.0.1

Published

MCP Server for IMT user management with device control capabilities

Readme

IMT MCP Server

一个基于 Model Context Protocol (MCP) 的服务器,用于提供用户管理功能。

功能特性

  • 🔐 自动认证管理 - 自动获取和管理认证token
  • 👤 用户信息获取 - 提供获取用户详细信息的MCP工具
  • 🛡️ 错误处理 - 完善的错误处理和重试机制
  • 📝 TypeScript支持 - 完全使用TypeScript编写,提供类型安全

项目结构

imt_mcps/
├── src/
│   ├── auth/
│   │   └── token-manager.ts    # Token管理和认证逻辑
│   ├── tools/
│   │   └── user-info.ts        # 用户信息获取工具
│   └── index.ts                # MCP服务器主文件
├── docs/
│   └── product.md              # 产品需求文档
├── package.json                # 项目配置
├── tsconfig.json              # TypeScript配置
└── README.md                  # 项目说明

快速开始

1. 安装依赖

npm install

2. 开发模式运行

npm run dev

3. 构建生产版本

npm run build
npm start

支持的MCP工具

get_user_info

获取当前认证用户的详细信息。

参数: 无

返回: 结构化的用户信息,包含字段说明

数据结构: 返回的数据按功能分组,每个字段包含 value(实际值)和 description(字段说明)

数据分组:

  • responseInfo: API响应元信息
  • basicInfo: 用户基本信息
  • organizationInfo: 组织架构信息
  • locationInfo: 地址信息
  • timeInfo: 时间信息
  • permissionInfo: 权限和角色信息
  • menuPermissions: 菜单权限信息
  • deviceInfo: 设备相关信息
  • integrationInfo: 第三方集成信息
  • summary: 数据摘要

示例:

{
  "basicInfo": {
    "username": {
      "value": "河南古城丝路",
      "description": "登录用户名"
    },
    "realName": {
      "value": "刘士力", 
      "description": "用户真实姓名"
    },
    "email": {
      "value": "[email protected]",
      "description": "用户电子邮箱地址"
    }
  },
  "summary": {
    "totalRoles": {
      "value": 1,
      "description": "用户拥有的角色总数"
    },
    "accountAge": {
      "value": 1919,
      "description": "账户创建至今的天数"
    }
  }
}

## 技术实现

### 认证流程

1. **自动token获取**: 当需要认证时,系统会自动向认证API发送POST请求获取token
2. **全局token管理**: Token存储在全局变量中,供所有工具使用
3. **自动重试机制**: 当token过期时,系统会自动重新获取token并重试请求

### API端点

- **认证接口**: `POST http://vend.foreveriot.com/auth/login`
- **用户信息接口**: `GET http://vend.foreveriot.com/auth/user`

### 关键配置

```typescript
// 认证配置
const AUTH_CONFIG = {
  url: 'http://vend.foreveriot.com/auth/login',
  credentials: {
    username: '河南古城丝路',
    password: 'e6e061838856bf47e1de730719fb2609'
  }
};

开发指南

添加新的MCP工具

  1. src/tools/ 目录下创建新的工具文件
  2. 实现工具逻辑,确保使用 getCurrentToken() 获取认证信息
  3. src/index.ts 中注册新工具:
    • ListToolsRequestSchema 处理器中添加工具描述
    • CallToolRequestSchema 处理器中添加工具执行逻辑

错误处理

项目包含完善的错误处理机制:

  • 网络错误: 自动检测并报告网络连接问题
  • 认证错误: 自动重新获取token并重试
  • 参数错误: 验证输入参数并返回详细错误信息

依赖项

  • @modelcontextprotocol/sdk: MCP协议SDK
  • axios: HTTP客户端库
  • typescript: TypeScript编译器
  • ts-node: TypeScript直接执行工具

注意事项

  • 确保网络能够访问 vend.foreveriot.com 域名
  • Token会在内存中缓存,服务重启后需要重新获取
  • 所有API请求都有10秒超时限制

许可证

MIT License