refactor(auth): remove keys auth module and align tests
- remove server auth module and client keys page/routes/api to simplify flow - update mcp and scenario tests to match uuid routes and step schema
This commit is contained in:
@@ -3,7 +3,6 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
||||
import { z } from "zod";
|
||||
import type { Request, Response } from "express";
|
||||
import { AuthService } from "../auth/auth.service";
|
||||
import { SessionService } from "../session/session.service";
|
||||
import { SessionContextService } from "../session/session-context.service";
|
||||
import { EnvironmentService } from "../environment/environment.service";
|
||||
@@ -17,7 +16,6 @@ import pkg from "../../package.json";
|
||||
@Injectable()
|
||||
export class McpService {
|
||||
constructor(
|
||||
private readonly authService: AuthService,
|
||||
private readonly sessionService: SessionService,
|
||||
private readonly sessionContextService: SessionContextService,
|
||||
private readonly environmentService: EnvironmentService,
|
||||
@@ -33,53 +31,6 @@ export class McpService {
|
||||
}
|
||||
|
||||
private registerTools(server: McpServer): void {
|
||||
// ── Auth ──────────────────────────────────────────────────────────────────
|
||||
|
||||
server.registerTool(
|
||||
"list_keys",
|
||||
{ description: "List available key identifiers from the keys directory" },
|
||||
async () => {
|
||||
const keys = this.authService.listKeys();
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify(keys) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"login",
|
||||
{
|
||||
description:
|
||||
"Log in using a file key against a named environment and store the session",
|
||||
inputSchema: {
|
||||
key: z
|
||||
.string()
|
||||
.describe(
|
||||
"Key identifier (filename without extension from keys/ dir)",
|
||||
),
|
||||
environmentName: z
|
||||
.string()
|
||||
.describe("Environment name to resolve login/cabinet URLs"),
|
||||
sessionName: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Session name to store credentials under. Auto-UUID if omitted.",
|
||||
),
|
||||
},
|
||||
},
|
||||
async ({ key, environmentName, sessionName }) => {
|
||||
const result = await this.authService.login(
|
||||
key,
|
||||
environmentName,
|
||||
sessionName,
|
||||
);
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify(result) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
// ── Sessions ──────────────────────────────────────────────────────────────
|
||||
|
||||
server.registerTool(
|
||||
|
||||
Reference in New Issue
Block a user