mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-24 19:48:29 +00:00
fix: for new mcp connections create billing automatically
This commit is contained in:
parent
27762262d2
commit
f0debd5678
@ -14,6 +14,7 @@ import { callMemoryTool, memoryTools } from "~/utils/mcp/memory";
|
|||||||
import { logger } from "~/services/logger.service";
|
import { logger } from "~/services/logger.service";
|
||||||
import { type Response, type Request } from "express";
|
import { type Response, type Request } from "express";
|
||||||
import { getWorkspaceByUser } from "~/models/workspace.server";
|
import { getWorkspaceByUser } from "~/models/workspace.server";
|
||||||
|
import { ensureBillingInitialized } from "./billing.server";
|
||||||
|
|
||||||
const QueryParams = z.object({
|
const QueryParams = z.object({
|
||||||
source: z.string().optional(),
|
source: z.string().optional(),
|
||||||
@ -195,6 +196,8 @@ export const handleMCPRequest = async (
|
|||||||
const workspace = await getWorkspaceByUser(userId);
|
const workspace = await getWorkspaceByUser(userId);
|
||||||
const workspaceId = workspace?.id as string;
|
const workspaceId = workspace?.id as string;
|
||||||
|
|
||||||
|
await ensureBillingInitialized(workspaceId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let transport: StreamableHTTPServerTransport;
|
let transport: StreamableHTTPServerTransport;
|
||||||
let currentSessionId = sessionId;
|
let currentSessionId = sessionId;
|
||||||
@ -263,6 +266,8 @@ export const handleSessionRequest = async (
|
|||||||
workspace?.id as string,
|
workspace?.id as string,
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
|
await ensureBillingInitialized(workspace?.id as string);
|
||||||
|
|
||||||
const sessionData = TransportManager.getSessionInfo(sessionId);
|
const sessionData = TransportManager.getSessionInfo(sessionId);
|
||||||
|
|
||||||
if (sessionData.exists) {
|
if (sessionData.exists) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user