Skip to main content
Glama
hrustalevdev

Project Navigator MCP Server

by hrustalevdev

Project Navigator MCP Server

MCP-сервер для навигации по кодовой базе. Позволяет AI-агенту в IDE самостоятельно исследовать проект: просматривать файлы, искать символы и запускать безопасные команды — без ручного копирования кода в чат.

Как работает MCP

IDE запускает MCP-сервер как дочерний процесс и общается с ним через stdin/stdout. Агент вызывает инструменты (tools) — типизированные функции с описанием и схемой параметров. Это позволяет агенту автономно получать контекст из внешних источников (файловая система, команды) вместо того, чтобы ждать, пока пользователь всё скопирует вручную.

В этом сервере tool — это изолированная функция с именем, описанием, JSON-схемой входных параметров и структурированным JSON-ответом.

Related MCP server: Files MCP Server

Инструменты

Инструмент

Описание

list_directory

Список файлов и папок в директории

read_file

Чтение содержимого файла (опционально — диапазон строк)

find_files

Поиск файлов по glob-паттерну (**/*.ts)

search_code

Полнотекстовый поиск по файлам проекта

run_command

Запуск команды из whitelist

Tool outputs contract

Все инструменты возвращают структурированный JSON:

// list_directory
{ entries: Array<{ name: string; type: "file" | "dir"; path: string }> }

// read_file
{ content: string; total_lines: number; path: string }

// find_files
{ files: string[]; count: number }

// search_code
{ matches: Array<{ file: string; line: number; content: string }>; count: number }

// run_command
{ stdout: string; stderr: string; exit_code: number; success: boolean }

Ошибки возвращаются через стандартный MCP error response.

Структура проекта

src/
  index.ts              ← bootstrap (env → startServer)
  server.ts             ← McpServer, регистрация инструментов
  logger/
    index.ts            ← logCall / logSuccess / logError → stderr
    index.test.ts
  security/
    index.ts            ← assertInProjectRoot (path traversal guard)
    index.test.ts
  tools/
    list-directory/index.ts + index.test.ts
    read-file/index.ts + index.test.ts
    find-files/index.ts + index.test.ts
    search-code/index.ts + index.test.ts
    run-command/index.ts + index.test.ts

Запуск через Docker (рекомендуется)

Node.js на машине не нужен.

docker build -t project-navigator-mcp .

Проверка (smoke test):

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
  | docker run --rm -i project-navigator-mcp

Ожидаемый результат — JSON с 5 инструментами: list_directory, read_file, find_files, search_code, run_command.

Ограничение run_command в Docker: инструмент запускает команды в директории PROJECT_ROOT. Если node_modules целевого проекта установлен на другой ОС (например, macOS), нативные биндинги (rolldown, esbuild и т.п.) не будут работать внутри Linux-контейнера. В этом случае npm test упадёт с ошибкой о нативном модуле — это ограничение окружения, не сервера. Для запуска тестов используйте Node.js-вариант (без Docker) или предварительно выполните npm install в целевом проекте внутри контейнера.

Интеграция с агентами и IDE

MCP — открытый протокол. Сервер работает с любым MCP-совместимым клиентом; меняется только путь к конфиг-файлу и название ключа.

Во всех примерах замените /ABSOLUTE/PATH/TO/PROJECT на абсолютный путь к проекту, который хотите исследовать.

Без Docker: замените блок "command": "docker", "args": ["run", ...] на "command": "node", "args": ["/path/to/simple-mcp-server/dist/index.js"] и добавьте "env": { "PROJECT_ROOT": "/path/to/project" }.


Claude Code

Добавьте один раз в глобальный ~/.claude/settings.json:

{
  "mcpServers": {
    "project-navigator": {
      "command": "sh",
      "args": ["-c", "docker run --rm -i -v \"$(pwd):/project:ro\" -e PROJECT_ROOT=/project project-navigator-mcp"]
    }
  }
}

$(pwd) автоматически подставляет директорию, из которой запущен Claude Code — путь к проекту указывать не нужно. Просто откройте любой проект и начните новый разговор:

cd /any/project
claude

Важно: если конфиг добавлен на уровне проекта (.claude/settings.json), но сервер не появляется — добавьте его в глобальный ~/.claude/settings.json. Также убедитесь, что начали новый разговор — MCP-серверы регистрируются при старте сессии.


Claude Desktop

Claude Desktop не привязан к директории проекта, поэтому путь нужно указать явно.

Файл:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "project-navigator": {
      "command": "sh",
      "args": ["-c", "docker run --rm -i -v \"/ABSOLUTE/PATH/TO/PROJECT:/project:ro\" -e PROJECT_ROOT=/project project-navigator-mcp"]
    }
  }
}

Замените /ABSOLUTE/PATH/TO/PROJECT на путь к нужному проекту. Перезапустите Claude Desktop.


VS Code (GitHub Copilot Agent Mode)

Требует VS Code 1.99+ с GitHub Copilot.

Файл: .vscode/mcp.json в целевом проекте (добавьте в репозиторий — будет работать у всех участников).

{
  "servers": {
    "project-navigator": {
      "type": "stdio",
      "command": "sh",
      "cwd": "${workspaceFolder}",
      "args": ["-c", "docker run --rm -i -v \"$(pwd):/project:ro\" -e PROJECT_ROOT=/project project-navigator-mcp"]
    }
  }
}

${workspaceFolder} — встроенная переменная VS Code, автоматически подставляет корень открытого проекта. Путь указывать не нужно.

Откройте Copilot Chat → переключитесь в режим Agent → сервер подключится автоматически.

Отличие от других клиентов: ключ "servers" (не "mcpServers"), обязательное "type": "stdio" и поддержка "cwd" с переменными.


Cursor

Файл: ~/.cursor/mcp.json (глобально) или .cursor/mcp.json (в проекте)

{
  "mcpServers": {
    "project-navigator": {
      "command": "sh",
      "args": ["-c", "docker run --rm -i -v \"$(pwd):/project:ro\" -e PROJECT_ROOT=/project project-navigator-mcp"]
    }
  }
}

Cursor запускает MCP-сервер с cwd = корень открытого проекта, поэтому $(pwd) подставляется автоматически. Перезапустите Cursor — инструменты появятся в Cursor Agent.


Запуск без Docker

npm install
npm run build

Проверка:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js

Создайте .env (по образцу .env.example):

PROJECT_ROOT=/path/to/your/project
ALLOWED_COMMANDS=npm run build,npm test,npm run lint,npm run dev,npx tsc --noEmit

Безопасность

  • Файловые инструменты ограничены папкой PROJECT_ROOT — выход за пределы возвращает ошибку

  • read_file не читает файлы с именем .env*

  • run_command использует child_process.spawn (не exec), команда проверяется по точному совпадению с whitelist — shell-инъекции невозможны

Логи

Сервер пишет в stderr:

[CALL]    list_directory  { "path": "src" }
[SUCCESS] list_directory  duration=12ms

[CALL]    run_command     { "command": "rm -rf /" }
[ERROR]   run_command     reason="command not in whitelist"

В логах никогда не появляется содержимое файлов и вывод команд — только метаданные вызова.

Demo сценарии

#

Запрос

Инструмент

1

«Покажи структуру папки src»

list_directory

2

«Найди все TypeScript файлы в проекте»

find_files

3

«Где используется PROJECT_ROOT

search_code

4

«Покажи строки 1–30 файла server.ts»

read_file

5

«Запусти тесты»

run_command

Available Tools

5 tools
find_filesA

Find files by glob pattern within the project. Example pattern: "**/*.ts"

ParametersJSON Schema
NameRequiredDescriptionDefault
patternYesGlob pattern, e.g. "**/*.ts"
directoryNoDirectory to search in (relative to project root). Defaults to project root.

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description bears full burden. It describes basic behavior but omits details like performance, limits, or return format. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with an example pattern. Very concise, front-loaded, and efficient without unnecessary text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, so description should hint at return format. It does not describe what the tool returns (e.g., list of file paths). However, given low complexity, it is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%. The tool description adds an example pattern but does not provide additional meaning beyond what the schema already specifies for parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool finds files by glob pattern within the project, and provides an example. This distinctly differentiates it from siblings like list_directory or search_code.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives such as search_code. The description implies its use for pattern-based file discovery but lacks context for exclusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_directoryB

List files and folders in a directory within the project

ParametersJSON Schema
NameRequiredDescriptionDefault
pathNoDirectory path relative to project root.

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden for behavioral disclosure. It does not mention output format (e.g., only names? full paths?), error handling, or whether it follows symlinks. This lack of detail is problematic for a listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words. However, it could include more details in the same length (e.g., what is returned).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema, the description should explain the return value (e.g., list of file/folder names, paths, or metadata). It does not, leaving the agent guessing about the output structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a description for the 'path' parameter. The tool description adds 'within the project' which is redundant with the schema's 'relative to project root'. No new semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List files and folders in a directory within the project' clearly states the action (list) and the resource (files and folders in a directory). It is distinct from sibling tools like find_files (search), read_file (content), run_command (execute), and search_code (text search).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention scenarios where listing is appropriate or when to use other tools like find_files for filtering.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_fileA

Read file contents. Line numbers are 1-indexed.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to project root
start_lineNoFirst line to read (1-indexed)
end_lineNoLast line to read, inclusive (1-indexed)

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that line numbers are 1-indexed but omits behavior for missing files, permissions, or whether the whole file is read if no range is specified. Adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, with two sentences that contain no unnecessary words. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description does not explain the return format. While the tool is simple, information about what is returned (e.g., file content as a string) would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the description adds 'line numbers are 1-indexed' which reinforces the schema. While this adds value, it is minimal beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool reads file contents and notes line indices. It is distinct from siblings like find_files, list_directory, run_command, and search_code, which handle searching, listing, and execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies reading file contents but does not provide explicit guidance on when to use this tool versus siblings, such as for direct file access vs. searching. No alternatives or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_commandA

Run a whitelisted shell command. Allowed commands: npm run build, npm test, npm run lint, npm run dev, npx tsc --noEmit

ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesExact command string (must match whitelist exactly)

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the behavioral burden. It states the tool runs whitelisted shell commands but does not disclose output handling, error behavior, or whether the command runs in a specific directory or environment. This is adequate but not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 15 words, extremely concise with no fluff. It front-loads the purpose and immediately lists allowed commands.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a simple tool with one parameter and no output schema, the description covers the essential constraint (whitelist). It could be improved by mentioning that output is returned as stdout/stderr or that errors are non-zero exit codes, but it is largely sufficient for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description adds value by listing allowed command strings beyond the schema's generic description. The schema says 'must match whitelist exactly', and the description makes the whitelist explicit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Run' and the resource 'whitelisted shell command', listing specific allowed commands. It clearly distinguishes from sibling tools like find_files and search_code which are not shell execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists allowed commands (npm run build, npm test, etc.), indicating when to use the tool. It does not explicitly state when not to use it or provide alternatives, but the whitelist serves as clear guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_codeB

Full-text search across project files

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesText string to search for
directoryNoDirectory to search in (relative to project root). Defaults to project root.
file_patternNoGlob to filter which files are searched, e.g. "*.ts"

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but does not disclose important behaviors like return format, scope of search, performance considerations, or handling of no results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (one sentence) and front-loaded, but omits essential information that could be added without bloat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema, the description is incomplete: it does not describe what the tool returns (e.g., file paths, line numbers, code snippets) or any constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all parameters. The description adds no additional meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Full-text search across project files' clearly states the tool's purpose with specific verb and resource. It distinguishes from siblings like find_files (file name search) and read_file (file content reading).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidelines provided. The description does not mention when to use this tool vs alternatives such as find_files or list_directory.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedfind_files
    • First observedlist_directory
    • First observedread_file
    • First observedrun_command
    • First observedsearch_code

TDQS

A3.8/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: find_files locates files by pattern, list_directory lists directory contents, read_file reads file contents, run_command executes commands, and search_code does full-text search. No overlapping functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., find_files, list_directory), making them predictable and easy to understand.

Tool Count5/5

With 5 tools covering file discovery, browsing, reading, searching, and command execution, the count is well-scoped for a project navigator, neither too few nor excessive.

Completeness4/5

The tool set covers core navigation and search needs, and the ability to run whitelisted commands adds flexibility. Missing write/delete operations, but these are typically out of scope for a navigator, so only minor gaps.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to intelligently search and explore local file systems using native Unix commands (ripgrep, find, ls) with token-optimized output, automatic pagination, and multi-layer security validation.
    164
    2
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to safely explore directories, read files, search content by pattern or filename, and edit files with checksum verification and dry-run preview within sandboxed filesystem access.
    16
    75
    ISC
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to generate annotated file trees, retrieve file statistics, list git-changed files, and read file contents from local directories or GitHub repositories.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hrustalevdev/simple-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server