-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: mcp config generator and docs #28
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Cortex MCP Server | ||
|
|
||
| The **Model Context Protocol (MCP)** server for [Cortex](https://github.com/EcuaByte-lat/Cortex). | ||
|
|
||
| Connects your AI tools (Claude Desktop, Cursor, Zed, etc.) to your project's persistent memory. | ||
|
|
||
| ## 🚀 Usage | ||
|
|
||
| ### Quick Start (npx) | ||
|
|
||
| The easiest way to run the server is with `npx`: | ||
|
|
||
| ```bash | ||
| npx -y @ecuabyte/cortex-mcp-server | ||
| ``` | ||
|
|
||
| ### via Claude Desktop | ||
|
|
||
| Add this to your `claude_desktop_config.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "cortex": { | ||
| "command": "npx", | ||
| "args": ["-y", "@ecuabyte/cortex-mcp-server"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### via Cursor / Windsurf | ||
|
|
||
| 1. Go to **Settings** > **MCP** | ||
| 2. Add new server: | ||
| - **Type**: `command` | ||
| - **Command**: `npx` | ||
| - **Args**: `-y @ecuabyte/cortex-mcp-server` | ||
|
|
||
| ## 🛠️ Tools | ||
|
|
||
| This server provides the following MCP tools to your AI agent: | ||
|
|
||
| - `cortex_search`: Search project memories (facts, decisions, code patterns) | ||
| - `cortex_add`: Add a new memory | ||
| - `cortex_list`: List recent memories | ||
| - `cortex_context`: Get intelligent context for a specific task | ||
| - `cortex_scan`: Scan the current project to extract context automatically | ||
|
|
||
| ## 📦 Installation | ||
|
|
||
| ```bash | ||
| npm install -g @ecuabyte/cortex-mcp-server | ||
| # or | ||
| bun add -g @ecuabyte/cortex-mcp-server | ||
| ``` | ||
|
|
||
| ## 📄 License | ||
|
|
||
| MIT |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,73 @@ const store = new MemoryStore(); | |||||||||||||||||||||||||||||||
| const router = new ContextRouter(store); | ||||||||||||||||||||||||||||||||
| const guard = new ContextGuard(); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // CLI Argument Handling for `generate-config` | ||||||||||||||||||||||||||||||||
| import { parseArgs } from 'node:util'; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||
| const args = process.argv.slice(2); | ||||||||||||||||||||||||||||||||
| if (args[0] === 'generate-config') { | ||||||||||||||||||||||||||||||||
| const { values } = parseArgs({ | ||||||||||||||||||||||||||||||||
| args: args, | ||||||||||||||||||||||||||||||||
| options: { | ||||||||||||||||||||||||||||||||
| target: { | ||||||||||||||||||||||||||||||||
| type: 'string', | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| strict: false, // allow params we don't know yet (though we should know them) | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| strict: false, // allow params we don't know yet (though we should know them) | |
| strict: true, // fail on unknown params to ensure the CLI surface stays well-defined |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The catch block silently swallows errors for non-generate-config invocations. If parseArgs or the generate-config logic fails for other reasons (e.g., during normal server initialization), this will hide important errors. Consider logging the error or being more specific about which errors to ignore.
| // If parsing fails or other issues, just ignore and proceed to server start | |
| // or print error if it was clearly a CLI attempt | |
| if (process.argv[2] === 'generate-config') { | |
| console.error('Error generating config:', e); | |
| process.exit(1); | |
| } | |
| // If this was a generate-config CLI invocation, report the error and exit | |
| if (process.argv[2] === 'generate-config') { | |
| console.error('Error generating config:', e); | |
| process.exit(1); | |
| } | |
| // For all other cases, log and rethrow so startup failures are not silently swallowed | |
| console.error('[Cortex] Failed during CLI argument handling:', e); | |
| throw e; |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generate-config logic is embedded in the main server entry point, making it execute on every server start. This adds unnecessary overhead and complexity to the main server module. Consider extracting this to a separate CLI entry point or at least moving it to a dedicated function to improve maintainability.
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generate-config functionality lacks test coverage. The existing test file (mcp-server.test.ts) only tests the MCP server's JSON-RPC functionality but doesn't validate the generate-config command. Consider adding tests to verify that each target (claude, cursor, windsurf, goose) generates the correct configuration format.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||
| import { setDefaultAutoSelectFamilyAttemptTimeout } from 'node:net'; | ||||||||||
| import type { Memory } from '@ecuabyte/cortex-shared'; | ||||||||||
| import * as vscode from 'vscode'; | ||||||||||
| import { ContextObserver } from './contextObserver'; | ||||||||||
|
|
@@ -9,6 +10,14 @@ import { CortexTaskProvider } from './taskProvider'; | |||||||||
| import type { Tool } from './toolScanner'; | ||||||||||
| import { ToolTreeProvider } from './toolTreeProvider'; | ||||||||||
|
|
||||||||||
| // Set default timeout for IPv4/IPv6 family auto-selection to avoid long delays | ||||||||||
| // This fixes: Set default auto-select family attempt timeout to 1000ms | ||||||||||
|
Comment on lines
+13
to
+14
|
||||||||||
| // Set default timeout for IPv4/IPv6 family auto-selection to avoid long delays | |
| // This fixes: Set default auto-select family attempt timeout to 1000ms | |
| // Limit IPv4/IPv6 family auto-selection to 1000ms to avoid long DNS/connection delays | |
| // that can otherwise slow down network requests and VS Code extension activation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement for parseArgs is placed after the initial imports and right before the try-catch block. According to best practices and the project's TypeScript guidelines, all imports should be grouped at the top of the file. Move this import to line 1 or after the other imports from node modules.