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.
Files changed (131) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +293 -0
  3. package/dist/cli.d.ts +10 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +261 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/health-check.d.ts +7 -0
  8. package/dist/health-check.d.ts.map +1 -0
  9. package/dist/health-check.js +57 -0
  10. package/dist/health-check.js.map +1 -0
  11. package/dist/index.d.ts +122 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +612 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/prompts/index.d.ts +77 -0
  16. package/dist/prompts/index.d.ts.map +1 -0
  17. package/dist/prompts/index.js +186 -0
  18. package/dist/prompts/index.js.map +1 -0
  19. package/dist/resources/index.d.ts +75 -0
  20. package/dist/resources/index.d.ts.map +1 -0
  21. package/dist/resources/index.js +218 -0
  22. package/dist/resources/index.js.map +1 -0
  23. package/dist/test/setup.d.ts +78 -0
  24. package/dist/test/setup.d.ts.map +1 -0
  25. package/dist/test/setup.js +138 -0
  26. package/dist/test/setup.js.map +1 -0
  27. package/dist/tools/implementations/advanced-social-tools.d.ts +250 -0
  28. package/dist/tools/implementations/advanced-social-tools.d.ts.map +1 -0
  29. package/dist/tools/implementations/advanced-social-tools.js +380 -0
  30. package/dist/tools/implementations/advanced-social-tools.js.map +1 -0
  31. package/dist/tools/implementations/base-tool.d.ts +73 -0
  32. package/dist/tools/implementations/base-tool.d.ts.map +1 -0
  33. package/dist/tools/implementations/base-tool.js +225 -0
  34. package/dist/tools/implementations/base-tool.js.map +1 -0
  35. package/dist/tools/implementations/content-management-tools.d.ts +81 -0
  36. package/dist/tools/implementations/content-management-tools.d.ts.map +1 -0
  37. package/dist/tools/implementations/content-management-tools.js +236 -0
  38. package/dist/tools/implementations/content-management-tools.js.map +1 -0
  39. package/dist/tools/implementations/create-post-tool.d.ts +131 -0
  40. package/dist/tools/implementations/create-post-tool.d.ts.map +1 -0
  41. package/dist/tools/implementations/create-post-tool.js +182 -0
  42. package/dist/tools/implementations/create-post-tool.js.map +1 -0
  43. package/dist/tools/implementations/follow-user-tool.d.ts +69 -0
  44. package/dist/tools/implementations/follow-user-tool.d.ts.map +1 -0
  45. package/dist/tools/implementations/follow-user-tool.js +200 -0
  46. package/dist/tools/implementations/follow-user-tool.js.map +1 -0
  47. package/dist/tools/implementations/get-user-profile-tool.d.ts +61 -0
  48. package/dist/tools/implementations/get-user-profile-tool.d.ts.map +1 -0
  49. package/dist/tools/implementations/get-user-profile-tool.js +139 -0
  50. package/dist/tools/implementations/get-user-profile-tool.js.map +1 -0
  51. package/dist/tools/implementations/index.d.ts +22 -0
  52. package/dist/tools/implementations/index.d.ts.map +1 -0
  53. package/dist/tools/implementations/index.js +32 -0
  54. package/dist/tools/implementations/index.js.map +1 -0
  55. package/dist/tools/implementations/like-post-tool.d.ts +68 -0
  56. package/dist/tools/implementations/like-post-tool.d.ts.map +1 -0
  57. package/dist/tools/implementations/like-post-tool.js +184 -0
  58. package/dist/tools/implementations/like-post-tool.js.map +1 -0
  59. package/dist/tools/implementations/media-tools.d.ts +360 -0
  60. package/dist/tools/implementations/media-tools.d.ts.map +1 -0
  61. package/dist/tools/implementations/media-tools.js +444 -0
  62. package/dist/tools/implementations/media-tools.js.map +1 -0
  63. package/dist/tools/implementations/moderation-tools.d.ts +189 -0
  64. package/dist/tools/implementations/moderation-tools.d.ts.map +1 -0
  65. package/dist/tools/implementations/moderation-tools.js +289 -0
  66. package/dist/tools/implementations/moderation-tools.js.map +1 -0
  67. package/dist/tools/implementations/oauth-tools.d.ts +108 -0
  68. package/dist/tools/implementations/oauth-tools.d.ts.map +1 -0
  69. package/dist/tools/implementations/oauth-tools.js +183 -0
  70. package/dist/tools/implementations/oauth-tools.js.map +1 -0
  71. package/dist/tools/implementations/reply-to-post-tool.d.ts +52 -0
  72. package/dist/tools/implementations/reply-to-post-tool.d.ts.map +1 -0
  73. package/dist/tools/implementations/reply-to-post-tool.js +167 -0
  74. package/dist/tools/implementations/reply-to-post-tool.js.map +1 -0
  75. package/dist/tools/implementations/repost-tool.d.ts +76 -0
  76. package/dist/tools/implementations/repost-tool.d.ts.map +1 -0
  77. package/dist/tools/implementations/repost-tool.js +181 -0
  78. package/dist/tools/implementations/repost-tool.js.map +1 -0
  79. package/dist/tools/implementations/search-posts-tool.d.ts +95 -0
  80. package/dist/tools/implementations/search-posts-tool.d.ts.map +1 -0
  81. package/dist/tools/implementations/search-posts-tool.js +208 -0
  82. package/dist/tools/implementations/search-posts-tool.js.map +1 -0
  83. package/dist/tools/implementations/social-graph-tools.d.ts +119 -0
  84. package/dist/tools/implementations/social-graph-tools.d.ts.map +1 -0
  85. package/dist/tools/implementations/social-graph-tools.js +262 -0
  86. package/dist/tools/implementations/social-graph-tools.js.map +1 -0
  87. package/dist/tools/implementations/streaming-tools.d.ts +130 -0
  88. package/dist/tools/implementations/streaming-tools.d.ts.map +1 -0
  89. package/dist/tools/implementations/streaming-tools.js +241 -0
  90. package/dist/tools/implementations/streaming-tools.js.map +1 -0
  91. package/dist/tools/implementations/timeline-tools.d.ts +69 -0
  92. package/dist/tools/implementations/timeline-tools.d.ts.map +1 -0
  93. package/dist/tools/implementations/timeline-tools.js +194 -0
  94. package/dist/tools/implementations/timeline-tools.js.map +1 -0
  95. package/dist/tools/index.d.ts +23 -0
  96. package/dist/tools/index.d.ts.map +1 -0
  97. package/dist/tools/index.js +73 -0
  98. package/dist/tools/index.js.map +1 -0
  99. package/dist/types/index.d.ts +242 -0
  100. package/dist/types/index.d.ts.map +1 -0
  101. package/dist/types/index.js +73 -0
  102. package/dist/types/index.js.map +1 -0
  103. package/dist/utils/atp-client.d.ts +109 -0
  104. package/dist/utils/atp-client.d.ts.map +1 -0
  105. package/dist/utils/atp-client.js +451 -0
  106. package/dist/utils/atp-client.js.map +1 -0
  107. package/dist/utils/config.d.ts +74 -0
  108. package/dist/utils/config.d.ts.map +1 -0
  109. package/dist/utils/config.js +311 -0
  110. package/dist/utils/config.js.map +1 -0
  111. package/dist/utils/firehose-client.d.ts +96 -0
  112. package/dist/utils/firehose-client.d.ts.map +1 -0
  113. package/dist/utils/firehose-client.js +252 -0
  114. package/dist/utils/firehose-client.js.map +1 -0
  115. package/dist/utils/logger.d.ts +74 -0
  116. package/dist/utils/logger.d.ts.map +1 -0
  117. package/dist/utils/logger.js +142 -0
  118. package/dist/utils/logger.js.map +1 -0
  119. package/dist/utils/oauth-client.d.ts +61 -0
  120. package/dist/utils/oauth-client.d.ts.map +1 -0
  121. package/dist/utils/oauth-client.js +224 -0
  122. package/dist/utils/oauth-client.js.map +1 -0
  123. package/dist/utils/performance.d.ts +102 -0
  124. package/dist/utils/performance.d.ts.map +1 -0
  125. package/dist/utils/performance.js +302 -0
  126. package/dist/utils/performance.js.map +1 -0
  127. package/dist/utils/security.d.ts +154 -0
  128. package/dist/utils/security.d.ts.map +1 -0
  129. package/dist/utils/security.js +358 -0
  130. package/dist/utils/security.js.map +1 -0
  131. package/package.json +93 -0
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Security utilities for production deployment
3
+ */
4
+ /**
5
+ * Input sanitizer to prevent injection attacks
6
+ */
7
+ export class InputSanitizer {
8
+ logger;
9
+ maxLength;
10
+ constructor(maxLength, logger) {
11
+ this.maxLength = maxLength;
12
+ this.logger = logger;
13
+ }
14
+ /**
15
+ * Sanitize string input by removing potentially dangerous characters
16
+ */
17
+ sanitizeString(input) {
18
+ if (typeof input !== 'string') {
19
+ throw new Error('Input must be a string');
20
+ }
21
+ if (input.length > this.maxLength) {
22
+ this.logger.warn('Input length exceeded maximum', {
23
+ length: input.length,
24
+ maxLength: this.maxLength,
25
+ });
26
+ throw new Error(`Input length exceeds maximum of ${this.maxLength} characters`);
27
+ }
28
+ // Remove potentially dangerous characters
29
+ let sanitized = input
30
+ .replace(/[<>]/g, '') // Remove HTML tags
31
+ .replace(/javascript:/gi, '') // Remove javascript: protocol
32
+ .replace(/data:/gi, '') // Remove data: protocol
33
+ .replace(/vbscript:/gi, '') // Remove vbscript: protocol
34
+ .replace(/on\w+\s*=/gi, '') // Remove event handlers
35
+ .replace(/\0/g, ''); // Remove null bytes
36
+ // Normalize whitespace
37
+ sanitized = sanitized.replace(/\s+/g, ' ').trim();
38
+ return sanitized;
39
+ }
40
+ /**
41
+ * Sanitize object by recursively sanitizing all string values
42
+ */
43
+ sanitizeObject(obj) {
44
+ if (obj === null || obj === undefined) {
45
+ return obj;
46
+ }
47
+ if (typeof obj === 'string') {
48
+ return this.sanitizeString(obj);
49
+ }
50
+ if (Array.isArray(obj)) {
51
+ return obj.map(item => this.sanitizeObject(item));
52
+ }
53
+ if (typeof obj === 'object') {
54
+ const sanitized = {};
55
+ for (const [key, value] of Object.entries(obj)) {
56
+ const sanitizedKey = this.sanitizeString(key);
57
+ sanitized[sanitizedKey] = this.sanitizeObject(value);
58
+ }
59
+ return sanitized;
60
+ }
61
+ return obj;
62
+ }
63
+ /**
64
+ * Validate AT Protocol identifiers (DIDs, handles, etc.)
65
+ */
66
+ validateAtProtoIdentifier(identifier) {
67
+ if (!identifier || typeof identifier !== 'string') {
68
+ return false;
69
+ }
70
+ // DID format: did:method:identifier
71
+ if (identifier.startsWith('did:')) {
72
+ return /^did:[a-z0-9]+:[a-zA-Z0-9._-]+$/.test(identifier);
73
+ }
74
+ // Handle format: user.domain.tld
75
+ if (identifier.includes('.')) {
76
+ return /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(identifier);
77
+ }
78
+ return false;
79
+ }
80
+ /**
81
+ * Validate URI format
82
+ */
83
+ validateUri(uri) {
84
+ try {
85
+ const url = new URL(uri);
86
+ return ['http:', 'https:', 'at:'].includes(url.protocol);
87
+ }
88
+ catch {
89
+ return false;
90
+ }
91
+ }
92
+ }
93
+ /**
94
+ * Rate limiter to prevent abuse
95
+ */
96
+ export class RateLimiter {
97
+ requests = new Map();
98
+ config;
99
+ logger;
100
+ constructor(config, logger) {
101
+ this.config = config;
102
+ this.logger = logger;
103
+ // Clean up old entries periodically
104
+ setInterval(() => this.cleanup(), this.config.windowMs);
105
+ }
106
+ /**
107
+ * Check if request is allowed for the given identifier
108
+ */
109
+ isAllowed(identifier) {
110
+ const now = Date.now();
111
+ const windowStart = now - this.config.windowMs;
112
+ // Get existing requests for this identifier
113
+ const userRequests = this.requests.get(identifier) || [];
114
+ // Filter out requests outside the current window
115
+ const recentRequests = userRequests.filter(timestamp => timestamp > windowStart);
116
+ // Check if limit exceeded
117
+ if (recentRequests.length >= this.config.maxRequests) {
118
+ this.logger.warn('Rate limit exceeded', {
119
+ identifier,
120
+ requests: recentRequests.length,
121
+ limit: this.config.maxRequests,
122
+ });
123
+ return false;
124
+ }
125
+ // Add current request
126
+ recentRequests.push(now);
127
+ this.requests.set(identifier, recentRequests);
128
+ return true;
129
+ }
130
+ /**
131
+ * Get remaining requests for identifier
132
+ */
133
+ getRemaining(identifier) {
134
+ const now = Date.now();
135
+ const windowStart = now - this.config.windowMs;
136
+ const userRequests = this.requests.get(identifier) || [];
137
+ const recentRequests = userRequests.filter(timestamp => timestamp > windowStart);
138
+ return Math.max(0, this.config.maxRequests - recentRequests.length);
139
+ }
140
+ /**
141
+ * Get reset time for identifier
142
+ */
143
+ getResetTime(identifier) {
144
+ const userRequests = this.requests.get(identifier) || [];
145
+ if (userRequests.length === 0) {
146
+ return Date.now();
147
+ }
148
+ const oldestRequest = Math.min(...userRequests);
149
+ return oldestRequest + this.config.windowMs;
150
+ }
151
+ /**
152
+ * Clean up old entries
153
+ */
154
+ cleanup() {
155
+ const now = Date.now();
156
+ const windowStart = now - this.config.windowMs;
157
+ for (const [identifier, requests] of this.requests.entries()) {
158
+ const recentRequests = requests.filter(timestamp => timestamp > windowStart);
159
+ if (recentRequests.length === 0) {
160
+ this.requests.delete(identifier);
161
+ }
162
+ else {
163
+ this.requests.set(identifier, recentRequests);
164
+ }
165
+ }
166
+ }
167
+ /**
168
+ * Get rate limiter metrics
169
+ */
170
+ getMetrics() {
171
+ return {
172
+ trackedIdentifiers: this.requests.size,
173
+ totalRequests: Array.from(this.requests.values()).reduce((sum, requests) => sum + requests.length, 0),
174
+ };
175
+ }
176
+ }
177
+ /**
178
+ * Error sanitizer to prevent information leakage
179
+ */
180
+ export class ErrorSanitizer {
181
+ logger;
182
+ isDevelopment;
183
+ constructor(logger, isDevelopment = false) {
184
+ this.logger = logger;
185
+ this.isDevelopment = isDevelopment;
186
+ }
187
+ /**
188
+ * Sanitize error for client response
189
+ */
190
+ sanitizeError(error) {
191
+ // Log the full error for debugging
192
+ this.logger.error('Error occurred', error);
193
+ // In development, return more detailed errors
194
+ if (this.isDevelopment) {
195
+ return {
196
+ message: error.message || 'An error occurred',
197
+ code: error.code || -32000,
198
+ };
199
+ }
200
+ // In production, return generic errors to prevent information leakage
201
+ const sensitivePatterns = [
202
+ /password/i,
203
+ /token/i,
204
+ /key/i,
205
+ /secret/i,
206
+ /credential/i,
207
+ /auth/i,
208
+ /session/i,
209
+ /cookie/i,
210
+ /header/i,
211
+ /internal/i,
212
+ /database/i,
213
+ /connection/i,
214
+ /file/i,
215
+ /path/i,
216
+ ];
217
+ const errorMessage = error.message || 'An error occurred';
218
+ const containsSensitiveInfo = sensitivePatterns.some(pattern => pattern.test(errorMessage));
219
+ if (containsSensitiveInfo) {
220
+ return {
221
+ message: 'An internal error occurred',
222
+ code: -32000,
223
+ };
224
+ }
225
+ // Return sanitized error message
226
+ return {
227
+ message: errorMessage.substring(0, 200), // Limit message length
228
+ code: error.code || -32000,
229
+ };
230
+ }
231
+ /**
232
+ * Sanitize stack trace for logging
233
+ */
234
+ sanitizeStackTrace(error) {
235
+ if (!error.stack) {
236
+ return 'No stack trace available';
237
+ }
238
+ // Remove sensitive file paths and replace with generic indicators
239
+ return error.stack
240
+ .replace(/\/[^/\s]+\/[^/\s]+\/[^/\s]+/g, '/***/***/***') // Replace deep paths
241
+ .replace(/at\s+[^(]+\([^)]+\)/g, 'at *** (***:***:***)') // Replace function locations
242
+ .split('\n')
243
+ .slice(0, 10) // Limit stack trace depth
244
+ .join('\n');
245
+ }
246
+ }
247
+ /**
248
+ * Credential manager for secure storage
249
+ */
250
+ export class CredentialManager {
251
+ logger;
252
+ credentials = new Map();
253
+ constructor(logger) {
254
+ this.logger = logger;
255
+ }
256
+ /**
257
+ * Store credential securely (in production, this would use proper encryption)
258
+ */
259
+ store(key, value) {
260
+ if (!key || !value) {
261
+ throw new Error('Key and value are required');
262
+ }
263
+ // In production, this should use proper encryption
264
+ // For now, we'll just store it in memory with basic obfuscation
265
+ const obfuscated = Buffer.from(value).toString('base64');
266
+ this.credentials.set(key, obfuscated);
267
+ this.logger.debug('Credential stored', { key: `${key.substring(0, 8)}***` });
268
+ }
269
+ /**
270
+ * Retrieve credential
271
+ */
272
+ retrieve(key) {
273
+ const obfuscated = this.credentials.get(key);
274
+ if (!obfuscated) {
275
+ return undefined;
276
+ }
277
+ try {
278
+ return Buffer.from(obfuscated, 'base64').toString();
279
+ }
280
+ catch (error) {
281
+ this.logger.error('Failed to retrieve credential', error, { key });
282
+ return undefined;
283
+ }
284
+ }
285
+ /**
286
+ * Delete credential
287
+ */
288
+ delete(key) {
289
+ const deleted = this.credentials.delete(key);
290
+ if (deleted) {
291
+ this.logger.debug('Credential deleted', { key: `${key.substring(0, 8)}***` });
292
+ }
293
+ return deleted;
294
+ }
295
+ /**
296
+ * Clear all credentials
297
+ */
298
+ clear() {
299
+ this.credentials.clear();
300
+ this.logger.info('All credentials cleared');
301
+ }
302
+ /**
303
+ * Get credential count (for monitoring)
304
+ */
305
+ getCount() {
306
+ return this.credentials.size;
307
+ }
308
+ }
309
+ /**
310
+ * Security manager that coordinates all security components
311
+ */
312
+ export class SecurityManager {
313
+ inputSanitizer;
314
+ rateLimiter;
315
+ errorSanitizer;
316
+ credentialManager;
317
+ config;
318
+ logger;
319
+ constructor(config, logger) {
320
+ this.config = config;
321
+ this.logger = logger;
322
+ this.inputSanitizer = new InputSanitizer(config.maxInputLength, logger);
323
+ this.rateLimiter = new RateLimiter({
324
+ windowMs: 60000, // 1 minute
325
+ maxRequests: 100, // 100 requests per minute
326
+ }, logger);
327
+ this.errorSanitizer = new ErrorSanitizer(logger, process.env['NODE_ENV'] === 'development');
328
+ this.credentialManager = new CredentialManager(logger);
329
+ }
330
+ getInputSanitizer() {
331
+ return this.inputSanitizer;
332
+ }
333
+ getRateLimiter() {
334
+ return this.rateLimiter;
335
+ }
336
+ getErrorSanitizer() {
337
+ return this.errorSanitizer;
338
+ }
339
+ getCredentialManager() {
340
+ return this.credentialManager;
341
+ }
342
+ /**
343
+ * Get security metrics
344
+ */
345
+ getMetrics() {
346
+ return {
347
+ rateLimiter: this.rateLimiter.getMetrics(),
348
+ credentialCount: this.credentialManager.getCount(),
349
+ config: {
350
+ inputSanitizationEnabled: this.config.enableInputSanitization,
351
+ rateLimitEnabled: this.config.enableRateLimit,
352
+ errorSanitizationEnabled: this.config.enableErrorSanitization,
353
+ maxInputLength: this.config.maxInputLength,
354
+ },
355
+ };
356
+ }
357
+ }
358
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,CAAS;IACf,SAAS,CAAS;IAE1B,YAAY,SAAiB,EAAE,MAAc;QAC3C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,KAAa;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CA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AAC,iBAAiB,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;YAC1C,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;YAClD,MAAM,EAAE;gBACN,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,uBAAuB;gBAC7D,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;gBAC7C,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,uBAAuB;gBAC7D,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc;aAC3C;SACF,CAAC;IACJ,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "atproto-mcp",
3
+ "version": "0.1.0",
4
+ "packageManager": "pnpm@10.17.1",
5
+ "description": "A comprehensive MCP server for AT Protocol integration, enabling LLMs to interact directly with the AT Protocol ecosystem",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "bin": {
10
+ "atproto-mcp": "dist/cli.js"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc && chmod +x dist/cli.js",
19
+ "dev": "tsx watch src/index.ts",
20
+ "start": "node dist/index.js",
21
+ "test": "vitest",
22
+ "test:coverage": "vitest --coverage",
23
+ "test:ui": "vitest --ui",
24
+ "lint": "eslint src --ext .ts,.tsx",
25
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
26
+ "format": "prettier --write src/**/*.ts",
27
+ "format:check": "prettier --check src/**/*.ts",
28
+ "type-check": "tsc --noEmit",
29
+ "clean": "rm -rf dist",
30
+ "prepare": "husky install",
31
+ "prepublishOnly": "npm run clean && npm run build && vitest run",
32
+ "docs:dev": "vitepress dev docs",
33
+ "docs:build": "vitepress build docs",
34
+ "docs:preview": "vitepress preview docs"
35
+ },
36
+ "keywords": [
37
+ "mcp",
38
+ "model-context-protocol",
39
+ "atproto",
40
+ "at-protocol",
41
+ "bluesky",
42
+ "social-networking",
43
+ "llm",
44
+ "ai",
45
+ "typescript"
46
+ ],
47
+ "author": "Cameron Rye <cameronrye@users.noreply.github.com>",
48
+ "license": "MIT",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/cameronrye/atproto-mcp.git"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/cameronrye/atproto-mcp/issues"
55
+ },
56
+ "homepage": "https://github.com/cameronrye/atproto-mcp#readme",
57
+ "engines": {
58
+ "node": ">=20.0.0"
59
+ },
60
+ "dependencies": {
61
+ "@atproto/api": "^0.14.0",
62
+ "@modelcontextprotocol/sdk": "^1.0.0",
63
+ "@types/ws": "^8.18.1",
64
+ "ws": "^8.18.3",
65
+ "zod": "^3.22.4"
66
+ },
67
+ "devDependencies": {
68
+ "@types/node": "^20.10.0",
69
+ "@typescript-eslint/eslint-plugin": "^6.15.0",
70
+ "@typescript-eslint/parser": "^6.15.0",
71
+ "@vitest/coverage-v8": "^1.6.1",
72
+ "@vitest/ui": "^1.6.1",
73
+ "eslint": "^8.56.0",
74
+ "eslint-config-prettier": "^9.1.0",
75
+ "eslint-plugin-prettier": "^5.1.0",
76
+ "husky": "^8.0.3",
77
+ "lint-staged": "^15.2.0",
78
+ "prettier": "^3.1.1",
79
+ "tsx": "^4.6.2",
80
+ "typescript": "^5.3.3",
81
+ "vitepress": "^1.6.4",
82
+ "vitest": "^1.6.1"
83
+ },
84
+ "lint-staged": {
85
+ "*.{ts,tsx}": [
86
+ "eslint --fix",
87
+ "prettier --write"
88
+ ],
89
+ "*.{json,md}": [
90
+ "prettier --write"
91
+ ]
92
+ }
93
+ }