metals-mcp
MCP wrapper for the Metals Scala language server, providing file editing and refactoring tools for Scala projects.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
metals-mcp
MCP wrapper for Metals (Scala language server) that adds file editing and refactoring tools.
Prerequisites
Node.js 22+
metals-mcpbinary on PATH (or setMETALS_MCP_PATH)
Related MCP server: ast-editor
Install
npm installUsage
Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"metals": {
"command": "npx",
"args": ["tsx", "src/index.ts", "--workspace", "/path/to/scala/project"]
}
}
}Or globally in ~/.claude.json:
{
"mcpServers": {
"metals": {
"command": "npx",
"args": ["--prefix", "/path/to/metals-mcp", "tsx", "src/index.ts", "--workspace", "/path/to/scala/project"]
}
}
}Manual
npx tsx src/index.ts --workspace /path/to/scala/projectTools
File operations: read-file, write-file, edit-file, list-files
Refactoring: rename-symbol, add-import, remove-unused-imports
All Metals tools are also proxied transparently when Metals connects.
Configuration
Option | Description |
| Scala project root (required) |
| Custom path to metals-mcp binary |
ERR_MODULE_NOT_FOUND or "Failed to reconnect to metals"
If the MCP server is configured in .mcp.json with a relative path for the entry point:
{
"mcpServers": {
"metals": {
"command": "npx",
"args": ["--prefix", "/path/to/metals-lsp", "tsx", "src/index.ts"]
}
}
}The npx --prefix flag sets the package lookup directory, but the working directory remains the project being edited. The relative src/index.ts resolves against the workspace, not the plugin directory, causing the module-not-found error.
Fix: Use an absolute path for the entry point:
{
"mcpServers": {
"metals": {
"command": "npx",
"args": ["--prefix", "/path/to/metals-lsp", "tsx", "/path/to/metals-lsp/src/index.ts"]
}
}
}Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
Metals API MCP — wraps Metals-API (metals-api.com)
The official Svelte MCP server providing docs and autofixing tools for Svelte development
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceExposes Language Server Protocol (LSP) features as MCP tools, enabling IDE-grade semantic navigation including go-to-definition, find references, hover info, and symbols across multiple programming languages (Python, Rust, C/C++, TypeScript/JavaScript, React, HTML, CSS).4MIT
- AlicenseAqualityBmaintenanceAST-targeted code editing MCP server with 28 surgical tools for structural edits across 11 languages. Built on tree-sitter, replaces brittle search/replace with byte-correct edits keyed by symbol names.228MIT
- AlicenseNot gradedqualityDmaintenanceExposes Language Server Protocol (LSP) tools such as diagnostics, goto definition, find references, symbols, and rename as a stdio MCP server.8MIT
- AlicenseAqualityDmaintenanceBridges MCP and LSP to enable semantic code analysis, including go-to-definition, find references, hover info, and function call relationship checks.4ISC