Semantic Code MCP Server
# Semantic Code MCP Server
This is a Model Context Protocol (MCP) server that provides semantic code analysis capabilities using the Language Server Protocol (LSP).
## Features
- **Semantic Navigation**: Go to definition, find references, hover info.
- **Relationship Analysis**: Check if function A calls function B (using LSP references).
## Architecture
This server acts as a bridge between MCP and LSP. It spawns a `typescript-language-server` instance and translates MCP tool calls into LSP JSON-RPC requests.
## Tools
- `get_definition`: Find where a symbol is defined.
- `get_references`: Find all usages of a symbol.
- `search_in_file`: Search for a string in a file to find its line and character position.
- `check_function_call`: Analyze if one function calls another.
## Usage
### Installation
1. Clone the repository:
```bash
git clone git@github.com:thousandmiles/lsp-mcp-server.git
cd lsp-mcp-server
```
2. Run the setup script to build the project and generate the configuration:
```bash
./setup.sh
```
3. Copy the output JSON and paste it into your MCP client configuration file.
### Manual Setup
1. Install dependencies and build:
```bash
npm install
npm run build
```
2. Configure your MCP client (e.g. Claude Desktop) to run this server:
```json
{
"mcpServers": {
"semantic-code": {
"command": "node",
"args": ["/path/to/code_node/build/index.js"]
}
}
}
```
TDQS
Scored across 4 tools
Tools are mostly distinct: get_definition, get_references, and search_in_file each serve clearly different lookup purposes, while check_function_call is a specialized relationship query. However, check_function_call could overlap conceptually with get_references since call relationships are a type of reference, though the descriptions provide enough clarity to avoid serious confusion.
All tool names use snake_case and follow a verb-first style, with get_definition and get_references matching the verb_noun pattern exactly. search_in_file and check_function_call deviate slightly by including prepositions or compound objects, but the overall pattern remains predictable and readable.
Four tools is well-scoped for a semantic code navigation server. Each tool provides a distinct, non-redundant capability without feeling sparse or overwhelming.
The set covers core symbol workflows: finding definitions, references, string locations, and direct call relationships. Missing features like finding implementations or broader call-graph traversal are reasonable omissions for a focused utility set, and agents can complete common navigation tasks without major dead ends.