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
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cameron Rye
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,293 @@
1
+ # AT Protocol MCP Server
2
+
3
+ [![npm version](https://badge.fury.io/js/atproto-mcp.svg)](https://badge.fury.io/js/atproto-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
6
+ [![Tests](https://github.com/cameronrye/atproto-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/cameronrye/atproto-mcp/actions/workflows/ci.yml)
7
+ [![Coverage](https://codecov.io/gh/cameronrye/atproto-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/cameronrye/atproto-mcp)
8
+
9
+ A comprehensive Model Context Protocol (MCP) server that provides LLMs with direct access to the AT Protocol ecosystem, enabling seamless interaction with Bluesky and other AT Protocol-based social networks.
10
+
11
+ **🎯 Works out-of-the-box without authentication** - Perfect for LLM clients that need to access public AT Protocol data without requiring user accounts.
12
+
13
+ ## 🚀 Features
14
+
15
+ - **🔓 Unauthenticated Mode**: Access public data without any setup - search posts, view profiles, browse feeds
16
+ - **🔐 Optional Authentication**: Enable full functionality with app passwords or OAuth when needed
17
+ - **Complete AT Protocol Integration**: Full implementation using official `@atproto/api`
18
+ - **MCP Server Compliance**: Built with `@modelcontextprotocol/sdk` following MCP specification
19
+ - **Type-Safe**: Written in TypeScript with strict type checking
20
+ - **Comprehensive Tools**: Rich set of MCP tools for social networking operations
21
+ - **Real-time Support**: WebSocket connections for live data streams
22
+ - **Rate Limiting**: Built-in respect for AT Protocol rate limits
23
+ - **Extensible**: Modular architecture for easy customization
24
+
25
+ ## 📦 Installation
26
+
27
+ ```bash
28
+ npm install -g atproto-mcp
29
+ ```
30
+
31
+ Or use with npx:
32
+
33
+ ```bash
34
+ npx atproto-mcp
35
+ ```
36
+
37
+ ## 🔧 Quick Start
38
+
39
+ ### Option 1: Unauthenticated Mode (Recommended for most use cases)
40
+
41
+ **Perfect for LLM clients that need to access public AT Protocol data:**
42
+
43
+ 1. **Start the MCP server:**
44
+ ```bash
45
+ atproto-mcp
46
+ ```
47
+
48
+ 2. **Configure your LLM client** to connect to the MCP server
49
+
50
+ 3. **Start using public tools immediately** - no authentication required!
51
+
52
+ Available in unauthenticated mode:
53
+ - ✅ Search posts and hashtags
54
+ - ✅ View user profiles and follower lists
55
+ - ✅ Browse public feeds and threads
56
+ - ✅ Access public timelines
57
+
58
+ ### Option 2: Authenticated Mode (For full functionality)
59
+
60
+ **Enable write operations and private data access:**
61
+
62
+ 1. **Set up authentication** using environment variables:
63
+ ```bash
64
+ # App Password method (recommended)
65
+ export ATPROTO_IDENTIFIER="your-handle.bsky.social"
66
+ export ATPROTO_PASSWORD="your-app-password"
67
+
68
+ # OR OAuth method
69
+ export ATPROTO_CLIENT_ID="your-client-id"
70
+ export ATPROTO_CLIENT_SECRET="your-client-secret"
71
+ ```
72
+
73
+ 2. **Start the server:**
74
+ ```bash
75
+ atproto-mcp
76
+ ```
77
+
78
+ Additional features in authenticated mode:
79
+ - ✅ Create, edit, and delete posts
80
+ - ✅ Follow/unfollow users
81
+ - ✅ Like and repost content
82
+ - ✅ Access personalized timelines and notifications
83
+ - ✅ Manage lists and moderation settings
84
+
85
+ ## 🛠️ Available Tools
86
+
87
+ ### 🔓 Public Tools (No Authentication Required)
88
+
89
+ **Data Retrieval**
90
+ - `search_posts` - Search for posts and content across the network
91
+ - `get_user_profile` - Retrieve public user information and stats
92
+ - `get_user_profiles` - Get multiple user profiles at once
93
+ - `get_followers` - Get follower lists for public profiles
94
+ - `get_follows` - Get following lists for public profiles
95
+ - `get_thread` - View post threads and conversations
96
+ - `get_custom_feed` - Access public custom feeds
97
+
98
+ ### 🔐 Private Tools (Authentication Required)
99
+
100
+ **Social Operations**
101
+ - `create_post` - Create new posts with rich text support
102
+ - `reply_to_post` - Reply to existing posts with threading
103
+ - `like_post` / `unlike_post` - Like and unlike posts
104
+ - `repost` / `unrepost` - Repost content with optional quotes
105
+ - `follow_user` / `unfollow_user` - Follow and unfollow users
106
+ - `get_timeline` - Retrieve personalized timelines and feeds
107
+ - `get_notifications` - Access your notification feeds
108
+
109
+ **Content Management**
110
+ - `upload_image` / `upload_video` - Upload media content
111
+ - `delete_post` - Remove your posts and content
112
+ - `update_profile` - Modify your profile and settings
113
+ - `create_list` - Create and manage user lists
114
+
115
+ **Moderation**
116
+ - `mute_user` / `unmute_user` - Mute and unmute users
117
+ - `block_user` / `unblock_user` - Block and unblock users
118
+ - `report_content` / `report_user` - Report content and users
119
+
120
+ **OAuth Management**
121
+ - `start_oauth_flow` - Initiate OAuth authentication
122
+ - `handle_oauth_callback` - Complete OAuth flow
123
+ - `refresh_oauth_tokens` - Refresh authentication tokens
124
+
125
+ ## 📚 Documentation
126
+
127
+ Visit our [documentation site](https://cameronrye.github.io/atproto-mcp) for:
128
+
129
+ - **Getting Started Guide**
130
+ - **API Reference**
131
+ - **Configuration Options**
132
+ - **Examples and Tutorials**
133
+ - **Troubleshooting**
134
+
135
+ ## 🔐 Authentication (Optional)
136
+
137
+ The server works perfectly without authentication for accessing public data. Authentication is only needed for write operations and private data access.
138
+
139
+ ### App Passwords (Recommended for Development)
140
+ ```bash
141
+ export ATPROTO_IDENTIFIER="your-handle.bsky.social"
142
+ export ATPROTO_PASSWORD="your-app-password"
143
+ atproto-mcp
144
+ ```
145
+
146
+ ### OAuth (Production)
147
+ ```bash
148
+ export ATPROTO_CLIENT_ID="your-client-id"
149
+ export ATPROTO_CLIENT_SECRET="your-client-secret"
150
+ atproto-mcp --auth oauth
151
+ ```
152
+
153
+ ## 🧪 Development
154
+
155
+ ```bash
156
+ # Clone the repository
157
+ git clone https://github.com/cameronrye/atproto-mcp.git
158
+ cd atproto-mcp
159
+
160
+ # Install dependencies
161
+ npm install
162
+
163
+ # Start development server
164
+ npm run dev
165
+
166
+ # Run tests
167
+ npm test
168
+
169
+ # Build for production
170
+ npm run build
171
+ ```
172
+
173
+ ## 🤝 Contributing
174
+
175
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
176
+
177
+ 1. Fork the repository
178
+ 2. Create a feature branch
179
+ 3. Make your changes
180
+ 4. Add tests
181
+ 5. Submit a pull request
182
+
183
+ ## 📄 License
184
+
185
+ This project is licensed under the MIT License.
186
+
187
+ ## 🙏 Acknowledgments
188
+
189
+ - [AT Protocol Team](https://github.com/bluesky-social/atproto) for the excellent protocol and SDK
190
+ - [Anthropic](https://github.com/modelcontextprotocol) for the Model Context Protocol
191
+ - The open source community for inspiration and contributions
192
+
193
+ ## 📞 Support
194
+
195
+ - 📖 [Documentation](https://cameronrye.github.io/atproto-mcp)
196
+ - 🐛 [Issue Tracker](https://github.com/cameronrye/atproto-mcp/issues)
197
+ - 💬 [Discussions](https://github.com/cameronrye/atproto-mcp/discussions)
198
+
199
+ ## 🏭 Production Deployment
200
+
201
+ The AT Protocol MCP Server is production-ready with comprehensive features for enterprise deployment:
202
+
203
+ ### Production Features
204
+ - **Performance Optimization**: Connection pooling, caching, and WebSocket management
205
+ - **Security Hardening**: Input sanitization, rate limiting, and secure credential storage
206
+ - **Monitoring**: Health checks, metrics, and comprehensive logging
207
+ - **Docker Support**: Multi-stage builds with security best practices
208
+ - **Kubernetes Ready**: Helm charts and deployment manifests
209
+ - **Observability**: Prometheus metrics and Grafana dashboards
210
+
211
+ ### Docker Deployment
212
+ ```bash
213
+ # Quick start with Docker Compose
214
+ docker-compose up -d
215
+
216
+ # Or build and run manually
217
+ docker build -t atproto-mcp .
218
+ docker run -d -p 3000:3000 \
219
+ -e ATPROTO_IDENTIFIER=your.handle \
220
+ -e ATPROTO_PASSWORD=your-password \
221
+ atproto-mcp
222
+ ```
223
+
224
+ ### Environment Configuration
225
+ ```bash
226
+ # Copy example environment file
227
+ cp .env.example .env
228
+
229
+ # Edit with your credentials
230
+ ATPROTO_IDENTIFIER=your.handle.bsky.social
231
+ ATPROTO_PASSWORD=your-app-password
232
+ NODE_ENV=production
233
+ LOG_LEVEL=info
234
+ ```
235
+
236
+ For detailed deployment instructions, see [DEPLOYMENT.md](DEPLOYMENT.md).
237
+
238
+ ## 🔒 Security
239
+
240
+ Security is a top priority for this project. Please review our security practices and policies:
241
+
242
+ ### Security Best Practices
243
+
244
+ **Before deploying to production:**
245
+
246
+ 1. **Change Default Passwords**
247
+ - Set `GRAFANA_ADMIN_PASSWORD` environment variable (don't use default)
248
+ - Configure Redis password if using Redis
249
+ - Generate strong random keys for `SECURITY_SECRET_KEY`
250
+
251
+ 2. **Configure CORS Properly**
252
+ - Replace wildcard `*` origins with specific domains
253
+ - Set `CORS_ORIGINS` in your environment configuration
254
+ - Example: `CORS_ORIGINS=https://yourdomain.com,https://app.yourdomain.com`
255
+
256
+ 3. **Secure Your Credentials**
257
+ - Never commit `.env` files to version control
258
+ - Use app passwords instead of main account passwords
259
+ - Rotate credentials regularly
260
+ - Use secret management systems in production (AWS Secrets Manager, HashiCorp Vault, etc.)
261
+
262
+ 4. **Network Security**
263
+ - Use HTTPS in production
264
+ - Configure `TRUSTED_PROXIES` if behind a reverse proxy
265
+ - Enable rate limiting
266
+ - Restrict access to internal services (Redis, Prometheus, Grafana)
267
+
268
+ 5. **Keep Dependencies Updated**
269
+ ```bash
270
+ pnpm audit
271
+ pnpm update
272
+ ```
273
+
274
+ ### Reporting Security Vulnerabilities
275
+
276
+ If you discover a security vulnerability, please review our [Security Policy](SECURITY.md) for responsible disclosure guidelines.
277
+
278
+ **Do not open public issues for security vulnerabilities.** Instead, email: c@meron.io
279
+
280
+ ### Security Features
281
+
282
+ - ✅ Input validation and sanitization
283
+ - ✅ Rate limiting and abuse prevention
284
+ - ✅ Credential redaction in logs
285
+ - ✅ Non-root Docker containers
286
+ - ✅ HTTPS support for AT Protocol
287
+ - ✅ Error sanitization to prevent information leakage
288
+
289
+ For more details, see [SECURITY.md](SECURITY.md).
290
+
291
+ ---
292
+
293
+ Made with ❤️ for the AT Protocol and MCP communities
package/dist/cli.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Command-line interface for the AT Protocol MCP Server
4
+ */
5
+ /**
6
+ * Main CLI function
7
+ */
8
+ declare function main(): Promise<void>;
9
+ export { main as runCli };
10
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;GAEG;AAgOH;;GAEG;AACH,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA0DnC;AAUD,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,CAAC"}
package/dist/cli.js ADDED
@@ -0,0 +1,261 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Command-line interface for the AT Protocol MCP Server
4
+ */
5
+ import { parseArgs } from 'node:util';
6
+ import { readFileSync } from 'node:fs';
7
+ import { dirname, join } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { ConfigurationError } from './types/index.js';
10
+ import { AtpMcpServer } from './index.js';
11
+ import { LogLevel, Logger } from './utils/logger.js';
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
14
+ const logger = new Logger('CLI');
15
+ /**
16
+ * CLI argument definitions
17
+ */
18
+ const CLI_OPTIONS = {
19
+ port: {
20
+ type: 'string',
21
+ short: 'p',
22
+ description: 'Server port (default: 3000)',
23
+ },
24
+ host: {
25
+ type: 'string',
26
+ short: 'h',
27
+ description: 'Server host (default: localhost)',
28
+ },
29
+ service: {
30
+ type: 'string',
31
+ short: 's',
32
+ description: 'AT Protocol service URL (default: https://bsky.social)',
33
+ },
34
+ auth: {
35
+ type: 'string',
36
+ short: 'a',
37
+ description: 'Authentication method: app-password|oauth (optional)',
38
+ },
39
+ 'log-level': {
40
+ type: 'string',
41
+ short: 'l',
42
+ description: 'Log level: debug|info|warn|error (default: info)',
43
+ },
44
+ help: {
45
+ type: 'boolean',
46
+ description: 'Show help message',
47
+ },
48
+ version: {
49
+ type: 'boolean',
50
+ short: 'v',
51
+ description: 'Show version information',
52
+ },
53
+ };
54
+ /**
55
+ * Show help message
56
+ */
57
+ function showHelp() {
58
+ console.log(`
59
+ AT Protocol MCP Server - Comprehensive interface for LLMs to interact with AT Protocol
60
+
61
+ 🎯 Works out-of-the-box without authentication for public data access!
62
+
63
+ Usage: atproto-mcp [options]
64
+
65
+ Options:
66
+ -p, --port <number> Server port (default: 3000)
67
+ -h, --host <string> Server host (default: localhost)
68
+ -s, --service <url> AT Protocol service URL (default: https://bsky.social)
69
+ -a, --auth <method> Authentication method: app-password|oauth (optional)
70
+ -l, --log-level <level> Log level: debug|info|warn|error (default: info)
71
+ --help Show this help message
72
+ -v, --version Show version information
73
+
74
+ 🔓 Unauthenticated Mode (Default):
75
+ The server works immediately without any setup. Available features:
76
+ • Search posts and hashtags
77
+ • View user profiles and follower lists
78
+ • Browse public feeds and threads
79
+ • Access public timelines
80
+
81
+ 🔐 Authenticated Mode (Optional):
82
+ Set environment variables to enable write operations and private data:
83
+
84
+ Environment Variables:
85
+ ATPROTO_SERVICE AT Protocol service URL
86
+ ATPROTO_IDENTIFIER Your AT Protocol identifier (handle or DID)
87
+ ATPROTO_PASSWORD App password for authentication
88
+ ATPROTO_CLIENT_ID OAuth client ID
89
+ ATPROTO_CLIENT_SECRET OAuth client secret
90
+ ATPROTO_AUTH_METHOD Authentication method (app-password|oauth)
91
+ LOG_LEVEL Logging level (debug|info|warn|error)
92
+ MCP_SERVER_PORT Server port
93
+ MCP_SERVER_HOST Server host
94
+ MCP_SERVER_NAME Server name
95
+
96
+ Examples:
97
+ # Start in unauthenticated mode (works immediately!)
98
+ atproto-mcp
99
+
100
+ # Start with custom port and debug logging
101
+ atproto-mcp --port 8080 --log-level debug
102
+
103
+ # Enable authentication with app password
104
+ export ATPROTO_IDENTIFIER="your-handle.bsky.social"
105
+ export ATPROTO_PASSWORD="your-app-password"
106
+ atproto-mcp
107
+
108
+ # Enable authentication with OAuth
109
+ export ATPROTO_CLIENT_ID="your-client-id"
110
+ export ATPROTO_CLIENT_SECRET="your-client-secret"
111
+ atproto-mcp --auth oauth
112
+
113
+ For more information, visit: https://github.com/cameronrye/atproto-mcp
114
+ `);
115
+ }
116
+ /**
117
+ * Show version information
118
+ */
119
+ function showVersion() {
120
+ try {
121
+ // Read version from package.json
122
+ const packageJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
123
+ console.log(`AT Protocol MCP Server v${packageJson.version}`);
124
+ }
125
+ catch (error) {
126
+ console.log('AT Protocol MCP Server v0.1.0');
127
+ }
128
+ }
129
+ /**
130
+ * Parse command line arguments
131
+ */
132
+ function parseCliArgs() {
133
+ try {
134
+ const { values } = parseArgs({
135
+ options: CLI_OPTIONS,
136
+ allowPositionals: false,
137
+ });
138
+ // Handle help and version flags
139
+ if (values.help === true) {
140
+ showHelp();
141
+ process.exit(0);
142
+ }
143
+ if (values.version === true) {
144
+ showVersion();
145
+ process.exit(0);
146
+ }
147
+ // Set log level if provided
148
+ if (values['log-level'] != null && values['log-level'] !== '') {
149
+ const logLevel = values['log-level'].toUpperCase();
150
+ if (logLevel in LogLevel) {
151
+ process.env['LOG_LEVEL'] = logLevel;
152
+ }
153
+ else {
154
+ throw new ConfigurationError(`Invalid log level: ${values['log-level']}. Must be one of: debug, info, warn, error`);
155
+ }
156
+ }
157
+ // Build configuration from CLI arguments
158
+ const config = {};
159
+ if (values.port != null && values.port !== '') {
160
+ const port = parseInt(values.port, 10);
161
+ if (isNaN(port) || port < 1 || port > 65535) {
162
+ throw new ConfigurationError(`Invalid port: ${values.port}. Must be between 1 and 65535`);
163
+ }
164
+ config.port = port;
165
+ }
166
+ if (values.host != null && values.host !== '') {
167
+ config.host = values.host;
168
+ }
169
+ if ((values.service != null && values.service !== '') ||
170
+ (values.auth != null && values.auth !== '')) {
171
+ config.atproto = {
172
+ service: 'https://bsky.social',
173
+ authMethod: 'app-password',
174
+ };
175
+ if (values.service != null && values.service !== '') {
176
+ try {
177
+ new URL(values.service); // Validate URL
178
+ config.atproto.service = values.service;
179
+ }
180
+ catch {
181
+ throw new ConfigurationError(`Invalid service URL: ${values.service}`);
182
+ }
183
+ }
184
+ if (values.auth != null && values.auth !== '') {
185
+ if (values.auth !== 'app-password' && values.auth !== 'oauth') {
186
+ throw new ConfigurationError(`Invalid auth method: ${values.auth}. Must be 'app-password' or 'oauth'`);
187
+ }
188
+ config.atproto.authMethod = values.auth;
189
+ }
190
+ }
191
+ return config;
192
+ }
193
+ catch (error) {
194
+ if (error instanceof ConfigurationError) {
195
+ throw error;
196
+ }
197
+ logger.error('Failed to parse command line arguments', error);
198
+ throw new ConfigurationError('Invalid command line arguments. Use --help for usage information.');
199
+ }
200
+ }
201
+ /**
202
+ * Main CLI function
203
+ */
204
+ async function main() {
205
+ try {
206
+ logger.info('Starting AT Protocol MCP Server CLI');
207
+ // Parse command line arguments
208
+ const cliConfig = parseCliArgs();
209
+ // Create and start server
210
+ const server = new AtpMcpServer(cliConfig);
211
+ // Setup graceful shutdown handlers
212
+ const shutdown = async (signal) => {
213
+ logger.info(`Received ${signal}, shutting down gracefully...`);
214
+ try {
215
+ await server.stop();
216
+ process.exit(0);
217
+ }
218
+ catch (error) {
219
+ logger.error('Error during shutdown', error);
220
+ process.exit(1);
221
+ }
222
+ };
223
+ process.on('SIGINT', () => {
224
+ void shutdown('SIGINT');
225
+ });
226
+ process.on('SIGTERM', () => {
227
+ void shutdown('SIGTERM');
228
+ });
229
+ // Handle uncaught exceptions
230
+ process.on('uncaughtException', error => {
231
+ logger.error('Uncaught exception', error);
232
+ process.exit(1);
233
+ });
234
+ process.on('unhandledRejection', reason => {
235
+ logger.error('Unhandled rejection', reason instanceof Error ? reason : new Error(String(reason)));
236
+ process.exit(1);
237
+ });
238
+ // Start the server
239
+ await server.start();
240
+ // Keep the process running
241
+ logger.info('AT Protocol MCP Server is running. Press Ctrl+C to stop.');
242
+ }
243
+ catch (error) {
244
+ if (error instanceof ConfigurationError) {
245
+ console.error(`Configuration Error: ${error.message}`);
246
+ console.error('Use --help for usage information.');
247
+ process.exit(1);
248
+ }
249
+ logger.error('Failed to start AT Protocol MCP Server', error);
250
+ process.exit(1);
251
+ }
252
+ }
253
+ // Run CLI if this file is executed directly
254
+ if (import.meta.url === `file://${process.argv[1]}`) {
255
+ main().catch(error => {
256
+ console.error('Fatal error:', error);
257
+ process.exit(1);
258
+ });
259
+ }
260
+ export { main as runCli };
261
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,WAA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K,CAAC,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Health check script for Docker container
4
+ * Works in both authenticated and unauthenticated modes
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=health-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-check.d.ts","sourceRoot":"","sources":["../src/health-check.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Health check script for Docker container
4
+ * Works in both authenticated and unauthenticated modes
5
+ */
6
+ import { AtpMcpServer } from './index.js';
7
+ function healthCheck() {
8
+ try {
9
+ // Create a minimal server instance for health checking
10
+ // Use default configuration which supports unauthenticated mode
11
+ const server = new AtpMcpServer({
12
+ // Only override service if explicitly set in environment
13
+ ...(process.env['ATPROTO_SERVICE'] != null &&
14
+ process.env['ATPROTO_SERVICE'] !== '' && {
15
+ atproto: {
16
+ service: process.env['ATPROTO_SERVICE'],
17
+ },
18
+ }),
19
+ });
20
+ // Get server status without starting the full server
21
+ const status = server.getStatus();
22
+ // Check if server is properly configured
23
+ if (status.config == null) {
24
+ throw new Error('Server configuration not found');
25
+ }
26
+ // Get system metrics
27
+ const metrics = server.getSystemMetrics();
28
+ // Check memory usage (fail if over 90% of limit)
29
+ const memoryUsage = metrics.performance.memoryUsage;
30
+ const memoryUsagePercent = (memoryUsage.heapUsed / memoryUsage.heapTotal) * 100;
31
+ if (memoryUsagePercent > 90) {
32
+ throw new Error(`High memory usage: ${memoryUsagePercent.toFixed(2)}%`);
33
+ }
34
+ // Check if uptime is reasonable (server should have been running for at least 10 seconds)
35
+ if (metrics.performance.uptime < 10000) {
36
+ console.log('Server is starting up...');
37
+ }
38
+ console.log('Health check passed', {
39
+ authMode: status.authMode,
40
+ isAuthenticated: status.isAuthenticated,
41
+ uptime: metrics.performance.uptime,
42
+ memoryUsage: `${memoryUsagePercent.toFixed(2)}%`,
43
+ cacheSize: metrics.performance.cacheSize,
44
+ activeConnections: metrics.performance.activeConnections,
45
+ });
46
+ process.exit(0);
47
+ }
48
+ catch (error) {
49
+ console.error('Health check failed:', error);
50
+ process.exit(1);
51
+ }
52
+ }
53
+ // Run health check if this script is executed directly
54
+ if (import.meta.url === `file://${process.argv[1]}`) {
55
+ void healthCheck();
56
+ }
57
+ //# sourceMappingURL=health-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-check.js","sourceRoot":"","sources":["../src/health-check.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,uDAAuD;QACvD,gEAAgE;QAChE,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,yDAAyD;YACzD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,IAAI;gBACxC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI;gBACvC,OAAO,EAAE;oBACP,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;iBACxC;aACF,CAAC;SACL,CAAC,CAAC;QAEH,qDAAqD;QACrD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAElC,yCAAyC;QACzC,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAED,qBAAqB;QACrB,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAE1C,iDAAiD;QACjD,MAA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