@dotlab-hq/vector-store-mcp 1.0.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/README.md +225 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +28 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +492 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +300 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +99 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +30 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/files.d.ts +9 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +153 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/index.d.ts +40 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +47 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/upload-file.d.ts +20 -0
- package/dist/tools/upload-file.d.ts.map +1 -0
- package/dist/tools/upload-file.js +60 -0
- package/dist/tools/upload-file.js.map +1 -0
- package/dist/tools/vector-stores.d.ts +8 -0
- package/dist/tools/vector-stores.d.ts.map +1 -0
- package/dist/tools/vector-stores.js +267 -0
- package/dist/tools/vector-stores.js.map +1 -0
- package/dist/tools/vs-file-batches.d.ts +8 -0
- package/dist/tools/vs-file-batches.d.ts.map +1 -0
- package/dist/tools/vs-file-batches.js +157 -0
- package/dist/tools/vs-file-batches.js.map +1 -0
- package/dist/tools/vs-files.d.ts +8 -0
- package/dist/tools/vs-files.d.ts.map +1 -0
- package/dist/tools/vs-files.js +222 -0
- package/dist/tools/vs-files.js.map +1 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# vector-store-mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for the **OpenAI Vector Store API**. Manage vector stores, files, file batches, and perform semantic search — all through a single MCP server.
|
|
4
|
+
|
|
5
|
+
Supports **two transports**:
|
|
6
|
+
|
|
7
|
+
- **stdio** — for local use with Claude Desktop, VS Code Copilot, or any MCP-compatible client
|
|
8
|
+
- **HTTP (Streamable)** — for deployment as a web service
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **21 tools** covering the full OpenAI Vector Store API
|
|
13
|
+
- Fully typed with TypeScript + Zod schema validation
|
|
14
|
+
- Uses the official [OpenAI Node SDK](https://github.com/openai/openai-node)
|
|
15
|
+
- Two entry points: local stdio and HTTP server
|
|
16
|
+
- Zero-config for local development
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Clone and install
|
|
22
|
+
git clone <repo-url>
|
|
23
|
+
cd vector-store-mcp
|
|
24
|
+
npm install
|
|
25
|
+
|
|
26
|
+
# Build
|
|
27
|
+
npm run build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Environment Variables
|
|
31
|
+
|
|
32
|
+
| Variable | Required | Description |
|
|
33
|
+
| ----------------- | -------- | -------------------------------------------------------- |
|
|
34
|
+
| `OPENAI_API_KEY` | **Yes** | Your OpenAI API key |
|
|
35
|
+
| `OPENAI_API_BASE` | No | Custom OpenAI API base URL (for proxies/compatible APIs) |
|
|
36
|
+
| `PORT` | No | HTTP server port (default: `3000`) |
|
|
37
|
+
| `HOST` | No | HTTP server host (default: `127.0.0.1`) |
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
### Local (stdio) — Recommended for Desktop Clients
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Run directly
|
|
45
|
+
npm start
|
|
46
|
+
|
|
47
|
+
# Or with dev watch mode
|
|
48
|
+
npm run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### HTTP Server — For Deployment
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Start the HTTP server
|
|
55
|
+
npm run start:http
|
|
56
|
+
|
|
57
|
+
# Or with dev watch mode
|
|
58
|
+
npm run dev:http
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The HTTP server exposes:
|
|
62
|
+
|
|
63
|
+
- `GET /health` — Health check
|
|
64
|
+
- `POST /mcp` — MCP Streamable HTTP endpoint
|
|
65
|
+
- CORS enabled for all origins in development
|
|
66
|
+
|
|
67
|
+
## Client Configuration
|
|
68
|
+
|
|
69
|
+
### Claude Desktop
|
|
70
|
+
|
|
71
|
+
Add to your `claude_desktop_config.json`:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"vector-store": {
|
|
77
|
+
"command": "node",
|
|
78
|
+
"args": ["/absolute/path/to/vector-store-mcp/dist/stdio.js"],
|
|
79
|
+
"env": {
|
|
80
|
+
"OPENAI_API_KEY": "your-api-key-here"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### VS Code (GitHub Copilot)
|
|
88
|
+
|
|
89
|
+
Add to your VS Code `settings.json` or `.vscode/mcp.json`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcp": {
|
|
94
|
+
"servers": {
|
|
95
|
+
"vector-store": {
|
|
96
|
+
"command": "node",
|
|
97
|
+
"args": ["/absolute/path/to/vector-store-mcp/dist/stdio.js"],
|
|
98
|
+
"env": {
|
|
99
|
+
"OPENAI_API_KEY": "your-api-key-here"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### HTTP/Web Clients
|
|
108
|
+
|
|
109
|
+
With HTTP-based MCP, the **server holds the credentials** — the client only needs the URL. The API key and base URL are passed as environment variables when **starting the server**, not in the client config.
|
|
110
|
+
|
|
111
|
+
**1. Start the server with your credentials:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Pass env vars directly
|
|
115
|
+
OPENAI_API_KEY=sk-... npm run start:http
|
|
116
|
+
|
|
117
|
+
# Or use a .env file / shell profile to set them
|
|
118
|
+
export OPENAI_API_KEY=sk-...
|
|
119
|
+
export OPENAI_API_BASE=https://your-proxy.example.com/v1 # optional
|
|
120
|
+
npm run start:http
|
|
121
|
+
# Server running at http://127.0.0.1:3000/mcp
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**2. Connect from your MCP client — just the URL, no keys needed:**
|
|
125
|
+
|
|
126
|
+
VS Code `.vscode/mcp.json`:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"servers": {
|
|
131
|
+
"vector-store": {
|
|
132
|
+
"url": "http://127.0.0.1:3000/mcp",
|
|
133
|
+
"type": "http"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Any MCP-compatible HTTP client:
|
|
140
|
+
|
|
141
|
+
```http
|
|
142
|
+
POST http://127.0.0.1:3000/mcp
|
|
143
|
+
Content-Type: application/json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> **How it works:** The server process reads `OPENAI_API_KEY` from its own environment and uses it for all OpenAI API calls. The MCP client never sees or transmits the key — it just sends tool requests to the server URL. This means you can run the server anywhere (local, cloud, Docker) and point multiple clients at it.
|
|
147
|
+
|
|
148
|
+
## Programmatic API
|
|
149
|
+
|
|
150
|
+
You can also use this as a library:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
McpServer,
|
|
155
|
+
registerAllTools,
|
|
156
|
+
getClient,
|
|
157
|
+
resetClient,
|
|
158
|
+
} from "vector-store-mcp";
|
|
159
|
+
|
|
160
|
+
const server = new McpServer({ name: "my-server", version: "1.0.0" });
|
|
161
|
+
registerAllTools(server);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Tools (21)
|
|
165
|
+
|
|
166
|
+
### Vector Stores (6)
|
|
167
|
+
|
|
168
|
+
| Tool | Description |
|
|
169
|
+
| ------------------------------ | -------------------------------------------------------------- |
|
|
170
|
+
| `openai_create_vector_store` | Create a new vector store |
|
|
171
|
+
| `openai_retrieve_vector_store` | Retrieve a vector store by ID |
|
|
172
|
+
| `openai_update_vector_store` | Update a vector store's name or metadata |
|
|
173
|
+
| `openai_delete_vector_store` | Delete a vector store |
|
|
174
|
+
| `openai_list_vector_stores` | List all vector stores with pagination and filtering |
|
|
175
|
+
| `openai_search_vector_store` | Search a vector store with a query string and optional filters |
|
|
176
|
+
|
|
177
|
+
### Files (4)
|
|
178
|
+
|
|
179
|
+
| Tool | Description |
|
|
180
|
+
| ------------------------------ | ------------------------------------------------------------ |
|
|
181
|
+
| `openai_list_files` | List files with filtering by purpose, status, and pagination |
|
|
182
|
+
| `openai_retrieve_file` | Retrieve file metadata by ID |
|
|
183
|
+
| `openai_delete_file` | Delete a file by ID |
|
|
184
|
+
| `openai_retrieve_file_content` | Download the content of a file by ID |
|
|
185
|
+
|
|
186
|
+
### Vector Store Files (6)
|
|
187
|
+
|
|
188
|
+
| Tool | Description |
|
|
189
|
+
| -------------------------------------------- | ---------------------------------------------------------- |
|
|
190
|
+
| `openai_attach_file_to_vector_store` | Attach a file to a vector store with optional attributes |
|
|
191
|
+
| `openai_list_vector_store_files` | List files in a vector store with filtering and pagination |
|
|
192
|
+
| `openai_retrieve_vector_store_file` | Retrieve a specific file in a vector store |
|
|
193
|
+
| `openai_delete_vector_store_file` | Remove a file from a vector store |
|
|
194
|
+
| `openai_retrieve_vector_store_file_content` | Download file content from a vector store |
|
|
195
|
+
| `openai_update_vector_store_file_attributes` | Update attributes on a vector store file |
|
|
196
|
+
|
|
197
|
+
### File Batches (4)
|
|
198
|
+
|
|
199
|
+
| Tool | Description |
|
|
200
|
+
| ------------------------------------------- | ------------------------------------------ |
|
|
201
|
+
| `openai_create_vector_store_file_batch` | Create a batch of files for a vector store |
|
|
202
|
+
| `openai_retrieve_vector_store_file_batch` | Retrieve batch status and details |
|
|
203
|
+
| `openai_cancel_vector_store_file_batch` | Cancel an in-progress batch |
|
|
204
|
+
| `openai_list_vector_store_file_batch_files` | List files in a specific batch |
|
|
205
|
+
|
|
206
|
+
### Upload (1)
|
|
207
|
+
|
|
208
|
+
| Tool | Description |
|
|
209
|
+
| -------------------- | ---------------------------------------------------- |
|
|
210
|
+
| `openai_upload_file` | Upload a file to OpenAI (for use with vector stores) |
|
|
211
|
+
|
|
212
|
+
## npm Scripts
|
|
213
|
+
|
|
214
|
+
| Script | Description |
|
|
215
|
+
| -------------------- | ------------------------------- |
|
|
216
|
+
| `npm start` | Run stdio transport (local) |
|
|
217
|
+
| `npm run start:http` | Run HTTP transport (deployment) |
|
|
218
|
+
| `npm run dev` | Dev mode with watch (stdio) |
|
|
219
|
+
| `npm run dev:http` | Dev mode with watch (HTTP) |
|
|
220
|
+
| `npm run build` | Compile TypeScript |
|
|
221
|
+
| `npm run clean` | Remove dist/ |
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import OpenAI from "openai";
|
|
2
|
+
/**
|
|
3
|
+
* Get or create the OpenAI client singleton.
|
|
4
|
+
* Uses OPENAI_API_KEY and optionally OPENAI_API_BASE from environment.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getClient(): OpenAI;
|
|
7
|
+
/**
|
|
8
|
+
* Reset the singleton (for testing or re-configuration).
|
|
9
|
+
*/
|
|
10
|
+
export declare function resetClient(): void;
|
|
11
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAmBlC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import OpenAI from "openai";
|
|
2
|
+
let _client = null;
|
|
3
|
+
/**
|
|
4
|
+
* Get or create the OpenAI client singleton.
|
|
5
|
+
* Uses OPENAI_API_KEY and optionally OPENAI_API_BASE from environment.
|
|
6
|
+
*/
|
|
7
|
+
export function getClient() {
|
|
8
|
+
if (_client)
|
|
9
|
+
return _client;
|
|
10
|
+
const apiKey = process.env["OPENAI_API_KEY"];
|
|
11
|
+
if (!apiKey) {
|
|
12
|
+
throw new Error("OPENAI_API_KEY environment variable is required. " +
|
|
13
|
+
"Set it to your OpenAI API key before starting the server.");
|
|
14
|
+
}
|
|
15
|
+
const baseURL = process.env["OPENAI_API_BASE"];
|
|
16
|
+
_client = new OpenAI({
|
|
17
|
+
apiKey,
|
|
18
|
+
...(baseURL ? { baseURL } : {}),
|
|
19
|
+
});
|
|
20
|
+
return _client;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Reset the singleton (for testing or re-configuration).
|
|
24
|
+
*/
|
|
25
|
+
export function resetClient() {
|
|
26
|
+
_client = null;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,IAAI,OAAO,GAAkB,IAAI,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,mDAAmD;YACjD,2DAA2D,CAC9D,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAE/C,OAAO,GAAG,IAAI,MAAM,CAAC;QACnB,MAAM;QACN,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-store-mcp — programmatic API entry point.
|
|
3
|
+
*
|
|
4
|
+
* Import this module to use the MCP server in your own code,
|
|
5
|
+
* or re-export for custom integrations.
|
|
6
|
+
*/
|
|
7
|
+
export { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
export { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
export { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
10
|
+
export { registerAllTools } from "./tools/index.js";
|
|
11
|
+
export { getClient, resetClient } from "./client.js";
|
|
12
|
+
export * from "./schemas/index.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vector-store-mcp — programmatic API entry point.
|
|
3
|
+
*
|
|
4
|
+
* Import this module to use the MCP server in your own code,
|
|
5
|
+
* or re-export for custom integrations.
|
|
6
|
+
*/
|
|
7
|
+
export { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
export { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
export { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
10
|
+
export { registerAllTools } from "./tools/index.js";
|
|
11
|
+
export { getClient, resetClient } from "./client.js";
|
|
12
|
+
export * from "./schemas/index.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,cAAc,oBAAoB,CAAC"}
|