@hskksk/mem-ai-mcp-server 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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +215 -0
  3. package/dist/client/mem-api-client.d.ts +63 -0
  4. package/dist/client/mem-api-client.d.ts.map +1 -0
  5. package/dist/client/mem-api-client.js +169 -0
  6. package/dist/client/mem-api-client.js.map +1 -0
  7. package/dist/config/env.d.ts +24 -0
  8. package/dist/config/env.d.ts.map +1 -0
  9. package/dist/config/env.js +16 -0
  10. package/dist/config/env.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +25 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/server.d.ts +43 -0
  16. package/dist/server.d.ts.map +1 -0
  17. package/dist/server.js +91 -0
  18. package/dist/server.js.map +1 -0
  19. package/dist/tools/base-tool.d.ts +26 -0
  20. package/dist/tools/base-tool.d.ts.map +1 -0
  21. package/dist/tools/base-tool.js +64 -0
  22. package/dist/tools/base-tool.js.map +1 -0
  23. package/dist/tools/collections/create-collection.d.ts +10 -0
  24. package/dist/tools/collections/create-collection.d.ts.map +1 -0
  25. package/dist/tools/collections/create-collection.js +19 -0
  26. package/dist/tools/collections/create-collection.js.map +1 -0
  27. package/dist/tools/collections/delete-collection.d.ts +10 -0
  28. package/dist/tools/collections/delete-collection.d.ts.map +1 -0
  29. package/dist/tools/collections/delete-collection.js +18 -0
  30. package/dist/tools/collections/delete-collection.js.map +1 -0
  31. package/dist/tools/collections/get-collection.d.ts +10 -0
  32. package/dist/tools/collections/get-collection.d.ts.map +1 -0
  33. package/dist/tools/collections/get-collection.js +18 -0
  34. package/dist/tools/collections/get-collection.js.map +1 -0
  35. package/dist/tools/collections/list-collections.d.ts +10 -0
  36. package/dist/tools/collections/list-collections.d.ts.map +1 -0
  37. package/dist/tools/collections/list-collections.js +15 -0
  38. package/dist/tools/collections/list-collections.js.map +1 -0
  39. package/dist/tools/collections/search-collections.d.ts +10 -0
  40. package/dist/tools/collections/search-collections.d.ts.map +1 -0
  41. package/dist/tools/collections/search-collections.js +20 -0
  42. package/dist/tools/collections/search-collections.js.map +1 -0
  43. package/dist/tools/mem-it.d.ts +10 -0
  44. package/dist/tools/mem-it.d.ts.map +1 -0
  45. package/dist/tools/mem-it.js +21 -0
  46. package/dist/tools/mem-it.js.map +1 -0
  47. package/dist/tools/notes/create-note.d.ts +10 -0
  48. package/dist/tools/notes/create-note.d.ts.map +1 -0
  49. package/dist/tools/notes/create-note.js +23 -0
  50. package/dist/tools/notes/create-note.js.map +1 -0
  51. package/dist/tools/notes/delete-note.d.ts +10 -0
  52. package/dist/tools/notes/delete-note.d.ts.map +1 -0
  53. package/dist/tools/notes/delete-note.js +18 -0
  54. package/dist/tools/notes/delete-note.js.map +1 -0
  55. package/dist/tools/notes/get-note.d.ts +10 -0
  56. package/dist/tools/notes/get-note.d.ts.map +1 -0
  57. package/dist/tools/notes/get-note.js +18 -0
  58. package/dist/tools/notes/get-note.js.map +1 -0
  59. package/dist/tools/notes/list-notes.d.ts +10 -0
  60. package/dist/tools/notes/list-notes.d.ts.map +1 -0
  61. package/dist/tools/notes/list-notes.js +15 -0
  62. package/dist/tools/notes/list-notes.js.map +1 -0
  63. package/dist/tools/notes/search-notes.d.ts +10 -0
  64. package/dist/tools/notes/search-notes.d.ts.map +1 -0
  65. package/dist/tools/notes/search-notes.js +20 -0
  66. package/dist/tools/notes/search-notes.js.map +1 -0
  67. package/dist/types/api.d.ts +81 -0
  68. package/dist/types/api.d.ts.map +1 -0
  69. package/dist/types/api.js +5 -0
  70. package/dist/types/api.js.map +1 -0
  71. package/dist/types/tools.d.ts +41 -0
  72. package/dist/types/tools.d.ts.map +1 -0
  73. package/dist/types/tools.js +2 -0
  74. package/dist/types/tools.js.map +1 -0
  75. package/dist/utils/error-handler.d.ts +41 -0
  76. package/dist/utils/error-handler.d.ts.map +1 -0
  77. package/dist/utils/error-handler.js +65 -0
  78. package/dist/utils/error-handler.js.map +1 -0
  79. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 hskksk
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.
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # mem.ai MCP Server
2
+
3
+ [![npm version](https://badge.fury.io/js/@hskksk%2Fmem-ai-mcp-server.svg)](https://www.npmjs.com/package/@hskksk/mem-ai-mcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Model Context Protocol (MCP) server for [mem.ai](https://mem.ai) API integration. This server enables AI assistants like Claude to interact with your mem.ai memory through a standardized interface.
7
+
8
+ ## Features
9
+
10
+ - **Complete API Coverage**: All 11 mem.ai API endpoints wrapped as MCP tools
11
+ - **TypeScript**: Fully typed with strict mode enabled
12
+ - **Easy Integration**: Works seamlessly with Claude Desktop and other MCP clients
13
+ - **Error Handling**: Comprehensive error handling with detailed messages
14
+ - **Validation**: Input validation using Zod schemas
15
+
16
+ ## Installation
17
+
18
+ ### Global Installation (Recommended)
19
+
20
+ ```bash
21
+ npm install -g @hskksk/mem-ai-mcp-server
22
+ ```
23
+
24
+ ### Local Installation
25
+
26
+ ```bash
27
+ npm install @hskksk/mem-ai-mcp-server
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ ### Get Your API Key
33
+
34
+ 1. Visit [mem.ai settings](https://mem.ai/settings/api)
35
+ 2. Generate a new API key
36
+ 3. Copy the key for configuration
37
+
38
+ ### Environment Variables
39
+
40
+ Create a `.env` file or set environment variables:
41
+
42
+ ```bash
43
+ MEM_API_KEY=your_api_key_here
44
+ ```
45
+
46
+ Optional configuration:
47
+
48
+ ```bash
49
+ # Override the default API base URL (default: https://api.mem.ai)
50
+ MEM_API_BASE_URL=https://api.mem.ai
51
+ ```
52
+
53
+ ## Usage
54
+
55
+ ### With Claude Desktop
56
+
57
+ Add the following configuration to your Claude Desktop config file:
58
+
59
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
60
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "mem-ai": {
66
+ "command": "mem-ai-mcp-server",
67
+ "env": {
68
+ "MEM_API_KEY": "your_api_key_here"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ After restarting Claude Desktop, you'll be able to use mem.ai tools in your conversations.
76
+
77
+ ### Standalone Usage
78
+
79
+ ```bash
80
+ MEM_API_KEY=your_api_key_here mem-ai-mcp-server
81
+ ```
82
+
83
+ ## Available Tools
84
+
85
+ ### Mem It
86
+
87
+ - **`mem_it`** - Remember any content intelligently
88
+ - Primary endpoint for saving information to mem.ai
89
+ - Supports context and instructions for better processing
90
+
91
+ ### Notes Management
92
+
93
+ - **`create_note`** - Create a new note with markdown content
94
+ - **`get_note`** - Retrieve a specific note by ID
95
+ - **`delete_note`** - Delete a note
96
+ - **`list_notes`** - List all notes
97
+ - **`search_notes`** - Search across notes with query, limit, and offset
98
+
99
+ ### Collections Management
100
+
101
+ - **`create_collection`** - Create a new collection
102
+ - **`get_collection`** - Retrieve a specific collection by ID
103
+ - **`delete_collection`** - Delete a collection
104
+ - **`list_collections`** - List all collections
105
+ - **`search_collections`** - Search across collections with query, limit, and offset
106
+
107
+ ## Development
108
+
109
+ ### Prerequisites
110
+
111
+ - Node.js >= 20.0.0
112
+ - pnpm (recommended) or npm
113
+
114
+ ### Setup
115
+
116
+ ```bash
117
+ # Clone the repository
118
+ git clone https://github.com/hskksk/mem-ai-mcp-server.git
119
+ cd mem-ai-mcp-server
120
+
121
+ # Install dependencies
122
+ pnpm install
123
+
124
+ # Copy environment template
125
+ cp .env.example .env
126
+
127
+ # Edit .env and add your API key
128
+ ```
129
+
130
+ ### Development Commands
131
+
132
+ ```bash
133
+ # Run in development mode with auto-reload
134
+ pnpm dev
135
+
136
+ # Build the project
137
+ pnpm build
138
+
139
+ # Run tests
140
+ pnpm test
141
+
142
+ # Type check
143
+ pnpm type-check
144
+
145
+ # Lint
146
+ pnpm lint
147
+ ```
148
+
149
+ ### Project Structure
150
+
151
+ ```
152
+ src/
153
+ ├── index.ts # Entry point
154
+ ├── server.ts # MCP server setup
155
+ ├── config/
156
+ │ └── env.ts # Environment configuration
157
+ ├── client/
158
+ │ └── mem-api-client.ts # mem.ai API client
159
+ ├── tools/ # MCP tool implementations
160
+ │ ├── base-tool.ts
161
+ │ ├── mem-it.ts
162
+ │ ├── notes/
163
+ │ └── collections/
164
+ ├── types/ # TypeScript type definitions
165
+ └── utils/ # Utility functions
166
+ ```
167
+
168
+ ## API Documentation
169
+
170
+ For detailed information about the mem.ai API, visit the [official API documentation](https://docs.mem.ai/api-reference/).
171
+
172
+ ## Error Handling
173
+
174
+ The server provides detailed error messages for common issues:
175
+
176
+ - **401 Unauthorized**: Invalid API key
177
+ - **404 Not Found**: Resource not found
178
+ - **429 Too Many Requests**: Rate limit exceeded
179
+ - **500 Server Error**: Internal server error
180
+
181
+ All errors are returned in a structured format for easy debugging.
182
+
183
+ ## Contributing
184
+
185
+ Contributions are welcome! Please feel free to submit a Pull Request.
186
+
187
+ ## License
188
+
189
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
190
+
191
+ ## Links
192
+
193
+ - [GitHub Repository](https://github.com/hskksk/mem-ai-mcp-server)
194
+ - [npm Package](https://www.npmjs.com/package/@hskksk/mem-ai-mcp-server)
195
+ - [mem.ai Website](https://mem.ai)
196
+ - [MCP Documentation](https://modelcontextprotocol.io)
197
+
198
+ ## Support
199
+
200
+ If you encounter any issues or have questions:
201
+
202
+ 1. Check the [GitHub Issues](https://github.com/hskksk/mem-ai-mcp-server/issues)
203
+ 2. Create a new issue with detailed information
204
+ 3. Refer to the [mem.ai API documentation](https://docs.mem.ai/api-reference/)
205
+
206
+ ## Changelog
207
+
208
+ ### 0.1.0 (Initial Release)
209
+
210
+ - Complete implementation of all 11 mem.ai API endpoints
211
+ - TypeScript support with full type definitions
212
+ - Comprehensive error handling
213
+ - Input validation using Zod
214
+ - Basic unit tests
215
+ - Claude Desktop integration support
@@ -0,0 +1,63 @@
1
+ import type { MemItRequest, MemItResponse, CreateNoteRequest, CreateNoteResponse, GetNoteResponse, DeleteNoteResponse, ListNotesResponse, SearchNotesRequest, SearchNotesResponse, CreateCollectionRequest, CreateCollectionResponse, GetCollectionResponse, DeleteCollectionResponse, ListCollectionsResponse, SearchCollectionsRequest, SearchCollectionsResponse } from '../types/api.js';
2
+ /**
3
+ * HTTP client for mem.ai API
4
+ */
5
+ export declare class MemAPIClient {
6
+ private baseURL;
7
+ private apiKey;
8
+ private timeout;
9
+ constructor(apiKey: string, baseURL?: string, timeout?: number);
10
+ /**
11
+ * Make HTTP request to mem.ai API
12
+ */
13
+ private request;
14
+ /**
15
+ * Handle API error responses
16
+ */
17
+ private handleError;
18
+ /**
19
+ * Remember content intelligently using Mem It
20
+ */
21
+ memIt(params: MemItRequest): Promise<MemItResponse>;
22
+ /**
23
+ * Create a new note
24
+ */
25
+ createNote(params: CreateNoteRequest): Promise<CreateNoteResponse>;
26
+ /**
27
+ * Get a specific note by ID
28
+ */
29
+ getNote(noteId: string): Promise<GetNoteResponse>;
30
+ /**
31
+ * Delete a note
32
+ */
33
+ deleteNote(noteId: string): Promise<DeleteNoteResponse>;
34
+ /**
35
+ * List all notes
36
+ */
37
+ listNotes(): Promise<ListNotesResponse>;
38
+ /**
39
+ * Search notes
40
+ */
41
+ searchNotes(params: SearchNotesRequest): Promise<SearchNotesResponse>;
42
+ /**
43
+ * Create a new collection
44
+ */
45
+ createCollection(params: CreateCollectionRequest): Promise<CreateCollectionResponse>;
46
+ /**
47
+ * Get a specific collection by ID
48
+ */
49
+ getCollection(collectionId: string): Promise<GetCollectionResponse>;
50
+ /**
51
+ * Delete a collection
52
+ */
53
+ deleteCollection(collectionId: string): Promise<DeleteCollectionResponse>;
54
+ /**
55
+ * List all collections
56
+ */
57
+ listCollections(): Promise<ListCollectionsResponse>;
58
+ /**
59
+ * Search collections
60
+ */
61
+ searchCollections(params: SearchCollectionsRequest): Promise<SearchCollectionsResponse>;
62
+ }
63
+ //# sourceMappingURL=mem-api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mem-api-client.d.ts","sourceRoot":"","sources":["../../src/client/mem-api-client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAA6B,EAAE,OAAO,GAAE,MAAc;IAM3F;;OAEG;YACW,OAAO;IAoCrB;;OAEG;YACW,WAAW;IA4BzB;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IASzD;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOxE;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAMvD;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAM7D;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAM7C;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAS3E;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAO1F;;OAEG;IACG,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAMzE;;OAEG;IACG,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAM/E;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAMzD;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAM9F"}
@@ -0,0 +1,169 @@
1
+ import { MemAPIError, AuthenticationError, NotFoundError, RateLimitError, ServerError, } from '../utils/error-handler.js';
2
+ /**
3
+ * HTTP client for mem.ai API
4
+ */
5
+ export class MemAPIClient {
6
+ baseURL;
7
+ apiKey;
8
+ timeout;
9
+ constructor(apiKey, baseURL = 'https://api.mem.ai', timeout = 30000) {
10
+ this.apiKey = apiKey;
11
+ this.baseURL = baseURL;
12
+ this.timeout = timeout;
13
+ }
14
+ /**
15
+ * Make HTTP request to mem.ai API
16
+ */
17
+ async request(endpoint, options = {}) {
18
+ const controller = new AbortController();
19
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
20
+ try {
21
+ const response = await fetch(`${this.baseURL}${endpoint}`, {
22
+ ...options,
23
+ signal: controller.signal,
24
+ headers: {
25
+ 'Authorization': `Bearer ${this.apiKey}`,
26
+ 'Content-Type': 'application/json',
27
+ ...options.headers,
28
+ },
29
+ });
30
+ if (!response.ok) {
31
+ throw await this.handleError(response);
32
+ }
33
+ return response.json();
34
+ }
35
+ catch (error) {
36
+ if (error instanceof MemAPIError) {
37
+ throw error;
38
+ }
39
+ if (error.name === 'AbortError') {
40
+ throw new MemAPIError(408, 'Request timeout');
41
+ }
42
+ throw new MemAPIError(500, `Request failed: ${error.message}`);
43
+ }
44
+ finally {
45
+ clearTimeout(timeoutId);
46
+ }
47
+ }
48
+ /**
49
+ * Handle API error responses
50
+ */
51
+ async handleError(response) {
52
+ const errorData = await response.json().catch(() => ({}));
53
+ const message = errorData.message || errorData.error || response.statusText;
54
+ switch (response.status) {
55
+ case 401:
56
+ return new AuthenticationError(message);
57
+ case 404:
58
+ return new NotFoundError(message);
59
+ case 429: {
60
+ const retryAfter = response.headers.get('Retry-After');
61
+ return new RateLimitError(message, retryAfter ? parseInt(retryAfter, 10) : undefined);
62
+ }
63
+ case 500:
64
+ case 502:
65
+ case 503:
66
+ case 504:
67
+ return new ServerError(message);
68
+ default:
69
+ return new MemAPIError(response.status, message, errorData);
70
+ }
71
+ }
72
+ // ========== Mem It ==========
73
+ /**
74
+ * Remember content intelligently using Mem It
75
+ */
76
+ async memIt(params) {
77
+ return this.request('/v2/mem-it', {
78
+ method: 'POST',
79
+ body: JSON.stringify(params),
80
+ });
81
+ }
82
+ // ========== Notes ==========
83
+ /**
84
+ * Create a new note
85
+ */
86
+ async createNote(params) {
87
+ return this.request('/v2/notes', {
88
+ method: 'POST',
89
+ body: JSON.stringify(params),
90
+ });
91
+ }
92
+ /**
93
+ * Get a specific note by ID
94
+ */
95
+ async getNote(noteId) {
96
+ return this.request(`/v2/notes/${noteId}`, {
97
+ method: 'GET',
98
+ });
99
+ }
100
+ /**
101
+ * Delete a note
102
+ */
103
+ async deleteNote(noteId) {
104
+ return this.request(`/v2/notes/${noteId}`, {
105
+ method: 'DELETE',
106
+ });
107
+ }
108
+ /**
109
+ * List all notes
110
+ */
111
+ async listNotes() {
112
+ return this.request('/v2/notes', {
113
+ method: 'GET',
114
+ });
115
+ }
116
+ /**
117
+ * Search notes
118
+ */
119
+ async searchNotes(params) {
120
+ return this.request('/v2/notes/search', {
121
+ method: 'POST',
122
+ body: JSON.stringify(params),
123
+ });
124
+ }
125
+ // ========== Collections ==========
126
+ /**
127
+ * Create a new collection
128
+ */
129
+ async createCollection(params) {
130
+ return this.request('/v2/collections', {
131
+ method: 'POST',
132
+ body: JSON.stringify(params),
133
+ });
134
+ }
135
+ /**
136
+ * Get a specific collection by ID
137
+ */
138
+ async getCollection(collectionId) {
139
+ return this.request(`/v2/collections/${collectionId}`, {
140
+ method: 'GET',
141
+ });
142
+ }
143
+ /**
144
+ * Delete a collection
145
+ */
146
+ async deleteCollection(collectionId) {
147
+ return this.request(`/v2/collections/${collectionId}`, {
148
+ method: 'DELETE',
149
+ });
150
+ }
151
+ /**
152
+ * List all collections
153
+ */
154
+ async listCollections() {
155
+ return this.request('/v2/collections', {
156
+ method: 'GET',
157
+ });
158
+ }
159
+ /**
160
+ * Search collections
161
+ */
162
+ async searchCollections(params) {
163
+ return this.request('/v2/collections/search', {
164
+ method: 'POST',
165
+ body: JSON.stringify(params),
166
+ });
167
+ }
168
+ }
169
+ //# sourceMappingURL=mem-api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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K,CAAC,gBAAgB,CAAC,MAA+B;QACpD,OAAO,IAAI,CAAC,OAAO,CAA2B,iBAAiB,EAAE;YAC/D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,YAAoB;QACtC,OAAO,IAAI,CAAC,OAAO,CAAwB,mBAAmB,YAAY,EAAE,EAAE;YAC5E,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,YAAoB;QACzC,OAAO,IAAI,CAAC,OAAO,CAA2B,mBAAmB,YAAY,EAAE,EAAE;YAC/E,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,OAAO,CAA0B,iBAAiB,EAAE;YAC9D,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,MAAgC;QACtD,OAAO,IAAI,CAAC,OAAO,CAA4B,wBAAwB,EAAE;YACvE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Environment variable schema
4
+ */
5
+ declare const envSchema: z.ZodObject<{
6
+ MEM_API_KEY: z.ZodString;
7
+ MEM_API_BASE_URL: z.ZodDefault<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ MEM_API_KEY: string;
10
+ MEM_API_BASE_URL: string;
11
+ }, {
12
+ MEM_API_KEY: string;
13
+ MEM_API_BASE_URL?: string | undefined;
14
+ }>;
15
+ /**
16
+ * Validated environment variables
17
+ */
18
+ export declare const env: {
19
+ MEM_API_KEY: string;
20
+ MEM_API_BASE_URL: string;
21
+ };
22
+ export type Env = z.infer<typeof envSchema>;
23
+ export {};
24
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,QAAA,MAAM,SAAS;;;;;;;;;EAGb,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,GAAG;;;CAGd,CAAC;AAEH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Environment variable schema
4
+ */
5
+ const envSchema = z.object({
6
+ MEM_API_KEY: z.string().min(1, 'MEM_API_KEY is required'),
7
+ MEM_API_BASE_URL: z.string().url().default('https://api.mem.ai'),
8
+ });
9
+ /**
10
+ * Validated environment variables
11
+ */
12
+ export const env = envSchema.parse({
13
+ MEM_API_KEY: process.env.MEM_API_KEY,
14
+ MEM_API_BASE_URL: process.env.MEM_API_BASE_URL || 'https://api.mem.ai',
15
+ });
16
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;IACzD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC;CACjE,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC;IACjC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;IACpC,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,oBAAoB;CACvE,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import 'dotenv/config';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import 'dotenv/config';
3
+ import { env } from './config/env.js';
4
+ import { startServer } from './server.js';
5
+ /**
6
+ * Main entry point for the MCP server
7
+ */
8
+ async function main() {
9
+ try {
10
+ // Validate environment variables
11
+ if (!env.MEM_API_KEY) {
12
+ console.error('Error: MEM_API_KEY environment variable is required');
13
+ console.error('Get your API key from https://mem.ai/settings/api');
14
+ process.exit(1);
15
+ }
16
+ // Start the server
17
+ await startServer(env.MEM_API_KEY, env.MEM_API_BASE_URL);
18
+ }
19
+ catch (error) {
20
+ console.error('Fatal error:', error);
21
+ process.exit(1);
22
+ }
23
+ }
24
+ main();
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,iCAAiC;QACjC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACrE,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,mBAAmB;QACnB,MAAM,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ /**
3
+ * Create and configure the MCP server
4
+ */
5
+ export declare function createServer(apiKey: string, baseURL?: string): Promise<Server<{
6
+ method: string;
7
+ params?: {
8
+ [x: string]: unknown;
9
+ _meta?: {
10
+ [x: string]: unknown;
11
+ progressToken?: string | number | undefined;
12
+ "io.modelcontextprotocol/related-task"?: {
13
+ taskId: string;
14
+ } | undefined;
15
+ } | undefined;
16
+ } | undefined;
17
+ }, {
18
+ method: string;
19
+ params?: {
20
+ [x: string]: unknown;
21
+ _meta?: {
22
+ [x: string]: unknown;
23
+ progressToken?: string | number | undefined;
24
+ "io.modelcontextprotocol/related-task"?: {
25
+ taskId: string;
26
+ } | undefined;
27
+ } | undefined;
28
+ } | undefined;
29
+ }, {
30
+ [x: string]: unknown;
31
+ _meta?: {
32
+ [x: string]: unknown;
33
+ progressToken?: string | number | undefined;
34
+ "io.modelcontextprotocol/related-task"?: {
35
+ taskId: string;
36
+ } | undefined;
37
+ } | undefined;
38
+ }>>;
39
+ /**
40
+ * Start the MCP server with stdio transport
41
+ */
42
+ export declare function startServer(apiKey: string, baseURL?: string): Promise<void>;
43
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAoBnE;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4ElE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,iBAOjE"}