forked from apify/apify-mcp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_card.ts
More file actions
63 lines (59 loc) · 1.88 KB
/
Copy pathserver_card.ts
File metadata and controls
63 lines (59 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import type { Implementation } from '@modelcontextprotocol/sdk/types.js';
import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/sdk/types.js';
import {
APIFY_DOCS_MCP_URL,
APIFY_FAVICON_URL,
APIFY_LOGO_URL,
APIFY_MCP_URL,
SERVER_NAME,
SERVER_TITLE,
} from './const.js';
import type { ServerCard } from './types.js';
import { readJsonFile } from './utils/generic.js';
import { getPackageVersion } from './utils/version.js';
const serverJson = readJsonFile<{ description: string }>(import.meta.url, '../server.json');
/** Returns the `serverInfo` (MCP `Implementation`) advertised in the initialize response. */
export function getServerInfo(): Implementation {
return {
name: SERVER_NAME,
title: SERVER_TITLE,
version: getPackageVersion()!,
description: serverJson.description,
websiteUrl: APIFY_MCP_URL,
icons: [
{
src: APIFY_LOGO_URL,
mimeType: 'image/png',
sizes: ['180x180'],
},
],
};
}
/** Returns the MCP server card object per SEP-1649. */
export function getServerCard(): ServerCard {
return {
$schema: 'https://static.modelcontextprotocol.io/schemas/mcp-server-card/v1.json',
version: '1.0',
protocolVersion: LATEST_PROTOCOL_VERSION,
serverInfo: {
name: SERVER_NAME,
title: SERVER_TITLE,
version: getPackageVersion()!,
},
description: serverJson.description,
iconUrl: APIFY_FAVICON_URL,
documentationUrl: APIFY_DOCS_MCP_URL,
transport: {
type: 'streamable-http',
endpoint: '/',
},
capabilities: {
tools: { listChanged: true },
},
authentication: {
required: false,
schemes: ['bearer', 'oauth2'],
},
tools: 'dynamic',
};
}