Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ A Model Context Protocol (MCP) server implementation that integrates with [Vecto
```bash
export VECTORIZE_ORG_ID=YOUR_ORG_ID
export VECTORIZE_TOKEN=YOUR_TOKEN
# Optional: Set a fixed pipeline ID to use for all requests
export VECTORIZE_PIPELINE_ID=YOUR_PIPELINE_ID
npx -y @vectorize-io/vectorize-mcp-server
```

Expand All @@ -28,7 +30,8 @@ npx -y @vectorize-io/vectorize-mcp-server
"args": ["-y", "@vectorize-io/vectorize-mcp-server"],
"env": {
"VECTORIZE_ORG_ID": "your-org-id",
"VECTORIZE_TOKEN": "your-token"
"VECTORIZE_TOKEN": "your-token",
"VECTORIZE_PIPELINE_ID": "your-pipeline-id" // Optional: Set a fixed pipeline ID
}
}
}
Expand Down Expand Up @@ -94,4 +97,4 @@ npm run build

1. Fork the repository
2. Create your feature branch
3. Submit a pull request
3. Submit a pull request
16 changes: 12 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const RETRIEVAL_TOOL: Tool = {
description: 'The number of documents to retrieve.',
},
},
required: ['pipelineId', 'question', 'k'],
required: process.env.VECTORIZE_PIPELINE_ID ? ['question', 'k'] : ['pipelineId', 'question', 'k'],
},
};

Expand All @@ -56,7 +56,7 @@ const DEEP_RESEARCH_TOOL: Tool = {
description: 'Whether to perform a web search.',
},
},
required: ['pipelineId', 'query', 'webSearch'],
required: process.env.VECTORIZE_PIPELINE_ID ? ['query', 'webSearch'] : ['pipelineId', 'query', 'webSearch'],
},
};

Expand Down Expand Up @@ -97,6 +97,7 @@ const server = new Server(
// Get optional API URL
const VECTORIZE_ORG_ID = process.env.VECTORIZE_ORG_ID;
const VECTORIZE_TOKEN = process.env.VECTORIZE_TOKEN;
const VECTORIZE_PIPELINE_ID = process.env.VECTORIZE_PIPELINE_ID;
// Check if API key is required (only for cloud service)
if (!VECTORIZE_ORG_ID || !VECTORIZE_TOKEN) {
console.error(
Expand Down Expand Up @@ -250,7 +251,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
case 'retrieve': {
return await performRetrieval(
VECTORIZE_ORG_ID,
args.pipelineId + '',
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
args.question + '',
Number(args.k)
);
Expand All @@ -265,7 +266,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
case 'deep-research': {
return await performDeepResearch(
VECTORIZE_ORG_ID,
args.pipelineId + '',
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
args.query + '',
Boolean(args.webSearch)
);
Expand Down Expand Up @@ -305,6 +306,13 @@ async function runServer() {
data: `Configuration: Organization ID: ${VECTORIZE_ORG_ID || 'default'}`,
});

if (VECTORIZE_PIPELINE_ID) {
server.sendLoggingMessage({
level: 'info',
data: `Configuration: Using fixed Pipeline ID: ${VECTORIZE_PIPELINE_ID}`,
});
}

console.error('Vectorize MCP Server running');
}

Expand Down