Skip to content

Commit 8b6062d

Browse files
devin-ai-integration[bot]nicolo.boschi@vectorize.ionicoloboschi
authored
Add support for fixed pipeline ID via environment variable (#5)
* Add support for fixed pipeline ID via environment variable Co-Authored-By: [email protected] <[email protected]> * Update README to document VECTORIZE_PIPELINE_ID environment variable Co-Authored-By: [email protected] <[email protected]> * Update README.md --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Nicolò Boschi <[email protected]>
1 parent 359ca59 commit 8b6062d

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ A Model Context Protocol (MCP) server implementation that integrates with [Vecto
1515
```bash
1616
export VECTORIZE_ORG_ID=YOUR_ORG_ID
1717
export VECTORIZE_TOKEN=YOUR_TOKEN
18+
# Optional: Set a fixed pipeline ID to use for all requests
19+
export VECTORIZE_PIPELINE_ID=YOUR_PIPELINE_ID
1820
npx -y @vectorize-io/vectorize-mcp-server
1921
```
2022

21-
## Configuration on Claude/Windsurf
23+
## Configuration on Claude/Windsurf/Cursor/Cline
2224

2325
```json
2426
{
@@ -28,7 +30,8 @@ npx -y @vectorize-io/vectorize-mcp-server
2830
"args": ["-y", "@vectorize-io/vectorize-mcp-server"],
2931
"env": {
3032
"VECTORIZE_ORG_ID": "your-org-id",
31-
"VECTORIZE_TOKEN": "your-token"
33+
"VECTORIZE_TOKEN": "your-token",
34+
"VECTORIZE_PIPELINE_ID": "your-pipeline-id"
3235
}
3336
}
3437
}
@@ -94,4 +97,4 @@ npm run build
9497

9598
1. Fork the repository
9699
2. Create your feature branch
97-
3. Submit a pull request
100+
3. Submit a pull request

src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const RETRIEVAL_TOOL: Tool = {
3232
description: 'The number of documents to retrieve.',
3333
},
3434
},
35-
required: ['pipelineId', 'question', 'k'],
35+
required: process.env.VECTORIZE_PIPELINE_ID ? ['question', 'k'] : ['pipelineId', 'question', 'k'],
3636
},
3737
};
3838

@@ -56,7 +56,7 @@ const DEEP_RESEARCH_TOOL: Tool = {
5656
description: 'Whether to perform a web search.',
5757
},
5858
},
59-
required: ['pipelineId', 'query', 'webSearch'],
59+
required: process.env.VECTORIZE_PIPELINE_ID ? ['query', 'webSearch'] : ['pipelineId', 'query', 'webSearch'],
6060
},
6161
};
6262

@@ -97,6 +97,7 @@ const server = new Server(
9797
// Get optional API URL
9898
const VECTORIZE_ORG_ID = process.env.VECTORIZE_ORG_ID;
9999
const VECTORIZE_TOKEN = process.env.VECTORIZE_TOKEN;
100+
const VECTORIZE_PIPELINE_ID = process.env.VECTORIZE_PIPELINE_ID;
100101
// Check if API key is required (only for cloud service)
101102
if (!VECTORIZE_ORG_ID || !VECTORIZE_TOKEN) {
102103
console.error(
@@ -250,7 +251,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
250251
case 'retrieve': {
251252
return await performRetrieval(
252253
VECTORIZE_ORG_ID,
253-
args.pipelineId + '',
254+
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
254255
args.question + '',
255256
Number(args.k)
256257
);
@@ -265,7 +266,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
265266
case 'deep-research': {
266267
return await performDeepResearch(
267268
VECTORIZE_ORG_ID,
268-
args.pipelineId + '',
269+
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
269270
args.query + '',
270271
Boolean(args.webSearch)
271272
);
@@ -305,6 +306,13 @@ async function runServer() {
305306
data: `Configuration: Organization ID: ${VECTORIZE_ORG_ID || 'default'}`,
306307
});
307308

309+
if (VECTORIZE_PIPELINE_ID) {
310+
server.sendLoggingMessage({
311+
level: 'info',
312+
data: `Configuration: Using fixed Pipeline ID: ${VECTORIZE_PIPELINE_ID}`,
313+
});
314+
}
315+
308316
console.error('Vectorize MCP Server running');
309317
}
310318

0 commit comments

Comments
 (0)