Skip to content

fix: make pipeline_id required #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ 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

npx -y @vectorize-io/vectorize-mcp-server@latest
```

## Configuration on Claude/Windsurf/Cursor/Cline
Expand All @@ -27,7 +27,7 @@ npx -y @vectorize-io/vectorize-mcp-server
"mcpServers": {
"vectorize": {
"command": "npx",
"args": ["-y", "@vectorize-io/vectorize-mcp-server"],
"args": ["-y", "@vectorize-io/vectorize-mcp-server@latest"],
"env": {
"VECTORIZE_ORG_ID": "your-org-id",
"VECTORIZE_TOKEN": "your-token",
Expand All @@ -47,7 +47,6 @@ Perform vector search and retrieve documents (see official [API](https://docs.ve
{
"name": "retrieve",
"arguments": {
"pipeline": "your-pipeline-id",
"question": "Financial health of the company",
"k": 5
}
Expand Down Expand Up @@ -76,7 +75,6 @@ Generate a Private Deep Research from your pipeline (see official [API](https://
{
"name": "deep-research",
"arguments": {
"pipelineId": "your-pipeline-id",
"query": "Generate a financial status report about the company",
"webSearch": true
}
Expand Down
33 changes: 8 additions & 25 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const RETRIEVAL_TOOL: Tool = {
inputSchema: {
type: 'object',
properties: {

question: {
type: 'string',
description: 'The term to search for.',
Expand All @@ -28,12 +27,8 @@ const RETRIEVAL_TOOL: Tool = {
type: 'number',
description: 'The number of documents to retrieve.',
},
pipelineId: {
type: 'string',
description: 'The pipeline ID to retrieve documents from. If not specified explicitly, the value of VECTORIZE_PIPELINE_ID environment variable will be used.',
},
},
required: process.env.VECTORIZE_PIPELINE_ID ? ['question', 'k'] : ['pipelineId', 'question', 'k'],
required: ['question', 'k']
},
};

Expand All @@ -44,10 +39,6 @@ const DEEP_RESEARCH_TOOL: Tool = {
inputSchema: {
type: 'object',
properties: {
pipelineId: {
type: 'string',
description: 'The pipeline ID to retrieve documents from. If not specified explicitly, the value of VECTORIZE_PIPELINE_ID environment variable will be used.',
},
query: {
type: 'string',
description: 'The deep research query.',
Expand All @@ -57,7 +48,7 @@ const DEEP_RESEARCH_TOOL: Tool = {
description: 'Whether to perform a web search.',
},
},
required: process.env.VECTORIZE_PIPELINE_ID ? ['query', 'webSearch'] : ['pipelineId', 'query', 'webSearch'],
required: ['query', 'webSearch']
},
};

Expand Down Expand Up @@ -99,10 +90,9 @@ const server = new Server(
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) {
if (!VECTORIZE_ORG_ID || !VECTORIZE_TOKEN || !VECTORIZE_PIPELINE_ID) {
console.error(
'Error: VECTORIZE_TOKEN and VECTORIZE_ORG_ID environment variable are required'
'Error: VECTORIZE_TOKEN and VECTORIZE_ORG_ID and VECTORIZE_PIPELINE_ID environment variable are required'
);
process.exit(1);
}
Expand Down Expand Up @@ -252,7 +242,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
case 'retrieve': {
return await performRetrieval(
VECTORIZE_ORG_ID,
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
VECTORIZE_PIPELINE_ID,
args.question + '',
Number(args.k)
);
Expand All @@ -267,7 +257,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
case 'deep-research': {
return await performDeepResearch(
VECTORIZE_ORG_ID,
args.pipelineId ? (args.pipelineId + '') : (VECTORIZE_PIPELINE_ID || ''),
VECTORIZE_PIPELINE_ID,
args.query + '',
Boolean(args.webSearch)
);
Expand Down Expand Up @@ -304,17 +294,10 @@ async function runServer() {

server.sendLoggingMessage({
level: 'info',
data: `Configuration: Organization ID: ${VECTORIZE_ORG_ID || 'default'}`,
data: `Configuration: Organization ID: ${VECTORIZE_ORG_ID} with Pipeline ID: ${VECTORIZE_PIPELINE_ID}`,
});

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

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

runServer().catch((error) => {
Expand Down