{"_id":"@chromia/chromia-lsp-mcp","_rev":"9-50e3c55b41b37d11d9fbeed709922fad","name":"@chromia/chromia-lsp-mcp","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.3":{"name":"@chromia/chromia-lsp-mcp","version":"0.0.3","license":"MIT","_id":"@chromia/chromia-lsp-mcp@0.0.3","maintainers":[{"name":"killerstorm","email":"alex.mizrahi@gmail.com"},{"name":"franz_chromia","email":"francesco.santanche@chromaway.com"},{"name":"dzek69","email":"npm.spam.here@nitra.pl"},{"name":"dechr","email":"david.eriksson@chromaway.com"},{"name":"vkrecl","email":"vedran.krecl@chromaway.com"},{"name":"chromaway-erik","email":"erik.akterin@chromaway.com"},{"name":"liholiho","email":"lihotan.1998@gmail.com"},{"name":"chromaway-subscription","email":"subscription@chromaway.com"},{"name":"zguiri","email":"issame.zguiri@chromaway.com"},{"name":"mert.akyazi","email":"mert.akayasi@chromaway.com"}],"bin":{"chromia-lsp-mcp":"dist/index.js"},"dist":{"shasum":"df1c74c987b3e7c358ea732fd295a5b6453075e5","tarball":"https://registry.npmjs.org/@chromia/chromia-lsp-mcp/-/chromia-lsp-mcp-0.0.3.tgz","fileCount":11,"integrity":"sha512-PuVl5uBYEcdJE6vGMej8ADgnUfJ6Zjs99JCUWnFla51jlYR2m5T0ZJ0k0wIbUD4BP1fzMf0Sczv7NkquYNUyag==","signatures":[{"sig":"MEUCIQD2eIyj4IQ985z/htBByfzmFx/k1Q8MMoq4V+sqQtgidwIgA52MUiCTwnvozzdKJ5SE1BVUoYRhksS4WcTBWm9vHYI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99672},"type":"module","gitHead":"76bdf98549a0db1111f683e7e04e97d9d596c6f4","mcpName":"com.chromaway/chromia-lsp-mcp","scripts":{"test":"npm run test:rell","build":"tsc","watch":"tsc --watch","prepare":"npm run build","test:rell":"node test/rell-lsp.test.js"},"_npmUser":{"name":"zguiri","email":"issame.zguiri@chromaway.com"},"_npmVersion":"10.9.0","description":"MCP server for Rell Language Server Protocol (LSP) integration, providing hover information, code completions, diagnostics, and code actions with resource-based access","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"^3.22.4","axios":"^1.12.0","fs-extra":"^11.3.1","fast-xml-parser":"^5.2.5","zod-to-json-schema":"^3.24.5","@modelcontextprotocol/sdk":"^0.5.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3","@types/node":"^22","@types/fs-extra":"^9.0.13"},"_npmOperationalInternal":{"tmp":"tmp/chromia-lsp-mcp_0.0.3_1757947451734_0.12050276203293642","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@chromia/chromia-lsp-mcp","version":"0.0.4","license":"MIT","_id":"@chromia/chromia-lsp-mcp@0.0.4","maintainers":[{"name":"killerstorm","email":"alex.mizrahi@gmail.com"},{"name":"franz_chromia","email":"francesco.santanche@chromaway.com"},{"name":"dzek69","email":"npm.spam.here@nitra.pl"},{"name":"dechr","email":"david.eriksson@chromaway.com"},{"name":"vkrecl","email":"vedran.krecl@chromaway.com"},{"name":"chromaway-erik","email":"erik.akterin@chromaway.com"},{"name":"liholiho","email":"lihotan.1998@gmail.com"},{"name":"chromaway-subscription","email":"subscription@chromaway.com"},{"name":"zguiri","email":"issame.zguiri@chromaway.com"},{"name":"mert.akyazi","email":"mert.akayasi@chromaway.com"}],"bin":{"chromia-lsp-mcp":"dist/index.js"},"dist":{"shasum":"fc2941b36bab6cec85ca66ef6b46c03262bc3b12","tarball":"https://registry.npmjs.org/@chromia/chromia-lsp-mcp/-/chromia-lsp-mcp-0.0.4.tgz","fileCount":11,"integrity":"sha512-hMw4QSXPLbBTHKSg4amMvCDBrm5hLRp9OPsGCA19iFgWH1+E5B1QI0FZ4cgoPxNzUlPb8iHwHxJ4/uSiFAzrFQ==","signatures":[{"sig":"MEUCIAJuODp3YY7/JiDVfRqqPvGw5amrbloSP538UBSKE5kPAiEA/kz9KKYU1cZu0tLz7J+J9LgW1eY6Csfd6s1b57QavXo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":101615},"type":"module","gitHead":"eecddaba798ed12c5d6192c5942aba993fcc37ba","mcpName":"com.chromaway/chromia-lsp-mcp","scripts":{"test":"npm run test:rell","build":"tsc","watch":"tsc --watch","prepare":"npm run build","test:rell":"node test/rell-lsp.test.js"},"_npmUser":{"name":"zguiri","email":"issame.zguiri@chromaway.com"},"_npmVersion":"10.9.0","description":"MCP server for Rell Language Server Protocol (LSP) integration, providing hover information, code completions, diagnostics, and code actions with resource-based access","directories":{},"_nodeVersion":"22.11.0","dependencies":{"zod":"^3.22.4","axios":"^1.12.0","fs-extra":"^11.3.1","fast-xml-parser":"^5.2.5","zod-to-json-schema":"^3.24.5","@modelcontextprotocol/sdk":"^0.5.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3","@types/node":"^22","@types/fs-extra":"^9.0.13"},"_npmOperationalInternal":{"tmp":"tmp/chromia-lsp-mcp_0.0.4_1758098902778_0.4522004884480533","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-09-15T14:44:11.661Z","modified":"2026-03-20T11:45:08.685Z","0.0.2":"2025-09-15T14:13:06.810Z","0.0.3":"2025-09-15T14:44:11.961Z","0.0.4":"2025-09-17T08:48:22.961Z"},"license":"MIT","description":"MCP server for Rell Language Server Protocol (LSP) integration, providing hover information, code completions, diagnostics, and code actions with resource-based access","maintainers":[{"email":"giorgi.batsashvili@chromaway.com","name":"gbatsashvili"},{"email":"alex.mizrahi@gmail.com","name":"killerstorm"},{"email":"francesco.santanche@chromaway.com","name":"franz_chromia"},{"email":"npm.spam.here@nitra.pl","name":"dzek69"},{"email":"david.eriksson@chromaway.com","name":"dechr"},{"email":"van.le@chromaway.com","name":"van.le.chr"},{"email":"vedran.krecl@chromaway.com","name":"vkrecl"},{"email":"erik.akterin@chromaway.com","name":"chromaway-erik"},{"email":"lihotan.1998@gmail.com","name":"liholiho"},{"email":"subscription@chromaway.com","name":"chromaway-subscription"},{"email":"issame.zguiri@chromaway.com","name":"zguiri"},{"email":"mert.akayasi@chromaway.com","name":"mert.akyazi"},{"email":"irakli.khidesheli@chromaway.com","name":"ikhidesh"}],"readme":"# LSP MCP Server for Rell\n\n<!--toc:start-->\n\n- [LSP MCP Server for Rell](#lsp-mcp-server-for-rell)\n  - [Overview](#overview)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n    - [Option 1: Install from NPM (Recommended)](#option-1-install-from-npm-recommended)\n    - [Option 2: Build from Source](#option-2-build-from-source)\n  - [Configuration](#configuration)\n    - [Claude Configuration for NPM Installation](#claude-configuration-for-npm-installation)\n    - [Claude Configuration for Local Build](#claude-configuration-for-local-build)\n  - [Features](#features)\n    - [MCP Tools](#mcp-tools)\n    - [MCP Resources](#mcp-resources)\n    - [Additional Features](#additional-features)\n  - [Testing](#testing)\n    - [Running Tests](#running-tests)\n    - [Test Coverage](#test-coverage)\n  - [Usage](#usage)\n    - [Important: Starting the LSP Server](#important-starting-the-lsp-server)\n    - [Logging](#logging)\n      - [Viewing Debug Logs](#viewing-debug-logs)\n  - [API](#api)\n    - [get_info_on_location](#getinfoonlocation)\n    - [get_completions](#getcompletions)\n    - [get_code_actions](#getcodeactions)\n    - [start_lsp](#startlsp)\n    - [restart_lsp_server](#restartlspserver)\n    - [open_document](#opendocument)\n    - [close_document](#closedocument)\n    - [get_diagnostics](#getdiagnostics)\n    - [set_log_level](#setloglevel)\n  - [MCP Resources](#mcp-resources)\n    - [Diagnostic Resources](#diagnostic-resources)\n    - [Hover Information Resources](#hover-information-resources)\n    - [Code Completion Resources](#code-completion-resources)\n    - [Listing Available Resources](#listing-available-resources)\n    - [Subscribing to Resource Updates](#subscribing-to-resource-updates)\n    - [Working with Resources vs. Tools](#working-with-resources-vs-tools)\n  - [Troubleshooting](#troubleshooting)\n  - [License](#license)\n  - [Acknowledgments](#acknowledgments)\n  <!--toc:end-->\n\nAn MCP (Model Context Protocol) server for interacting with the Rell Language Server Protocol (LSP) interface.\nThis server acts as a bridge that allows LLMs to query LSP Hover and Completion providers for Rell projects.\n\n## Overview\n\nThe MCP Server works by:\n\n1. Starting an LSP client that connects to a LSP server\n2. Exposing MCP tools that send requests to the LSP server\n3. Returning the results in a format that LLMs can understand and use\n\nThis enables LLMs to utilize the Rell LSP for more accurate code suggestions and analysis.\n\n## Prerequisites\n\n- Node.js (v16 or later)\n- npm\n- Java JDK (for running the Rell LSP server)\n\n## Installation\n\n### Option 1: Install from NPM (Recommended)\n\nInstall the package globally using npm:\n\n```sh\n  npm install @chromia/chromia-lsp-mcp -g\n```\n\n### Option 2: Build from Source\n\n1. Clone this repository:\n\n   ```sh\n   git clone ...\n   cd lsp-mcp\n   ```\n\n2. Install dependencies:\n\n   ```sh\n   npm install\n   ```\n\n3. Build the MCP server:\n\n   ```sh\n   npm run build\n   ```\n\n## Configuration\n\nAfter installation, you need to configure Claude to use the MCP server.\n\n### Claude Configuration for NPM Installation\n\n```json\n{\n  \"mcpServers\": {\n    \"lsp-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"chromia-lsp-mcp\",\n        \"0.8.8\" // optional Rell LSP version\n      ]\n    }\n  }\n}\n```\n\n### Claude Configuration for Local Build\n\n```json\n{\n  \"mcpServers\": {\n    \"chromia-lsp-mcp\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/this/project/dist/index.js\"]\n    }\n  }\n}\n```\n\n> **Parameters** :\n>\n> - `Rell LSP version`:\n>   optional argument to explicitly set which Rell LSP version it should be used, otherwise, it will look for cached LSP jars, if not found it will download the latest version e.g: `0.8.8`\n\n## Features\n\n### MCP Tools\n\n- `get_info_on_location`: Get hover information at a specific location in a file\n- `get_completions`: Get completion suggestions at a specific location in a file\n- `get_code_actions`: Get code actions for a specific range in a file\n- `open_document`: Open a file in the LSP server for analysis\n- `close_document`: Close a file in the LSP server\n- `get_diagnostics`: Get diagnostic messages (errors, warnings) for open files\n- `start_lsp`: Start the LSP server with a specified root directory\n- `restart_lsp_server`: Restart the LSP server without restarting the MCP server\n- `set_log_level`: Change the server's logging verbosity level at runtime\n\n### MCP Resources\n\n- `lsp-diagnostics://` resources for accessing diagnostic messages with real-time updates via subscriptions\n- `lsp-hover://` resources for retrieving hover information at specific file locations\n- `lsp-completions://` resources for getting code completion suggestions at specific positions\n\n### Additional Features\n\n- Comprehensive logging system with multiple severity levels\n- Colorized console output for better readability\n- Runtime-configurable log level\n- Detailed error handling and reporting\n- Simple command-line interface\n\n## Testing\n\nThe project includes integration tests for the Rell LSP support. These tests verify that the LSP-MCP server correctly handles LSP operations like hover information, completions, diagnostics, and code actions with the Rell language server.\n\n### Running Tests\n\nTo run the Rell LSP tests:\n\n```\nnpm test\n```\n\n### Test Coverage\n\nThe tests verify the following functionality:\n\n- Automatic downloading and initialization of the Rell LSP server\n- Opening Rell files for analysis\n- Getting hover information for functions and types\n- Getting code completion suggestions\n- Getting diagnostic error messages\n- Getting code actions for errors\n\n## Usage\n\nRun the MCP server directly with Node.js:\n\n```\nnode dist/index.js\n```\n\nThe server automatically downloads and manages the Rell LSP server JAR file, so no additional configuration is needed. The Rell LSP server will be downloaded to `~/.chromia/lsp-mcp/` on first use.\n\n### Important: Starting the LSP Server\n\nYou must explicitly start the LSP server by calling the `start_lsp` tool before using any LSP functionality. This ensures proper initialization with the correct root directory for your Rell project:\n\n```json\n{\n  \"tool\": \"start_lsp\",\n  \"arguments\": {\n    \"root_dir\": \"/path/to/your/project\"\n  }\n}\n```\n\n### Logging\n\nThe server includes a comprehensive logging system with 8 severity levels:\n\n- `debug`: Detailed information for debugging purposes\n- `info`: General informational messages about system operation\n- `notice`: Significant operational events\n- `warning`: Potential issues that might need attention\n- `error`: Error conditions that affect operation but don't halt the system\n- `critical`: Critical conditions requiring immediate attention\n- `alert`: System is in an unstable state\n- `emergency`: System is unusable\n\nBy default, logs are sent to:\n\n1. Console output with color-coding for better readability\n2. MCP notifications to the client (via the `notifications/message` method)\n\n#### Viewing Debug Logs\n\nFor detailed debugging, you can:\n\n1. Use the `claude --mcp-debug` flag when running Claude to see all MCP traffic between Claude and the server:\n\n   ```\n   claude --mcp-debug\n   ```\n\n2. Change the log level at runtime using the `set_log_level` tool:\n\n   ```json\n   {\n     \"tool\": \"set_log_level\",\n     \"arguments\": {\n       \"level\": \"debug\"\n     }\n   }\n   ```\n\nThe default log level is `info`, which shows moderate operational detail while filtering out verbose debug messages.\n\n## API\n\nThe server provides the following MCP tools:\n\n### get_info_on_location\n\nGets hover information at a specific location in a file.\n\nParameters:\n\n- `file_path`: Path to the file\n- `line`: Line number\n- `column`: Column position\n\nExample:\n\n```json\n{\n  \"tool\": \"get_info_on_location\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file.rell\",\n    \"line\": 3,\n    \"column\": 5\n  }\n}\n```\n\n### get_completions\n\nGets completion suggestions at a specific location in a file.\n\nParameters:\n\n- `file_path`: Path to the file\n- `line`: Line number\n- `column`: Column position\n\nExample:\n\n```json\n{\n  \"tool\": \"get_completions\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file.rell\",\n    \"line\": 3,\n    \"column\": 10\n  }\n}\n```\n\n### get_code_actions\n\nGets code actions for a specific range in a file.\n\nParameters:\n\n- `file_path`: Path to the file\n- `start_line`: Start line number\n- `start_column`: Start column position\n- `end_line`: End line number\n- `end_column`: End column position\n\nExample:\n\n```json\n{\n  \"tool\": \"get_code_actions\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file.rell\",\n    \"start_line\": 3,\n    \"start_column\": 5,\n    \"end_line\": 3,\n    \"end_column\": 10\n  }\n}\n```\n\n### start_lsp\n\nStarts the LSP server with a specified root directory. This must be called before using any other LSP-related tools.\n\nParameters:\n\n- `root_dir`: The root directory for the LSP server (absolute path recommended)\n\nExample:\n\n```json\n{\n  \"tool\": \"start_lsp\",\n  \"arguments\": {\n    \"root_dir\": \"/path/to/your/project\"\n  }\n}\n```\n\n### restart_lsp_server\n\nRestarts the LSP server process without restarting the MCP server.\nThis is useful for recovering from LSP server issues or for applying changes to the LSP server configuration.\n\nParameters:\n\n- `root_dir`: (Optional) The root directory for the LSP server. If provided, the server will be initialized with this directory after restart.\n\nExample without root_dir (uses previously set root directory):\n\n```json\n{\n  \"tool\": \"restart_lsp_server\",\n  \"arguments\": {}\n}\n```\n\nExample with root_dir:\n\n```json\n{\n  \"tool\": \"restart_lsp_server\",\n  \"arguments\": {\n    \"root_dir\": \"/path/to/your/project\"\n  }\n}\n```\n\n### open_document\n\nOpens a file in the LSP server for analysis. This must be called before accessing diagnostics or performing other operations on the file.\n\nParameters:\n\n- `file_path`: Path to the file to open\n\nExample:\n\n```json\n{\n  \"tool\": \"open_document\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file.rell\"\n  }\n}\n```\n\n### close_document\n\nCloses a file in the LSP server when you're done working with it. This helps manage resources and cleanup.\n\nParameters:\n\n- `file_path`: Path to the file to close\n\nExample:\n\n```json\n{\n  \"tool\": \"close_document\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file\"\n  }\n}\n```\n\n### get_diagnostics\n\nGets diagnostic messages (errors, warnings) for one or all open files.\n\nParameters:\n\n- `file_path`: (Optional) Path to the file to get diagnostics for. If not provided, returns diagnostics for all open files.\n\nExample for a specific file:\n\n```json\n{\n  \"tool\": \"get_diagnostics\",\n  \"arguments\": {\n    \"file_path\": \"/path/to/your/file\"\n  }\n}\n```\n\nExample for all open files:\n\n```json\n{\n  \"tool\": \"get_diagnostics\",\n  \"arguments\": {}\n}\n```\n\n### set_log_level\n\nSets the server's logging level to control verbosity of log messages.\n\nParameters:\n\n- `level`: The logging level to set. One of: `debug`, `info`, `notice`, `warning`, `error`, `critical`, `alert`, `emergency`.\n\nExample:\n\n```json\n{\n  \"tool\": \"set_log_level\",\n  \"arguments\": {\n    \"level\": \"debug\"\n  }\n}\n```\n\n## MCP Resources\n\nIn addition to tools, the server provides resources for accessing LSP features including diagnostics, hover information, and code completions:\n\n### Diagnostic Resources\n\nThe server exposes diagnostic information via the `lsp-diagnostics://` resource scheme. These resources can be subscribed to for real-time updates when diagnostics change.\n\nResource URIs:\n\n- `lsp-diagnostics://` - Diagnostics for all open files\n- `lsp-diagnostics:///path/to/file` - Diagnostics for a specific file\n\nImportant: Files must be opened using the `open_document` tool before diagnostics can be accessed.\n\n### Hover Information Resources\n\nThe server exposes hover information via the `lsp-hover://` resource scheme. This allows you to get information about code elements at specific positions in files.\n\nResource URI format:\n\n```\nlsp-hover:///path/to/file?line={line}&column={column}\n```\n\nParameters:\n\n- `line`: Line number (1-based)\n- `column`: Column position (1-based)\n\nExample:\n\n```\nlsp-hover:///home/user/project/src/main.rell?line=42&column=10\n```\n\n### Code Completion Resources\n\nThe server exposes code completion suggestions via the `lsp-completions://` resource scheme. This allows you to get completion candidates at specific positions in files.\n\nResource URI format:\n\n```\nlsp-completions:///path/to/file?line={line}&column={column}\n```\n\nParameters:\n\n- `line`: Line number (1-based)\n- `column`: Column position (1-based)\n\nExample:\n\n```\nlsp-completions:///home/user/project/src/main.rell?line=42&column=10\n```\n\n### Listing Available Resources\n\nTo discover available resources, use the MCP `resources/list` endpoint. The response will include all available resources for currently open files, including:\n\n- Diagnostics resources for all open files\n- Hover information templates for all open files\n- Code completion templates for all open files\n\n### Subscribing to Resource Updates\n\nDiagnostic resources support subscriptions to receive real-time updates when diagnostics change (e.g., when files are modified and new errors or warnings appear). Subscribe to diagnostic resources using the MCP `resources/subscribe` endpoint.\n\nNote: Hover and completion resources don't support subscriptions as they represent point-in-time queries.\n\n### Working with Resources vs. Tools\n\nYou can choose between two approaches for accessing LSP features:\n\n1. Tool-based approach: Use the `get_diagnostics`, `get_info_on_location`, and `get_completions` tools for a simple, direct way to fetch information.\n2. Resource-based approach: Use the `lsp-diagnostics://`, `lsp-hover://`, and `lsp-completions://` resources for a more RESTful approach.\n\nBoth approaches provide the same data in the same format and enforce the same requirement that files must be opened first.\n\n## Troubleshooting\n\n- If the server fails to start, make sure the path to the LSP executable is correct\n- Check the log file (if configured) for detailed error messages\n\n## License\n\nMIT License\n\n## Acknowledgments\n\n- [@Tritlo/lsp-mcp](https://github.com/Tritlo/lsp-mcp) for the original implementation\n- Anthropic for the Model Context Protocol specification\n","readmeFilename":"README.md"}