We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kirbah/mcp-youtube'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import { Collection, Filter, UpdateFilter } from "mongodb";
import type { ChannelCache } from "../../types/niche.types.js";
import { getDb } from "../database.service.js"; // Import the lazy loader
export class NicheRepository {
private readonly CHANNELS_CACHE_COLLECTION = "analysis_channels";
async findChannelsByIds(ids: string[]): Promise<ChannelCache[]> {
// Lazily get the database connection.
const db = await getDb();
const collection: Collection<ChannelCache> = db.collection(
this.CHANNELS_CACHE_COLLECTION
);
const cachedChannels = await collection
.find({ _id: { $in: ids } } as Filter<ChannelCache>)
.toArray();
return cachedChannels as ChannelCache[];
}
async updateChannel(
channelId: string,
updates: UpdateFilter<ChannelCache>
): Promise<void> {
// Lazily get the database connection.
const db = await getDb();
const collection: Collection<ChannelCache> = db.collection(
this.CHANNELS_CACHE_COLLECTION
);
await collection.updateOne(
{ _id: channelId } as Filter<ChannelCache>,
updates,
{ upsert: true }
);
}
}