@contextstream/mcp-server 0.4.7 → 0.4.9
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/dist/index.js +102 -6
- package/dist/test-server.js +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4051,8 +4051,9 @@ var coerce = {
|
|
|
4051
4051
|
var NEVER = INVALID;
|
|
4052
4052
|
|
|
4053
4053
|
// src/config.ts
|
|
4054
|
+
var DEFAULT_API_URL = "https://api.contextstream.io";
|
|
4054
4055
|
var configSchema = external_exports.object({
|
|
4055
|
-
apiUrl: external_exports.string().url(),
|
|
4056
|
+
apiUrl: external_exports.string().url().default(DEFAULT_API_URL),
|
|
4056
4057
|
apiKey: external_exports.string().min(1).optional(),
|
|
4057
4058
|
jwt: external_exports.string().min(1).optional(),
|
|
4058
4059
|
defaultWorkspaceId: external_exports.string().uuid().optional(),
|
|
@@ -4060,6 +4061,13 @@ var configSchema = external_exports.object({
|
|
|
4060
4061
|
userAgent: external_exports.string().default("contextstream-mcp/0.1.0"),
|
|
4061
4062
|
allowHeaderAuth: external_exports.boolean().optional()
|
|
4062
4063
|
});
|
|
4064
|
+
var MISSING_CREDENTIALS_ERROR = "Set CONTEXTSTREAM_API_KEY or CONTEXTSTREAM_JWT for authentication (or CONTEXTSTREAM_ALLOW_HEADER_AUTH=true for header-based auth).";
|
|
4065
|
+
function isMissingCredentialsError(err) {
|
|
4066
|
+
if (err instanceof Error) {
|
|
4067
|
+
return err.message === MISSING_CREDENTIALS_ERROR;
|
|
4068
|
+
}
|
|
4069
|
+
return false;
|
|
4070
|
+
}
|
|
4063
4071
|
function loadConfig() {
|
|
4064
4072
|
const allowHeaderAuth = process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "1" || process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "true" || process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "yes";
|
|
4065
4073
|
const parsed = configSchema.safeParse({
|
|
@@ -4078,7 +4086,7 @@ function loadConfig() {
|
|
|
4078
4086
|
);
|
|
4079
4087
|
}
|
|
4080
4088
|
if (!parsed.data.apiKey && !parsed.data.jwt && !parsed.data.allowHeaderAuth) {
|
|
4081
|
-
throw new Error(
|
|
4089
|
+
throw new Error(MISSING_CREDENTIALS_ERROR);
|
|
4082
4090
|
}
|
|
4083
4091
|
return parsed.data;
|
|
4084
4092
|
}
|
|
@@ -13485,6 +13493,40 @@ Each domain tool has an 'action' parameter for specific operations.` : "";
|
|
|
13485
13493
|
console.error(`[ContextStream] Consolidated mode: Registered ${CONSOLIDATED_TOOLS.size} domain tools.`);
|
|
13486
13494
|
}
|
|
13487
13495
|
}
|
|
13496
|
+
function registerLimitedTools(server) {
|
|
13497
|
+
server.registerTool(
|
|
13498
|
+
"contextstream_setup",
|
|
13499
|
+
{
|
|
13500
|
+
title: "ContextStream Setup Required",
|
|
13501
|
+
description: "ContextStream is not configured. Call this tool for setup instructions.",
|
|
13502
|
+
inputSchema: { type: "object", properties: {} }
|
|
13503
|
+
},
|
|
13504
|
+
async () => {
|
|
13505
|
+
return {
|
|
13506
|
+
content: [
|
|
13507
|
+
{
|
|
13508
|
+
type: "text",
|
|
13509
|
+
text: `ContextStream: API key not configured.
|
|
13510
|
+
|
|
13511
|
+
To set up (creates key + configures your editor):
|
|
13512
|
+
npx -y @contextstream/mcp-server setup
|
|
13513
|
+
|
|
13514
|
+
This will:
|
|
13515
|
+
- Start a 5-day Pro trial
|
|
13516
|
+
- Auto-configure your editor's MCP settings
|
|
13517
|
+
- Write rules files for better AI assistance
|
|
13518
|
+
|
|
13519
|
+
Preview first:
|
|
13520
|
+
npx -y @contextstream/mcp-server setup --dry-run
|
|
13521
|
+
|
|
13522
|
+
After setup, restart your editor to enable all ContextStream tools.`
|
|
13523
|
+
}
|
|
13524
|
+
]
|
|
13525
|
+
};
|
|
13526
|
+
}
|
|
13527
|
+
);
|
|
13528
|
+
console.error("[ContextStream] Limited mode: Registered setup helper tool only.");
|
|
13529
|
+
}
|
|
13488
13530
|
|
|
13489
13531
|
// src/resources.ts
|
|
13490
13532
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -15180,6 +15222,7 @@ async function isEditorInstalled(editor) {
|
|
|
15180
15222
|
return false;
|
|
15181
15223
|
}
|
|
15182
15224
|
}
|
|
15225
|
+
var IS_WINDOWS = process.platform === "win32";
|
|
15183
15226
|
function buildContextStreamMcpServer(params) {
|
|
15184
15227
|
const env = {
|
|
15185
15228
|
CONTEXTSTREAM_API_URL: params.apiUrl,
|
|
@@ -15188,6 +15231,13 @@ function buildContextStreamMcpServer(params) {
|
|
|
15188
15231
|
if (params.toolset === "router") {
|
|
15189
15232
|
env.CONTEXTSTREAM_PROGRESSIVE_MODE = "true";
|
|
15190
15233
|
}
|
|
15234
|
+
if (IS_WINDOWS) {
|
|
15235
|
+
return {
|
|
15236
|
+
command: "cmd",
|
|
15237
|
+
args: ["/c", "npx", "-y", "@contextstream/mcp-server"],
|
|
15238
|
+
env
|
|
15239
|
+
};
|
|
15240
|
+
}
|
|
15191
15241
|
return {
|
|
15192
15242
|
command: "npx",
|
|
15193
15243
|
args: ["-y", "@contextstream/mcp-server"],
|
|
@@ -15202,6 +15252,14 @@ function buildContextStreamVsCodeServer(params) {
|
|
|
15202
15252
|
if (params.toolset === "router") {
|
|
15203
15253
|
env.CONTEXTSTREAM_PROGRESSIVE_MODE = "true";
|
|
15204
15254
|
}
|
|
15255
|
+
if (IS_WINDOWS) {
|
|
15256
|
+
return {
|
|
15257
|
+
type: "stdio",
|
|
15258
|
+
command: "cmd",
|
|
15259
|
+
args: ["/c", "npx", "-y", "@contextstream/mcp-server"],
|
|
15260
|
+
env
|
|
15261
|
+
};
|
|
15262
|
+
}
|
|
15205
15263
|
return {
|
|
15206
15264
|
type: "stdio",
|
|
15207
15265
|
command: "npx",
|
|
@@ -15284,13 +15342,16 @@ async function upsertCodexTomlConfig(filePath, params) {
|
|
|
15284
15342
|
const envMarker = "[mcp_servers.contextstream.env]";
|
|
15285
15343
|
const toolsetLine = params.toolset === "router" ? `CONTEXTSTREAM_PROGRESSIVE_MODE = "true"
|
|
15286
15344
|
` : "";
|
|
15345
|
+
const commandLine = IS_WINDOWS ? `command = "cmd"
|
|
15346
|
+
args = ["/c", "npx", "-y", "@contextstream/mcp-server"]
|
|
15347
|
+
` : `command = "npx"
|
|
15348
|
+
args = ["-y", "@contextstream/mcp-server"]
|
|
15349
|
+
`;
|
|
15287
15350
|
const block = `
|
|
15288
15351
|
|
|
15289
15352
|
# ContextStream MCP server
|
|
15290
15353
|
[mcp_servers.contextstream]
|
|
15291
|
-
|
|
15292
|
-
args = ["-y", "@contextstream/mcp-server"]
|
|
15293
|
-
|
|
15354
|
+
` + commandLine + `
|
|
15294
15355
|
[mcp_servers.contextstream.env]
|
|
15295
15356
|
CONTEXTSTREAM_API_URL = "${params.apiUrl}"
|
|
15296
15357
|
CONTEXTSTREAM_API_KEY = "${params.apiKey}"
|
|
@@ -15903,6 +15964,13 @@ Applying to ${projects.length} project(s)...`);
|
|
|
15903
15964
|
if (toolset === "router") {
|
|
15904
15965
|
console.log("- Router mode uses 2 meta-tools (session_init + context_smart) for ultra-minimal token usage.");
|
|
15905
15966
|
}
|
|
15967
|
+
console.log("");
|
|
15968
|
+
console.log("You're set up! Now try these prompts in your AI tool:");
|
|
15969
|
+
console.log(' 1) "session summary"');
|
|
15970
|
+
console.log(` 2) "remember we're using PostgreSQL"`);
|
|
15971
|
+
console.log(' 3) "what did we decide about auth?"');
|
|
15972
|
+
console.log("");
|
|
15973
|
+
console.log("More at: https://contextstream.io/docs/mcp");
|
|
15906
15974
|
} finally {
|
|
15907
15975
|
rl.close();
|
|
15908
15976
|
}
|
|
@@ -15986,6 +16054,18 @@ Notes:
|
|
|
15986
16054
|
set these env vars in the client's MCP server configuration.
|
|
15987
16055
|
- The server communicates over stdio; logs are written to stderr.`);
|
|
15988
16056
|
}
|
|
16057
|
+
async function runLimitedModeServer() {
|
|
16058
|
+
const server = new McpServer2({
|
|
16059
|
+
name: "contextstream-mcp",
|
|
16060
|
+
version: VERSION
|
|
16061
|
+
});
|
|
16062
|
+
registerLimitedTools(server);
|
|
16063
|
+
console.error(`ContextStream MCP server v${VERSION} (limited mode)`);
|
|
16064
|
+
console.error('Run "npx -y @contextstream/mcp-server setup" to enable all tools.');
|
|
16065
|
+
const transport = new StdioServerTransport();
|
|
16066
|
+
await server.connect(transport);
|
|
16067
|
+
console.error("ContextStream MCP server connected (limited mode - setup required)");
|
|
16068
|
+
}
|
|
15989
16069
|
async function main() {
|
|
15990
16070
|
const args = process.argv.slice(2);
|
|
15991
16071
|
if (args.includes("--help") || args.includes("-h")) {
|
|
@@ -16007,7 +16087,23 @@ async function main() {
|
|
|
16007
16087
|
await runHttpGateway();
|
|
16008
16088
|
return;
|
|
16009
16089
|
}
|
|
16010
|
-
|
|
16090
|
+
if (!process.env.CONTEXTSTREAM_API_KEY && !process.env.CONTEXTSTREAM_JWT) {
|
|
16091
|
+
const saved = await readSavedCredentials();
|
|
16092
|
+
if (saved) {
|
|
16093
|
+
process.env.CONTEXTSTREAM_API_URL = saved.api_url;
|
|
16094
|
+
process.env.CONTEXTSTREAM_API_KEY = saved.api_key;
|
|
16095
|
+
}
|
|
16096
|
+
}
|
|
16097
|
+
let config;
|
|
16098
|
+
try {
|
|
16099
|
+
config = loadConfig();
|
|
16100
|
+
} catch (err) {
|
|
16101
|
+
if (isMissingCredentialsError(err)) {
|
|
16102
|
+
await runLimitedModeServer();
|
|
16103
|
+
return;
|
|
16104
|
+
}
|
|
16105
|
+
throw err;
|
|
16106
|
+
}
|
|
16011
16107
|
const client = new ContextStreamClient(config);
|
|
16012
16108
|
const server = new McpServer2({
|
|
16013
16109
|
name: "contextstream-mcp",
|
package/dist/test-server.js
CHANGED
|
@@ -4051,8 +4051,9 @@ var coerce = {
|
|
|
4051
4051
|
var NEVER = INVALID;
|
|
4052
4052
|
|
|
4053
4053
|
// src/config.ts
|
|
4054
|
+
var DEFAULT_API_URL = "https://api.contextstream.io";
|
|
4054
4055
|
var configSchema = external_exports.object({
|
|
4055
|
-
apiUrl: external_exports.string().url(),
|
|
4056
|
+
apiUrl: external_exports.string().url().default(DEFAULT_API_URL),
|
|
4056
4057
|
apiKey: external_exports.string().min(1).optional(),
|
|
4057
4058
|
jwt: external_exports.string().min(1).optional(),
|
|
4058
4059
|
defaultWorkspaceId: external_exports.string().uuid().optional(),
|
|
@@ -4060,6 +4061,7 @@ var configSchema = external_exports.object({
|
|
|
4060
4061
|
userAgent: external_exports.string().default("contextstream-mcp/0.1.0"),
|
|
4061
4062
|
allowHeaderAuth: external_exports.boolean().optional()
|
|
4062
4063
|
});
|
|
4064
|
+
var MISSING_CREDENTIALS_ERROR = "Set CONTEXTSTREAM_API_KEY or CONTEXTSTREAM_JWT for authentication (or CONTEXTSTREAM_ALLOW_HEADER_AUTH=true for header-based auth).";
|
|
4063
4065
|
function loadConfig() {
|
|
4064
4066
|
const allowHeaderAuth = process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "1" || process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "true" || process.env.CONTEXTSTREAM_ALLOW_HEADER_AUTH === "yes";
|
|
4065
4067
|
const parsed = configSchema.safeParse({
|
|
@@ -4078,7 +4080,7 @@ function loadConfig() {
|
|
|
4078
4080
|
);
|
|
4079
4081
|
}
|
|
4080
4082
|
if (!parsed.data.apiKey && !parsed.data.jwt && !parsed.data.allowHeaderAuth) {
|
|
4081
|
-
throw new Error(
|
|
4083
|
+
throw new Error(MISSING_CREDENTIALS_ERROR);
|
|
4082
4084
|
}
|
|
4083
4085
|
return parsed.data;
|
|
4084
4086
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contextstream/mcp-server",
|
|
3
3
|
"mcpName": "io.github.contextstreamio/mcp-server",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.9",
|
|
5
5
|
"description": "ContextStream MCP server - v0.4.x with consolidated domain tools (~11 tools, ~75% token reduction). Code context, memory, search, and AI tools.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|