Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let package = Package(
.headerSearchPath("Server/Category"),
.headerSearchPath("Server/Connection"),
.headerSearchPath("Server/Connection/RequestHandler"),
.headerSearchPath("Server/HTTP"),
.headerSearchPath("Server/Inspect"),
.headerSearchPath("Server/Others"),
.headerSearchPath("Server/Perspective"),
Expand Down
6 changes: 6 additions & 0 deletions Src/Main/Server/Connection/LKS_ConnectionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "LookinServerDefines.h"
#import "LKS_TraceManager.h"
#import "LKS_MultiplatformAdapter.h"
#import "LKS_HTTPHandler.h"

NSString *const LKS_ConnectionDidEndNotificationName = @"LKS_ConnectionDidEndNotificationName";

Expand All @@ -24,6 +25,7 @@ @interface LKS_ConnectionManager () <Lookin_PTChannelDelegate>
@property(nonatomic, weak) Lookin_PTChannel *peerChannel_;

@property(nonatomic, strong) LKS_RequestHandler *requestHandler;
@property(nonatomic, strong) LKS_HTTPHandler *httpHandler;

@end

Expand Down Expand Up @@ -61,6 +63,10 @@ - (instancetype)init {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleGetLookinInfo:) name:@"GetLookinInfo" object:nil];

self.requestHandler = [LKS_RequestHandler new];

// 启动 HTTP Server,供 lookin-mcp 直连(127.0.0.1:47190)
self.httpHandler = [LKS_HTTPHandler new];
[self.httpHandler startHTTPServer];
}
return self;
}
Expand Down
14 changes: 14 additions & 0 deletions Src/Main/Server/HTTP/LKS_HTTPHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifdef SHOULD_COMPILE_LOOKIN_SERVER

#import <Foundation/Foundation.h>

/// 路由分发 + 业务逻辑处理,直接调用 LookinServer 现有 API
/// 启动后监听 127.0.0.1:47190,供 lookin-mcp npm 包直连
@interface LKS_HTTPHandler : NSObject

- (void)startHTTPServer;
- (void)stopHTTPServer;

@end

#endif /* SHOULD_COMPILE_LOOKIN_SERVER */
Loading