MCP Mode#388
Open
moigagoo wants to merge 85 commits intonim-lang:masterfrom
Open
Conversation
nimFindReferences is a functioning route. nimExpandMacro and nimDiagnostics are placeholder routes.
For some reason, previosly the content of the checked file was put into the project file's stash copy.
…n LanguageServer.
MCP spec requires those to be empty object and array respectively if the tool doesn't have properties, but json module serializes none values to nil.
Per MCP spec.
Since we're checking a single file, the path will have the same value for all symbols.
jmgomez
reviewed
Apr 24, 2026
jmgomez
reviewed
Apr 24, 2026
jmgomez
reviewed
Apr 24, 2026
jmgomez
reviewed
Apr 24, 2026
jmgomez
requested changes
Apr 24, 2026
jmgomez
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an MCP (Model Context Protocol) server mode to nimlangserver, enabling AI coding agents (GitHub Copilot, Gemini, Claude, etc.) to use the language server as an MCP tool provider in addition to its existing LSP role.
Five MCP tools are exposed, backed by nimsuggest:
Tools return structured JSON conforming to MCP's outputSchema format.
framing)
Skill definitions instructs AI agents to prefer these MCP tools over grep/shell for all Nim symbol and diagnostics tasks, with guidance on Nim-specific terminology mapping.
MCP config files are included for Copilot CLI (.mcp.json), VS Code (.vscode/mcp.json), and Gemini (.gemini/settings.json).
Once nimlangserver is registered as an MCP server, AI agents can call the tools directly. For example, asking "check this project for errors" triggers nimCheckProject and returns structured diagnostics:
{ "diags": [ { "path": "/path/to/mymodule.nim", "line": 12, "column": 5, "severity": "Error", "message": "type mismatch: got 'string' but expected 'int'" } ] }Asking "find all usages of myProc" calls nimFindReferences at the symbol location and returns:
{ "refs": [ { "path": "/path/to/main.nim", "line": 7, "column": 3 }, { "path": "/path/to/utils.nim", "line": 42, "column": 11 } ] }