Context7 Platform -- Up-to-date docs for AI agents
refactor: deprecate sse cli argument
enesgules920c025d9502
diff --git a/README.md b/README.mdindex c5844efa..3ad6fe1f 100644--- a/README.md+++ b/README.md@@ -44,6 +44,7 @@ Check out our [project addition guide](./docs/adding-projects.md) to learn how t- Node.js >= v18.0.0- Cursor, Windsurf, Claude Desktop or another MCP Client+- Context7 API Key (Optional for higher rate limits) (Get yours by creating an account at [context7.com/console](https://context7.com/console))<details><summary><b>Installing via Smithery</b></summary>@@ -676,9 +677,9 @@ bun run dist/index.js`context7-mcp` accepts the following CLI flags:-- `--transport <stdio|http|sse>` – Transport to use (`stdio` by default).-- `--port <number>` – Port to listen on when using `http` or `sse` transport (default `3000`).-- `--api-key <key>` – API key for stdio transport if you want to authenticate requests.+- `--transport <stdio|http>` – Transport to use (`stdio` by default). Note that HTTP transport automatically provides both HTTP and SSE endpoints.+- `--port <number>` – Port to listen on when using `http` transport (default `3000`).+- `--api-key <key>` – API key for authentication. You can get your API key by creating an account at [context7.com/console](https://context7.com/console).Example with http transport and port 8080:diff --git a/src/index.ts b/src/index.tsindex 4f55cc84..99453939 100644--- a/src/index.ts+++ b/src/index.ts@@ -15,9 +15,9 @@ const DEFAULT_MINIMUM_TOKENS = 10000;// Parse CLI arguments using commanderconst program = new Command()- .option("--transport <stdio|http|sse>", "transport type", "stdio")- .option("--port <number>", "port for HTTP/SSE transport", "3000")- .option("--api-key <key>", "API key for stdio transport")+ .option("--transport <stdio|http>", "transport type", "stdio")+ .option("--port <number>", "port for HTTP transport", "3000")+ .option("--api-key <key>", "API key for authentication").allowUnknownOption() // let MCP Inspector / other wrappers pass through extra flags.parse(process.argv);@@ -28,18 +28,18 @@ const cliOptions = program.opts<{}>();// Validate transport option-const allowedTransports = ["stdio", "http", "sse"];+const allowedTransports = ["stdio", "http"];if (!allowedTransports.includes(cliOptions.transport)) {console.error(- `Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http, sse.`+ `Invalid --transport value: '${cliOptions.transport}'. Must be one of: stdio, http.`);process.exit(1);}// Transport configuration-const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http" | "sse";+const TRANSPORT_TYPE = (cliOptions.transport || "stdio") as "stdio" | "http";-// HTTP/SSE port configuration+// HTTP port configurationconst CLI_PORT = (() => {const parsed = parseInt(cliOptions.port, 10);return isNaN(parsed) ? undefined : parsed;@@ -197,7 +197,7 @@ ${resultsText}`,async function main() {const transportType = TRANSPORT_TYPE;- if (transportType === "http" || transportType === "sse") {+ if (transportType === "http") {// Get initial port from environment or use defaultconst initialPort = CLI_PORT ?? 3000;// Keep track of which port we end up using@@ -306,7 +306,7 @@ async function main() {httpServer.listen(port, () => {actualPort = port;console.error(- `Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp and legacy SSE at /sse`+ `Context7 Documentation MCP Server running on ${transportType.toUpperCase()} at http://localhost:${actualPort}/mcp with SSE endpoint at /sse`);});};