fix: 修复打包、启动报错问题
This commit is contained in:
4
.npmrc
Normal file
4
.npmrc
Normal file
@@ -0,0 +1,4 @@
|
||||
# 配置npm镜像源 (华为云)
|
||||
registry=https://repo.huaweicloud.com/repository/npm/
|
||||
# 严格检查 package.json 中 "engines" 字段指定的版本要求
|
||||
engine-strict=true
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "hula-mcp-server",
|
||||
"name": "@hula-spark/hula-mcp-server",
|
||||
"version": "1.0.0",
|
||||
"description": "HuLa 即时通讯应用的 MCP 服务",
|
||||
"type": "module",
|
||||
@@ -20,7 +20,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "node dist/index.js",
|
||||
"dev": "ts-node-dev --respawn src/index.ts",
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"test": "jest",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
@@ -52,5 +52,8 @@
|
||||
"bugs": {
|
||||
"url": "https://gitee.com/HuLaSpark/HuLa-MCP/issues"
|
||||
},
|
||||
"homepage": "https://gitee.com/HuLaSpark/HuLa-MCP#readme"
|
||||
"homepage": "https://gitee.com/HuLaSpark/HuLa-MCP#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import { Message, Conversation } from '../types.js';
|
||||
import { Message, Conversation } from '../types.ts';
|
||||
|
||||
// 模拟数据
|
||||
const mockMessages: Message[] = [
|
||||
@@ -66,7 +66,7 @@ export function registerChatResources(server: McpServer) {
|
||||
server.resource(
|
||||
'user-conversations',
|
||||
new ResourceTemplate('users://{userId}/conversations', { list: undefined }),
|
||||
async (uri: URL, params: Record<string, string>) => {
|
||||
async (uri: URL, params: Record<string, any>) => {
|
||||
const userId = params.userId as string;
|
||||
const userConversations = mockConversations.filter(conv =>
|
||||
conv.participants.includes(userId)
|
||||
@@ -84,7 +84,7 @@ export function registerChatResources(server: McpServer) {
|
||||
server.resource(
|
||||
'conversation-messages',
|
||||
new ResourceTemplate('conversations://{conversationId}/messages', { list: undefined }),
|
||||
async (uri: URL, params: Record<string, string>) => {
|
||||
async (uri: URL, params: Record<string, any>) => {
|
||||
const conversationId = params.conversationId as string;
|
||||
const conversation = mockConversations.find(conv => conv.id === conversationId);
|
||||
|
||||
@@ -121,7 +121,7 @@ export function registerChatResources(server: McpServer) {
|
||||
server.resource(
|
||||
'unread-messages',
|
||||
new ResourceTemplate('users://{userId}/unread', { list: undefined }),
|
||||
async (uri: URL, params: Record<string, string>) => {
|
||||
async (uri: URL, params: Record<string, any>) => {
|
||||
const userId = params.userId as string;
|
||||
const unreadCount = mockConversations
|
||||
.filter(conv => conv.participants.includes(userId))
|
||||
@@ -140,7 +140,7 @@ export function registerChatResources(server: McpServer) {
|
||||
server.resource(
|
||||
'recent-group-messages',
|
||||
new ResourceTemplate('groups://{groupId}/recent-messages', { list: undefined }),
|
||||
async (uri: URL, params: Record<string, string>) => {
|
||||
async (uri: URL, params: Record<string, any>) => {
|
||||
const groupId = params.groupId as string;
|
||||
const recentMessages = mockMessages
|
||||
.filter(msg => msg.isGroup && msg.receiverId === groupId)
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"resolveJsonModule": true,
|
||||
"emitDeclarationOnly": false,
|
||||
"allowImportingTsExtensions": false,
|
||||
"emitDeclarationOnly": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
|
||||
Reference in New Issue
Block a user