@shaohui_jin/git-cockpit-mcp-server 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,31 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "./chunk-SVQLF7LC.js";
4
+ } from "./chunk-HNARFTSW.js";
5
5
  import {
6
6
  ConfigStore,
7
7
  RepoManager,
8
8
  createRuntime,
9
9
  createWebServer,
10
10
  disposeRuntime
11
- } from "./chunk-GPUMKDZD.js";
11
+ } from "./chunk-ZVMQTPCD.js";
12
12
  import {
13
13
  MCP_PROMPTS,
14
14
  MCP_SERVER_INFO,
15
15
  McpHttpHandler,
16
+ McpSessionContext,
16
17
  TOOL_DEFS,
17
18
  TOOL_DEF_MAP,
18
19
  createMcpServer,
19
20
  executeTool,
21
+ formatDaemonUrl,
20
22
  formatResultForMcp,
23
+ resolveDaemonEndpoint,
21
24
  startMcpStdio,
22
25
  toolSummaries
23
- } from "./chunk-NUNR2ELF.js";
26
+ } from "./chunk-UTGCX3CG.js";
24
27
  export {
25
28
  ConfigStore,
26
29
  MCP_PROMPTS,
27
30
  MCP_SERVER_INFO,
28
31
  McpHttpHandler,
32
+ McpSessionContext,
29
33
  RepoManager,
30
34
  TOOL_DEFS,
31
35
  TOOL_DEF_MAP,
@@ -34,7 +38,9 @@ export {
34
38
  createWebServer,
35
39
  disposeRuntime,
36
40
  executeTool,
41
+ formatDaemonUrl,
37
42
  formatResultForMcp,
43
+ resolveDaemonEndpoint,
38
44
  main as runCli,
39
45
  startMcpStdio,
40
46
  toolSummaries
@@ -0,0 +1,44 @@
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { R as Runtime } from './runtime-BHX-b-Hx.js';
4
+
5
+ interface McpRepoBinding {
6
+ repoId: number;
7
+ repoPath: string;
8
+ boundAt: string;
9
+ generation: number;
10
+ }
11
+ /** MCP 连接私有的仓库上下文;不写入 SQLite,也不与其他连接共享。 */
12
+ declare class McpSessionContext {
13
+ private readonly runtime;
14
+ private binding;
15
+ private generation;
16
+ constructor(runtime: Runtime);
17
+ getBinding(): McpRepoBinding | null;
18
+ select(input: {
19
+ repoId?: number;
20
+ repoPath?: string;
21
+ clear?: boolean;
22
+ }): Promise<McpRepoBinding | null>;
23
+ }
24
+
25
+ declare const MCP_SERVER_INFO: {
26
+ readonly name: "git-cockpit-mcp-server";
27
+ readonly version: string;
28
+ };
29
+ /** 创建一个已注册全部工具的 McpServer(一个传输对应一个实例) */
30
+ declare function createMcpServer(runtime: Runtime, session?: McpSessionContext): McpServer;
31
+ /** stdio 模式:单连接,适合 Claude Desktop / Cursor 直接拉起的独立进程 */
32
+ declare function startMcpStdio(runtime: Runtime): Promise<void>;
33
+ /** 维护 Streamable HTTP 的会话映射(sessionId -> server+transport) */
34
+ declare class McpHttpHandler {
35
+ private readonly runtime;
36
+ private readonly sessions;
37
+ constructor(runtime: Runtime);
38
+ /** 与 cli.ts、stdio bridge 保持同一套 daemon 地址解析。 */
39
+ private hostPort;
40
+ handle(req: IncomingMessage, res: ServerResponse, parsedBody?: unknown): Promise<void>;
41
+ dispose(): void;
42
+ }
43
+
44
+ export { MCP_SERVER_INFO as M, McpHttpHandler as a, type McpRepoBinding as b, McpSessionContext as c, createMcpServer as d, startMcpStdio as s };
@@ -1,25 +1,7 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import { R as Runtime } from './runtime-CtZr-J1V.js';
1
+ import 'node:http';
2
+ import '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import './runtime-BHX-b-Hx.js';
4
+ export { M as MCP_SERVER_INFO, a as McpHttpHandler, d as createMcpServer, s as startMcpStdio } from './mcpServer-5C8WQYy6.js';
4
5
  import 'node:events';
5
6
  import 'node:sqlite';
6
7
  import '@shaohui_jin/git-cockpit-core';
7
-
8
- declare const MCP_SERVER_INFO: {
9
- readonly name: "git-cockpit-mcp-server";
10
- readonly version: string;
11
- };
12
- /** 创建一个已注册全部工具的 McpServer(一个传输对应一个实例) */
13
- declare function createMcpServer(runtime: Runtime): McpServer;
14
- /** stdio 模式:单连接,适合 Claude Desktop / Cursor 直接拉起的独立进程 */
15
- declare function startMcpStdio(runtime: Runtime): Promise<void>;
16
- /** 维护 Streamable HTTP 的会话映射(sessionId -> server+transport) */
17
- declare class McpHttpHandler {
18
- private readonly runtime;
19
- private readonly sessions;
20
- constructor(runtime: Runtime);
21
- handle(req: IncomingMessage, res: ServerResponse, parsedBody?: unknown): Promise<void>;
22
- dispose(): void;
23
- }
24
-
25
- export { MCP_SERVER_INFO, McpHttpHandler, createMcpServer, startMcpStdio };
package/dist/mcpServer.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  McpHttpHandler,
5
5
  createMcpServer,
6
6
  startMcpStdio
7
- } from "./chunk-NUNR2ELF.js";
7
+ } from "./chunk-UTGCX3CG.js";
8
8
  export {
9
9
  MCP_SERVER_INFO,
10
10
  McpHttpHandler,
@@ -45,6 +45,7 @@ declare class RepoManager {
45
45
  /** repo 根路径(规范化绝对路径) -> repoId */
46
46
  private readonly pathToId;
47
47
  private readonly idToService;
48
+ private readonly opening;
48
49
  private readonly eventBus;
49
50
  constructor(options: RepoManagerOptions);
50
51
  list(): (OpenedRepo & {
@@ -55,8 +56,9 @@ declare class RepoManager {
55
56
  reorder(ids: number[]): OpenedRepo[];
56
57
  /** 按 id 取仓库(懒创建服务) */
57
58
  getById(id: number): Promise<RepoHandle | null>;
58
- /** 打开仓库:校验并记录;重复打开返回既有实例 */
59
+ /** 打开仓库:同一路径并发请求共享同一个 GitService 实例。 */
59
60
  open(repoPath: string): Promise<RepoHandle>;
61
+ private openInternal;
60
62
  /** 激活仓库:只刷新 last_opened_at,不改工作台拖拽顺序;仓库不存在返回 null */
61
63
  activate(id: number): OpenedRepo | null;
62
64
  /** 按路径取服务,未打开则报错(避免隐式副作用) */