mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
feat(mcp): audit MCP tool calls at the registry seam
This commit is contained in:
@@ -14,6 +14,7 @@ function makeSession(overrides: Partial<McpSession> = {}): McpSession {
|
||||
clientId: null,
|
||||
isStaticToken: false,
|
||||
lastActivity: Date.now(),
|
||||
lastClientIp: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import type { AuthService } from '../../../src/nest/auth/auth.service';
|
||||
import type { TokenService } from '../../../src/nest/tokens/token.service';
|
||||
import type { OauthService } from '../../../src/nest/oauth/oauth.service';
|
||||
import type { AddonsService } from '../../../src/nest/addons/addons.service';
|
||||
import type { AuditService } from '../../../src/nest/audit/audit.service';
|
||||
import type { McpRegistryService } from '@trek/nest-mcp';
|
||||
import { IS_PUBLIC } from '../../../src/nest/auth/public.decorator';
|
||||
|
||||
@@ -39,8 +40,9 @@ function makeService(overrides: {
|
||||
const tokens = { verifyMcpToken: vi.fn(() => null), ...overrides.tokens } as unknown as TokenService;
|
||||
const oauth = { getUserByAccessToken: vi.fn(() => null), ...overrides.oauth } as unknown as OauthService;
|
||||
const addons = { isAddonEnabled: vi.fn(() => true), ...overrides.addons } as unknown as AddonsService;
|
||||
const audit = { writeAudit: vi.fn() } as unknown as AuditService;
|
||||
const registry = { attach: vi.fn() } as unknown as McpRegistryService;
|
||||
return { svc: new McpTransportService(auth, tokens, oauth, addons, registry), auth, tokens, oauth, addons };
|
||||
return { svc: new McpTransportService(auth, tokens, oauth, addons, audit, registry), auth, tokens, oauth, addons, audit };
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user