diff --git a/src/api/utils/badge.ts b/src/api/utils/badge.ts index fcabc90..6cf41e9 100644 --- a/src/api/utils/badge.ts +++ b/src/api/utils/badge.ts @@ -2,6 +2,8 @@ * Badge utilities for GitMCP documentation tracking */ +const badgeCountAllowedRepos = ["mcp-ui", "git-mcp"]; + /** * Gets a Durable Object stub for the view counter * @param env Cloudflare environment @@ -163,7 +165,12 @@ export function withViewTracking( ): (args: T) => Promise { return async (args: T) => { // Only track if we have both owner and repo and counter binding available - if (repoData.owner && repoData.repo && env?.VIEW_COUNTER) { + if ( + repoData.owner && + repoData.repo && + badgeCountAllowedRepos.includes(repoData.repo) && + env?.VIEW_COUNTER + ) { // Handle the view count tracking try { const incrementPromise = incrementRepoViewCount( diff --git a/src/test/badge.test.ts b/src/test/badge.test.ts index b646835..29ecb83 100644 --- a/src/test/badge.test.ts +++ b/src/test/badge.test.ts @@ -119,7 +119,7 @@ describe("Badge utilities", () => { const originalCallback = vi.fn().mockResolvedValue("result"); // Create the wrapped callback - const repoData = { owner: "owner", repo: "repo" }; + const repoData = { owner: "idosal", repo: "git-mcp" }; const wrappedCallback = withViewTracking( mockEnv, mockCtx, @@ -171,7 +171,7 @@ describe("Badge utilities", () => { const originalCallback = vi.fn().mockResolvedValue("result"); // Create the wrapped callback - const repoData = { owner: "owner", repo: "repo" }; + const repoData = { owner: "idosal", repo: "git-mcp" }; const wrappedCallback = withViewTracking( mockEnv, {},