Skip to content

Commit fe2cd1a

Browse files
authored
fix: use /sse for cursor (#121)
1 parent cb31e60 commit fe2cd1a

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

src/steps/add-mcp-server-to-clients/MCPClient.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export abstract class DefaultMCPClient extends MCPClient {
3636
}
3737

3838
async addServer(apiKey: string): Promise<{ success: boolean }> {
39+
return this._addServerType(apiKey, 'streamable-http');
40+
}
41+
42+
async _addServerType(
43+
apiKey: string,
44+
type: 'sse' | 'streamable-http',
45+
): Promise<{ success: boolean }> {
3946
try {
4047
const configPath = await this.getConfigPath();
4148
const configDir = path.dirname(configPath);
@@ -44,7 +51,7 @@ export abstract class DefaultMCPClient extends MCPClient {
4451

4552
const newServerConfig = {
4653
mcpServers: {
47-
posthog: getDefaultServerConfig(apiKey),
54+
posthog: getDefaultServerConfig(apiKey, type),
4855
},
4956
};
5057

src/steps/add-mcp-server-to-clients/clients/__tests__/claude.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ describe('ClaudeMCPClient', () => {
324324

325325
await client.addServer(mockApiKey);
326326

327-
expect(getDefaultServerConfigMock).toHaveBeenCalledWith(mockApiKey);
327+
expect(getDefaultServerConfigMock).toHaveBeenCalledWith(
328+
mockApiKey,
329+
'streamable-http',
330+
);
328331
});
329332
});
330333

src/steps/add-mcp-server-to-clients/clients/cursor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ export class CursorMCPClient extends DefaultMCPClient {
2424
async getConfigPath(): Promise<string> {
2525
return Promise.resolve(path.join(os.homedir(), '.cursor', 'mcp.json'));
2626
}
27+
28+
async addServer(apiKey: string): Promise<{ success: boolean }> {
29+
return this._addServerType(apiKey, 'sse');
30+
}
2731
}

src/steps/add-mcp-server-to-clients/defaults.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ export const DefaultMCPClientConfig = z
1313
})
1414
.passthrough();
1515

16-
export const getDefaultServerConfig = (apiKey: string) => ({
16+
type MCPServerType = 'sse' | 'streamable-http';
17+
18+
export const getDefaultServerConfig = (
19+
apiKey: string,
20+
type: MCPServerType,
21+
) => ({
1722
command: 'npx',
1823
args: [
1924
'-y',
2025
'mcp-remote@latest',
21-
'https://mcp.posthog.com/mcp',
26+
`https://mcp.posthog.com/${type === 'sse' ? 'sse' : 'mcp'}`,
2227
'--header',
2328
`Authorization:\${POSTHOG_AUTH_HEADER}`,
2429
],

0 commit comments

Comments
 (0)