atproto-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +293 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +261 -0
- package/dist/cli.js.map +1 -0
- package/dist/health-check.d.ts +7 -0
- package/dist/health-check.d.ts.map +1 -0
- package/dist/health-check.js +57 -0
- package/dist/health-check.js.map +1 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +612 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +77 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +186 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +75 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +218 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/test/setup.d.ts +78 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +138 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/tools/implementations/advanced-social-tools.d.ts +250 -0
- package/dist/tools/implementations/advanced-social-tools.d.ts.map +1 -0
- package/dist/tools/implementations/advanced-social-tools.js +380 -0
- package/dist/tools/implementations/advanced-social-tools.js.map +1 -0
- package/dist/tools/implementations/base-tool.d.ts +73 -0
- package/dist/tools/implementations/base-tool.d.ts.map +1 -0
- package/dist/tools/implementations/base-tool.js +225 -0
- package/dist/tools/implementations/base-tool.js.map +1 -0
- package/dist/tools/implementations/content-management-tools.d.ts +81 -0
- package/dist/tools/implementations/content-management-tools.d.ts.map +1 -0
- package/dist/tools/implementations/content-management-tools.js +236 -0
- package/dist/tools/implementations/content-management-tools.js.map +1 -0
- package/dist/tools/implementations/create-post-tool.d.ts +131 -0
- package/dist/tools/implementations/create-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/create-post-tool.js +182 -0
- package/dist/tools/implementations/create-post-tool.js.map +1 -0
- package/dist/tools/implementations/follow-user-tool.d.ts +69 -0
- package/dist/tools/implementations/follow-user-tool.d.ts.map +1 -0
- package/dist/tools/implementations/follow-user-tool.js +200 -0
- package/dist/tools/implementations/follow-user-tool.js.map +1 -0
- package/dist/tools/implementations/get-user-profile-tool.d.ts +61 -0
- package/dist/tools/implementations/get-user-profile-tool.d.ts.map +1 -0
- package/dist/tools/implementations/get-user-profile-tool.js +139 -0
- package/dist/tools/implementations/get-user-profile-tool.js.map +1 -0
- package/dist/tools/implementations/index.d.ts +22 -0
- package/dist/tools/implementations/index.d.ts.map +1 -0
- package/dist/tools/implementations/index.js +32 -0
- package/dist/tools/implementations/index.js.map +1 -0
- package/dist/tools/implementations/like-post-tool.d.ts +68 -0
- package/dist/tools/implementations/like-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/like-post-tool.js +184 -0
- package/dist/tools/implementations/like-post-tool.js.map +1 -0
- package/dist/tools/implementations/media-tools.d.ts +360 -0
- package/dist/tools/implementations/media-tools.d.ts.map +1 -0
- package/dist/tools/implementations/media-tools.js +444 -0
- package/dist/tools/implementations/media-tools.js.map +1 -0
- package/dist/tools/implementations/moderation-tools.d.ts +189 -0
- package/dist/tools/implementations/moderation-tools.d.ts.map +1 -0
- package/dist/tools/implementations/moderation-tools.js +289 -0
- package/dist/tools/implementations/moderation-tools.js.map +1 -0
- package/dist/tools/implementations/oauth-tools.d.ts +108 -0
- package/dist/tools/implementations/oauth-tools.d.ts.map +1 -0
- package/dist/tools/implementations/oauth-tools.js +183 -0
- package/dist/tools/implementations/oauth-tools.js.map +1 -0
- package/dist/tools/implementations/reply-to-post-tool.d.ts +52 -0
- package/dist/tools/implementations/reply-to-post-tool.d.ts.map +1 -0
- package/dist/tools/implementations/reply-to-post-tool.js +167 -0
- package/dist/tools/implementations/reply-to-post-tool.js.map +1 -0
- package/dist/tools/implementations/repost-tool.d.ts +76 -0
- package/dist/tools/implementations/repost-tool.d.ts.map +1 -0
- package/dist/tools/implementations/repost-tool.js +181 -0
- package/dist/tools/implementations/repost-tool.js.map +1 -0
- package/dist/tools/implementations/search-posts-tool.d.ts +95 -0
- package/dist/tools/implementations/search-posts-tool.d.ts.map +1 -0
- package/dist/tools/implementations/search-posts-tool.js +208 -0
- package/dist/tools/implementations/search-posts-tool.js.map +1 -0
- package/dist/tools/implementations/social-graph-tools.d.ts +119 -0
- package/dist/tools/implementations/social-graph-tools.d.ts.map +1 -0
- package/dist/tools/implementations/social-graph-tools.js +262 -0
- package/dist/tools/implementations/social-graph-tools.js.map +1 -0
- package/dist/tools/implementations/streaming-tools.d.ts +130 -0
- package/dist/tools/implementations/streaming-tools.d.ts.map +1 -0
- package/dist/tools/implementations/streaming-tools.js +241 -0
- package/dist/tools/implementations/streaming-tools.js.map +1 -0
- package/dist/tools/implementations/timeline-tools.d.ts +69 -0
- package/dist/tools/implementations/timeline-tools.d.ts.map +1 -0
- package/dist/tools/implementations/timeline-tools.js +194 -0
- package/dist/tools/implementations/timeline-tools.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +73 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types/index.d.ts +242 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +73 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/atp-client.d.ts +109 -0
- package/dist/utils/atp-client.d.ts.map +1 -0
- package/dist/utils/atp-client.js +451 -0
- package/dist/utils/atp-client.js.map +1 -0
- package/dist/utils/config.d.ts +74 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +311 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/firehose-client.d.ts +96 -0
- package/dist/utils/firehose-client.d.ts.map +1 -0
- package/dist/utils/firehose-client.js +252 -0
- package/dist/utils/firehose-client.js.map +1 -0
- package/dist/utils/logger.d.ts +74 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +142 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/oauth-client.d.ts +61 -0
- package/dist/utils/oauth-client.d.ts.map +1 -0
- package/dist/utils/oauth-client.js +224 -0
- package/dist/utils/oauth-client.js.map +1 -0
- package/dist/utils/performance.d.ts +102 -0
- package/dist/utils/performance.d.ts.map +1 -0
- package/dist/utils/performance.js +302 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/security.d.ts +154 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +358 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +93 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AT Protocol MCP Server
|
|
4
|
+
*
|
|
5
|
+
* A comprehensive Model Context Protocol server that provides LLMs with direct access
|
|
6
|
+
* to the AT Protocol ecosystem, enabling seamless interaction with Bluesky and other
|
|
7
|
+
* AT Protocol-based social networks.
|
|
8
|
+
*/
|
|
9
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
10
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { ConfigurationError, McpError } from './types/index.js';
|
|
13
|
+
import { AtpClient } from './utils/atp-client.js';
|
|
14
|
+
import { Logger } from './utils/logger.js';
|
|
15
|
+
import { ConfigManager } from './utils/config.js';
|
|
16
|
+
import { createTools } from './tools/index.js';
|
|
17
|
+
import { createResources } from './resources/index.js';
|
|
18
|
+
import { createPrompts } from './prompts/index.js';
|
|
19
|
+
import { ConnectionPool, LRUCache, PerformanceMonitor, WebSocketManager, } from './utils/performance.js';
|
|
20
|
+
import { SecurityManager } from './utils/security.js';
|
|
21
|
+
/**
|
|
22
|
+
* Main server class for AT Protocol MCP Server
|
|
23
|
+
*/
|
|
24
|
+
export class AtpMcpServer {
|
|
25
|
+
server;
|
|
26
|
+
atpClient;
|
|
27
|
+
logger;
|
|
28
|
+
configManager;
|
|
29
|
+
connectionPool;
|
|
30
|
+
cache;
|
|
31
|
+
wsManager;
|
|
32
|
+
performanceMonitor;
|
|
33
|
+
securityManager;
|
|
34
|
+
metricsInterval;
|
|
35
|
+
transport = null;
|
|
36
|
+
isRunning = false;
|
|
37
|
+
constructor(configOverrides = {}) {
|
|
38
|
+
this.logger = new Logger('AtpMcpServer');
|
|
39
|
+
try {
|
|
40
|
+
// Initialize configuration
|
|
41
|
+
this.configManager = new ConfigManager(configOverrides);
|
|
42
|
+
const config = this.configManager.getConfig();
|
|
43
|
+
// Initialize MCP server
|
|
44
|
+
this.server = new Server({
|
|
45
|
+
name: config.name,
|
|
46
|
+
version: config.version,
|
|
47
|
+
}, {
|
|
48
|
+
capabilities: {
|
|
49
|
+
tools: {},
|
|
50
|
+
resources: {},
|
|
51
|
+
prompts: {},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
// Initialize AT Protocol client
|
|
55
|
+
this.atpClient = new AtpClient(this.configManager.getAtpConfig());
|
|
56
|
+
// Initialize performance components
|
|
57
|
+
const connectionPoolConfig = {
|
|
58
|
+
maxConnections: 10,
|
|
59
|
+
minConnections: 2,
|
|
60
|
+
acquireTimeoutMs: 5000,
|
|
61
|
+
idleTimeoutMs: 300000, // 5 minutes
|
|
62
|
+
maxRetries: 3,
|
|
63
|
+
};
|
|
64
|
+
const cacheConfig = {
|
|
65
|
+
maxSize: 1000,
|
|
66
|
+
ttlMs: 300000, // 5 minutes
|
|
67
|
+
cleanupIntervalMs: 60000, // 1 minute
|
|
68
|
+
};
|
|
69
|
+
this.connectionPool = new ConnectionPool(connectionPoolConfig, this.logger);
|
|
70
|
+
this.cache = new LRUCache(cacheConfig, this.logger);
|
|
71
|
+
this.wsManager = new WebSocketManager(this.logger);
|
|
72
|
+
this.performanceMonitor = new PerformanceMonitor(this.logger);
|
|
73
|
+
// Initialize security manager
|
|
74
|
+
const securityConfig = {
|
|
75
|
+
enableInputSanitization: true,
|
|
76
|
+
enableRateLimit: true,
|
|
77
|
+
enableErrorSanitization: true,
|
|
78
|
+
maxInputLength: 10000,
|
|
79
|
+
allowedOrigins: ['*'], // Configure based on deployment
|
|
80
|
+
trustedProxies: [], // Configure based on deployment
|
|
81
|
+
};
|
|
82
|
+
this.securityManager = new SecurityManager(securityConfig, this.logger);
|
|
83
|
+
// Configure performance monitor
|
|
84
|
+
this.performanceMonitor.setConnectionPool(this.connectionPool);
|
|
85
|
+
this.performanceMonitor.setCache(this.cache);
|
|
86
|
+
this.performanceMonitor.setWebSocketManager(this.wsManager);
|
|
87
|
+
// Setup server handlers
|
|
88
|
+
this.setupServer();
|
|
89
|
+
this.logger.info('AT Protocol MCP Server initialized', {
|
|
90
|
+
name: config.name,
|
|
91
|
+
version: config.version,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
this.logger.error('Failed to initialize AT Protocol MCP Server', error);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Set up the MCP server with basic handlers
|
|
101
|
+
* Register tools, resources, and prompts with the MCP server
|
|
102
|
+
*/
|
|
103
|
+
setupServer() {
|
|
104
|
+
this.logger.info('Setting up MCP server handlers...');
|
|
105
|
+
// Set up basic MCP protocol handlers
|
|
106
|
+
this.setupBasicHandlers();
|
|
107
|
+
// Create and register tools, resources, and prompts
|
|
108
|
+
const tools = createTools(this.atpClient);
|
|
109
|
+
const resources = createResources(this.atpClient);
|
|
110
|
+
const prompts = createPrompts(this.atpClient);
|
|
111
|
+
// CRITICAL FIX: Register all tools with the MCP server
|
|
112
|
+
this.registerTools(tools);
|
|
113
|
+
this.registerResources(resources);
|
|
114
|
+
this.registerPrompts(prompts);
|
|
115
|
+
this.logger.debug(`Registered ${tools.length} tools, ${resources.length} resources, ${prompts.length} prompts`);
|
|
116
|
+
this.logger.info('MCP server handlers setup complete');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Set up basic MCP protocol handlers
|
|
120
|
+
*/
|
|
121
|
+
setupBasicHandlers() {
|
|
122
|
+
// Handle server info requests
|
|
123
|
+
this.server.setRequestHandler(z.object({ method: z.literal('initialize') }), async () => {
|
|
124
|
+
const config = this.configManager.getConfig();
|
|
125
|
+
return {
|
|
126
|
+
protocolVersion: '2024-11-05',
|
|
127
|
+
capabilities: {
|
|
128
|
+
tools: {
|
|
129
|
+
listChanged: true,
|
|
130
|
+
},
|
|
131
|
+
resources: {
|
|
132
|
+
subscribe: false,
|
|
133
|
+
listChanged: true,
|
|
134
|
+
},
|
|
135
|
+
prompts: {
|
|
136
|
+
listChanged: true,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
serverInfo: {
|
|
140
|
+
name: config.name,
|
|
141
|
+
version: config.version,
|
|
142
|
+
description: config.description,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
// Handle ping requests
|
|
147
|
+
this.server.setRequestHandler(z.object({ method: z.literal('ping') }), async () => ({
|
|
148
|
+
status: 'ok',
|
|
149
|
+
timestamp: new Date().toISOString(),
|
|
150
|
+
}));
|
|
151
|
+
this.logger.debug('Basic MCP handlers registered');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Register MCP tools with the server
|
|
155
|
+
*/
|
|
156
|
+
registerTools(tools) {
|
|
157
|
+
// Register tools/list handler
|
|
158
|
+
this.server.setRequestHandler(z.object({ method: z.literal('tools/list') }), async () => {
|
|
159
|
+
// Filter tools based on availability (authentication status)
|
|
160
|
+
const availableTools = tools.filter(tool => {
|
|
161
|
+
// Check if tool has isAvailable method (from BaseTool)
|
|
162
|
+
if ('isAvailable' in tool && typeof tool.isAvailable === 'function') {
|
|
163
|
+
return tool.isAvailable();
|
|
164
|
+
}
|
|
165
|
+
// Default to available for tools that don't implement availability check
|
|
166
|
+
return true;
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
tools: availableTools.map(tool => ({
|
|
170
|
+
name: tool.schema.method,
|
|
171
|
+
description: tool.schema.description,
|
|
172
|
+
inputSchema: tool.schema.params ? this.zodToJsonSchema(tool.schema.params) : undefined,
|
|
173
|
+
})),
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
// Register individual tool handlers
|
|
177
|
+
for (const tool of tools) {
|
|
178
|
+
this.server.setRequestHandler(z.object({
|
|
179
|
+
method: z.literal('tools/call'),
|
|
180
|
+
params: z.object({
|
|
181
|
+
name: z.literal(tool.schema.method),
|
|
182
|
+
arguments: z.any().optional(),
|
|
183
|
+
}),
|
|
184
|
+
}), async (request) => {
|
|
185
|
+
try {
|
|
186
|
+
// Check if tool is available before execution
|
|
187
|
+
if ('isAvailable' in tool && typeof tool.isAvailable === 'function') {
|
|
188
|
+
if (!tool.isAvailable()) {
|
|
189
|
+
const availabilityMessage = 'getAvailabilityMessage' in tool &&
|
|
190
|
+
typeof tool.getAvailabilityMessage === 'function'
|
|
191
|
+
? tool.getAvailabilityMessage()
|
|
192
|
+
: 'Tool not available';
|
|
193
|
+
throw new McpError(`Tool not available: ${availabilityMessage}`, -32603, {
|
|
194
|
+
tool: tool.schema.method,
|
|
195
|
+
availability: availabilityMessage,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const result = await tool.handler(request.params.arguments || {});
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: JSON.stringify(result, null, 2),
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
this.logger.error(`Tool ${tool.schema.method} execution failed`, error);
|
|
211
|
+
throw new McpError(`Tool execution failed: ${error instanceof Error ? error.message : 'Unknown error'}`, -32603, {
|
|
212
|
+
tool: tool.schema.method,
|
|
213
|
+
error: error instanceof Error ? error.message : String(error),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
this.logger.info(`Registered ${tools.length} MCP tools`);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Register MCP resources with the server
|
|
222
|
+
*/
|
|
223
|
+
registerResources(resources) {
|
|
224
|
+
// Register resources/list handler
|
|
225
|
+
this.server.setRequestHandler(z.object({ method: z.literal('resources/list') }), async () => ({
|
|
226
|
+
resources: resources.map(resource => ({
|
|
227
|
+
uri: resource.uri,
|
|
228
|
+
name: resource.name,
|
|
229
|
+
description: resource.description,
|
|
230
|
+
mimeType: resource.mimeType,
|
|
231
|
+
})),
|
|
232
|
+
}));
|
|
233
|
+
// Register resources/read handler
|
|
234
|
+
this.server.setRequestHandler(z.object({
|
|
235
|
+
method: z.literal('resources/read'),
|
|
236
|
+
params: z.object({
|
|
237
|
+
uri: z.string(),
|
|
238
|
+
}),
|
|
239
|
+
}), async (request) => {
|
|
240
|
+
try {
|
|
241
|
+
const resource = resources.find(r => r.uri === request.params.uri);
|
|
242
|
+
if (!resource) {
|
|
243
|
+
throw new McpError(`Resource not found: ${request.params.uri}`, -32602, {
|
|
244
|
+
uri: request.params.uri,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
// Check if resource is available
|
|
248
|
+
const isAvailable = await resource.isAvailable();
|
|
249
|
+
if (!isAvailable) {
|
|
250
|
+
throw new McpError(`Resource not available: ${request.params.uri}`, -32603, {
|
|
251
|
+
uri: request.params.uri,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const content = await resource.read();
|
|
255
|
+
return {
|
|
256
|
+
contents: [
|
|
257
|
+
{
|
|
258
|
+
uri: content.uri,
|
|
259
|
+
mimeType: content.mimeType,
|
|
260
|
+
text: content.text ?? '',
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
this.logger.error(`Resource read failed`, error);
|
|
267
|
+
throw new McpError(`Resource read failed: ${error instanceof Error ? error.message : 'Unknown error'}`, -32603, {
|
|
268
|
+
uri: request.params.uri,
|
|
269
|
+
error: error instanceof Error ? error.message : String(error),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
this.logger.info(`Registered ${resources.length} MCP resources`);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Register MCP prompts with the server
|
|
277
|
+
*/
|
|
278
|
+
registerPrompts(prompts) {
|
|
279
|
+
// Register prompts/list handler
|
|
280
|
+
this.server.setRequestHandler(z.object({ method: z.literal('prompts/list') }), async () => ({
|
|
281
|
+
prompts: prompts.map(prompt => ({
|
|
282
|
+
name: prompt.name,
|
|
283
|
+
description: prompt.description,
|
|
284
|
+
arguments: prompt.arguments ?? [],
|
|
285
|
+
})),
|
|
286
|
+
}));
|
|
287
|
+
// Register prompts/get handler
|
|
288
|
+
this.server.setRequestHandler(z.object({
|
|
289
|
+
method: z.literal('prompts/get'),
|
|
290
|
+
params: z.object({
|
|
291
|
+
name: z.string(),
|
|
292
|
+
arguments: z.record(z.any()).optional(),
|
|
293
|
+
}),
|
|
294
|
+
}), async (request) => {
|
|
295
|
+
try {
|
|
296
|
+
const prompt = prompts.find(p => p.name === request.params.name);
|
|
297
|
+
if (!prompt) {
|
|
298
|
+
throw new McpError(`Prompt not found: ${request.params.name}`, -32602, {
|
|
299
|
+
name: request.params.name,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
// Check if prompt is available
|
|
303
|
+
const isAvailable = prompt.isAvailable();
|
|
304
|
+
if (!isAvailable) {
|
|
305
|
+
throw new McpError(`Prompt not available: ${request.params.name}`, -32603, {
|
|
306
|
+
name: request.params.name,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
const messages = await prompt.get(request.params.arguments ?? {});
|
|
310
|
+
return { messages };
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
this.logger.error(`Prompt generation failed`, error);
|
|
314
|
+
throw new McpError(`Prompt generation failed: ${error instanceof Error ? error.message : 'Unknown error'}`, -32603, {
|
|
315
|
+
name: request.params.name,
|
|
316
|
+
error: error instanceof Error ? error.message : String(error),
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
this.logger.info(`Registered ${prompts.length} MCP prompts`);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Convert Zod schema to JSON Schema for MCP compatibility
|
|
324
|
+
*/
|
|
325
|
+
zodToJsonSchema(schema) {
|
|
326
|
+
// Handle ZodOptional wrapper first
|
|
327
|
+
if (schema instanceof z.ZodOptional) {
|
|
328
|
+
return this.zodToJsonSchema(schema._def.innerType);
|
|
329
|
+
}
|
|
330
|
+
// Handle ZodObject
|
|
331
|
+
if (schema instanceof z.ZodObject) {
|
|
332
|
+
const shape = schema.shape;
|
|
333
|
+
const properties = {};
|
|
334
|
+
const required = [];
|
|
335
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
336
|
+
const zodValue = value;
|
|
337
|
+
const isOptional = zodValue.isOptional();
|
|
338
|
+
// Recursively convert the property schema
|
|
339
|
+
properties[key] = this.zodToJsonSchema(zodValue);
|
|
340
|
+
if (!isOptional) {
|
|
341
|
+
required.push(key);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return {
|
|
345
|
+
type: 'object',
|
|
346
|
+
properties,
|
|
347
|
+
required: required.length > 0 ? required : undefined,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
// Handle ZodString
|
|
351
|
+
if (schema instanceof z.ZodString) {
|
|
352
|
+
const stringSchema = { type: 'string' };
|
|
353
|
+
// Add string constraints
|
|
354
|
+
if (schema._def.checks) {
|
|
355
|
+
for (const check of schema._def.checks) {
|
|
356
|
+
if (check.kind === 'min')
|
|
357
|
+
stringSchema.minLength = check.value;
|
|
358
|
+
if (check.kind === 'max')
|
|
359
|
+
stringSchema.maxLength = check.value;
|
|
360
|
+
if (check.kind === 'regex')
|
|
361
|
+
stringSchema.pattern = check.regex.source;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return stringSchema;
|
|
365
|
+
}
|
|
366
|
+
// Handle ZodNumber
|
|
367
|
+
if (schema instanceof z.ZodNumber) {
|
|
368
|
+
const numberSchema = { type: 'number' };
|
|
369
|
+
// Add number constraints
|
|
370
|
+
if (schema._def.checks) {
|
|
371
|
+
for (const check of schema._def.checks) {
|
|
372
|
+
if (check.kind === 'min')
|
|
373
|
+
numberSchema.minimum = check.value;
|
|
374
|
+
if (check.kind === 'max')
|
|
375
|
+
numberSchema.maximum = check.value;
|
|
376
|
+
if (check.kind === 'int')
|
|
377
|
+
numberSchema.type = 'integer';
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return numberSchema;
|
|
381
|
+
}
|
|
382
|
+
// Handle ZodBoolean
|
|
383
|
+
if (schema instanceof z.ZodBoolean) {
|
|
384
|
+
return { type: 'boolean' };
|
|
385
|
+
}
|
|
386
|
+
// Handle ZodArray
|
|
387
|
+
if (schema instanceof z.ZodArray) {
|
|
388
|
+
const arraySchema = { type: 'array' };
|
|
389
|
+
// Add array item type if available
|
|
390
|
+
if (schema._def.type) {
|
|
391
|
+
arraySchema.items = this.zodToJsonSchema(schema._def.type);
|
|
392
|
+
}
|
|
393
|
+
return arraySchema;
|
|
394
|
+
}
|
|
395
|
+
// Handle ZodEnum
|
|
396
|
+
if (schema instanceof z.ZodEnum) {
|
|
397
|
+
return {
|
|
398
|
+
type: 'string',
|
|
399
|
+
enum: schema._def.values,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
// Handle ZodUnion
|
|
403
|
+
if (schema instanceof z.ZodUnion) {
|
|
404
|
+
return {
|
|
405
|
+
anyOf: schema._def.options.map((option) => this.zodToJsonSchema(option)),
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
// Handle ZodAny and other unknown types
|
|
409
|
+
if (schema instanceof z.ZodAny) {
|
|
410
|
+
return { type: 'object' };
|
|
411
|
+
}
|
|
412
|
+
// Default fallback
|
|
413
|
+
return { type: 'object' };
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Start the MCP server
|
|
417
|
+
*/
|
|
418
|
+
async start() {
|
|
419
|
+
if (this.isRunning) {
|
|
420
|
+
this.logger.warn('Server is already running');
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
try {
|
|
424
|
+
this.logger.info('Starting AT Protocol MCP Server...');
|
|
425
|
+
const config = this.configManager.getConfig();
|
|
426
|
+
// Initialize AT Protocol client (supports both authenticated and unauthenticated modes)
|
|
427
|
+
try {
|
|
428
|
+
await this.atpClient.initialize();
|
|
429
|
+
if (this.atpClient.isAuthenticated()) {
|
|
430
|
+
this.logger.info('AT Protocol client initialized successfully with authentication');
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
this.logger.info('AT Protocol client initialized successfully in unauthenticated mode');
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
// If authentication fails but we can still run in unauthenticated mode, continue
|
|
438
|
+
if (this.configManager.hasAuthentication()) {
|
|
439
|
+
this.logger.error('Authentication failed, but continuing in unauthenticated mode', error);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
this.logger.info('Running in unauthenticated mode (no credentials provided)');
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
// Create and connect transport
|
|
446
|
+
this.transport = new StdioServerTransport();
|
|
447
|
+
await this.server.connect(this.transport);
|
|
448
|
+
this.isRunning = true;
|
|
449
|
+
// Start performance monitoring
|
|
450
|
+
this.metricsInterval = this.performanceMonitor.startPeriodicLogging(60000); // Log every minute
|
|
451
|
+
this.logger.info('AT Protocol MCP Server started successfully', {
|
|
452
|
+
name: config.name,
|
|
453
|
+
version: config.version,
|
|
454
|
+
service: config.atproto.service,
|
|
455
|
+
authMethod: config.atproto.authMethod ?? 'unauthenticated',
|
|
456
|
+
authMode: this.configManager.getAuthMode(),
|
|
457
|
+
isAuthenticated: this.atpClient.isAuthenticated(),
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
this.logger.error('Failed to start AT Protocol MCP Server', error);
|
|
462
|
+
// Cleanup on failure
|
|
463
|
+
await this.cleanup();
|
|
464
|
+
if (error instanceof ConfigurationError) {
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
467
|
+
throw new McpError('Server startup failed', -32000, error instanceof Error ? error.message : 'Unknown error');
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Stop the MCP server
|
|
472
|
+
*/
|
|
473
|
+
async stop() {
|
|
474
|
+
if (!this.isRunning) {
|
|
475
|
+
this.logger.warn('Server is not running');
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this.logger.info('Stopping AT Protocol MCP Server...');
|
|
479
|
+
await this.cleanup();
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Cleanup server resources
|
|
483
|
+
*/
|
|
484
|
+
async cleanup() {
|
|
485
|
+
const errors = [];
|
|
486
|
+
try {
|
|
487
|
+
// Stop performance monitoring
|
|
488
|
+
if (this.metricsInterval) {
|
|
489
|
+
clearInterval(this.metricsInterval);
|
|
490
|
+
this.metricsInterval = undefined;
|
|
491
|
+
}
|
|
492
|
+
// Cleanup performance components
|
|
493
|
+
this.wsManager.disconnectAll();
|
|
494
|
+
this.cache.clear();
|
|
495
|
+
this.connectionPool.cleanup();
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
499
|
+
}
|
|
500
|
+
try {
|
|
501
|
+
// Cleanup AT Protocol client
|
|
502
|
+
await this.atpClient.cleanup();
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
// Close MCP server
|
|
509
|
+
await this.server.close();
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
513
|
+
}
|
|
514
|
+
this.isRunning = false;
|
|
515
|
+
this.transport = null;
|
|
516
|
+
if (errors.length > 0) {
|
|
517
|
+
this.logger.error('Errors during cleanup', { errors: errors.map(e => e.message) });
|
|
518
|
+
throw errors[0];
|
|
519
|
+
}
|
|
520
|
+
this.logger.info('AT Protocol MCP Server stopped successfully');
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Get server status
|
|
524
|
+
*/
|
|
525
|
+
getStatus() {
|
|
526
|
+
return {
|
|
527
|
+
isRunning: this.isRunning,
|
|
528
|
+
isAuthenticated: this.atpClient.isAuthenticated(),
|
|
529
|
+
authMode: this.configManager.getAuthMode(),
|
|
530
|
+
hasAuthentication: this.configManager.hasAuthentication(),
|
|
531
|
+
config: this.configManager.getConfig(),
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Get AT Protocol client instance
|
|
536
|
+
*/
|
|
537
|
+
getAtpClient() {
|
|
538
|
+
return this.atpClient;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Get configuration manager
|
|
542
|
+
*/
|
|
543
|
+
getConfigManager() {
|
|
544
|
+
return this.configManager;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Get performance metrics
|
|
548
|
+
*/
|
|
549
|
+
getPerformanceMetrics() {
|
|
550
|
+
return this.performanceMonitor.getMetrics();
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Get cache instance for external use
|
|
554
|
+
*/
|
|
555
|
+
getCache() {
|
|
556
|
+
return this.cache;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Get connection pool instance for external use
|
|
560
|
+
*/
|
|
561
|
+
getConnectionPool() {
|
|
562
|
+
return this.connectionPool;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Get WebSocket manager instance for external use
|
|
566
|
+
*/
|
|
567
|
+
getWebSocketManager() {
|
|
568
|
+
return this.wsManager;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Get security manager instance for external use
|
|
572
|
+
*/
|
|
573
|
+
getSecurityManager() {
|
|
574
|
+
return this.securityManager;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Get comprehensive system metrics including performance and security
|
|
578
|
+
*/
|
|
579
|
+
getSystemMetrics() {
|
|
580
|
+
return {
|
|
581
|
+
performance: this.getPerformanceMetrics(),
|
|
582
|
+
security: this.securityManager.getMetrics(),
|
|
583
|
+
server: this.getStatus(),
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Create and start the server if this file is run directly
|
|
589
|
+
*/
|
|
590
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
591
|
+
const server = new AtpMcpServer();
|
|
592
|
+
// Handle graceful shutdown
|
|
593
|
+
process.on('SIGINT', () => {
|
|
594
|
+
console.log('\nReceived SIGINT, shutting down gracefully...');
|
|
595
|
+
void server.stop().then(() => {
|
|
596
|
+
process.exit(0);
|
|
597
|
+
});
|
|
598
|
+
});
|
|
599
|
+
process.on('SIGTERM', () => {
|
|
600
|
+
console.log('\nReceived SIGTERM, shutting down gracefully...');
|
|
601
|
+
void server.stop().then(() => {
|
|
602
|
+
process.exit(0);
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
// Start the server
|
|
606
|
+
server.start().catch(error => {
|
|
607
|
+
console.error('Failed to start server:', error);
|
|
608
|
+
process.exit(1);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
export default AtpMcpServer;
|
|
612
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,MAA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