MCP Hub
Back to servers

Coding MCP Server

A production-oriented MCP server for coding agents that enables multi-project management through secure file operations, Git integration, and safe command execution. It supports project discovery across multiple root directories and provides robust audit logging with both STDIO and HTTP transport options.

glama
Stars
1
Updated
Apr 1, 2026
Validated
Apr 21, 2026

Coding MCP

Production-ready MCP server that lets AI agents perform coding tasks on remote repositories.

What is it?

coding-mcp is an MCP (Model Context Protocol) server that exposes your code repositories as a set of tools and resources that AI agents can use to read, write, search, and run commands — all without the agent needing local access to the repositories.

Primary goal: deploy one server on a machine that hosts your code, then connect any MCP-compatible agent (Claude, Cursor, etc.) to it. The agent can browse files, edit code, run builds and tests, manage git, and more — all through structured MCP tool calls.

┌─────────────────────────────────────────────┐
│  AI Agent (Claude / Cursor / any MCP client) │
└────────────────┬────────────────────────────┘
                 │  MCP over HTTP or STDIO
                 ▼
┌─────────────────────────────────────────────┐
│           coding-mcp server                  │
│  (runs on the machine with your repos)       │
│                                              │
│  Tools: files · git · search · commands      │
│  Resources: project index · file content     │
│  Prompts: implement · review · fix tests     │
└──────────────────┬──────────────────────────┘
                   │  filesystem + git
                   ▼
        /projects/repo-a  /projects/repo-b  …

Documentation

Highlights

  • Multi-project registry with persistent indexing
  • Safe file operations and patching (structured edits + unified diff hunks)
  • Git command suite with structured output
  • Allowlist-based command runner with timeout and output limits
  • Binary-safe file resources (text and base64 blob modes)
  • Dual transport support: STDIO and HTTP (streamable or SSE)
  • HTTP API-key authentication + RBAC (viewer/editor/admin)
  • OpenTelemetry hooks for request and tool-level tracing
  • Structured operation envelopes with request IDs and timing
  • Audit logging for mutating actions

Quick Start

Install globally:

npm install -g @kieutrongthien/coding-mcp

Register one or more project roots (the directories that contain your repos):

coding-mcp init /projects

Start the server:

# HTTP transport (for remote agents)
coding-mcp serve --transport http --host 0.0.0.0 --port 4000 --mode streamable

# STDIO transport (for local agents like Cursor or Claude Desktop)
coding-mcp serve --transport stdio

Build from source

git clone https://github.com/kieutrongthien/coding-mcp.git
cd coding-mcp
cp .env.example .env
npm install
npm run build
npm install -g .

CLI Commands

CommandDescription
coding-mcp init [path]Scan a directory for projects and write the registry. Defaults to the current working directory.
coding-mcp add <path>Add a new root directory to the project registry.
coding-mcp remove <path>Remove a root directory from the project registry.
coding-mcp serveStart the MCP server. Accepts --transport, --host, --port, and --mode flags.

Development shortcuts (no build step needed):

npm run dev:stdio
npm run dev:http
npm run dev:serve -- --transport http --host 127.0.0.1 --port 3001 --mode sse

MCP Tools

Tools are the primary interface for agents. Each tool accepts a project_id (returned by list_projects) and operates within that project's root, preventing any path traversal outside it.

Project Tools

ToolDescription
list_projectsList all projects discovered in the configured root directories.
get_projectGet metadata for a specific project (path, detected tooling, package manager, git info).
refresh_project_indexRe-scan one project or all projects to pick up newly added repositories.

File Tools

ToolDescription
list_directoryList files and subdirectories at a given path within a project.
read_fileRead file content, optionally limited to a line range.
read_multiple_filesRead multiple files in a single call.
create_fileCreate a new file. Set overwrite: true to replace an existing file.
write_fileOverwrite the full content of an existing file.
replace_in_fileFind and replace text within a file (first match or all matches).
apply_patchApply a unified diff or a list of structured edit operations to a file.
delete_fileDelete a file or directory. Requires confirm: true as a safety guard.
move_fileMove or rename a file or directory.

Search Tools

ToolDescription
search_filesSearch for files by name or path pattern within a project.
grep_contentSearch file contents using a regex-like pattern. Returns matching lines with file paths and line numbers.
get_project_treeGet the directory tree of a project up to a configurable depth.
summarize_projectReturn a summary of the project stack, package manager, detected tooling, and top-level tree.

Git Tools

ToolDescription
git_statusShow the current working tree status (modified, staged, untracked files).
git_diffShow unstaged or staged changes as a unified diff.
git_branch_listList all local and remote branches.
git_checkout_branchSwitch to an existing branch.
git_checkout_new_branchCreate and switch to a new branch.
git_pullPull the latest changes from the remote.
git_addStage one or more files or paths.
git_restoreDiscard working tree changes for specified paths. Requires confirm: true.
git_commitCreate a commit with the given message.
git_pushPush commits to a remote branch. Supports set_upstream.
git_logShow recent commit history with configurable limit.
git_showShow details of a specific commit, tag, or git object by ref.
git_create_tagCreate an annotated tag.

Command Tools

Commands run inside the project directory. Only commands on the ALLOWED_COMMANDS allowlist are permitted.

ToolDescription
run_buildRun the build command auto-detected from the project tooling (e.g. npm run build, make).
run_testRun the test command auto-detected from the project tooling (e.g. npm test, pytest).
run_lintRun the lint command auto-detected from the project tooling (e.g. npm run lint, ruff).
run_command_safeRun any allowlisted command with explicit arguments, working directory, and timeout.

MCP Resources

Resources expose read-only data that agents can fetch directly by URI.

Resource URIDescription
project://indexJSON list of all indexed projects.
project://{project_id}/treeDirectory tree of the project (depth 4).
project://{project_id}/readmeRaw content of the project's README.md.
project://{project_id}/package-jsonRaw content of the project's package.json.
project://{project_id}/git-statusCurrent git status as JSON.
project://file/{project_id}/{path}Content of any file. Text files are returned as text; binary files as base64 blob.
project://file-meta/{project_id}/{path}Metadata of a file (size, MIME type, encoding, truncation status).

MCP Prompts

Prompts provide pre-built instructions that agents can invoke to start structured coding workflows.

PromptDescription
analyze-projectAsk the agent to analyze a project's architecture, risks, and improvements.
implement-taskAsk the agent to implement a described task within a project.
explain-fileAsk the agent to explain how a specific file works.
generate-commit-messageAsk the agent to generate a conventional commit message from a diff summary.
review-diffAsk the agent to review a diff for bugs, regressions, and missing tests.
fix-test-failuresAsk the agent to fix failing tests given raw test output.

MCP Client Examples

Claude Desktop (STDIO)

{
  "mcpServers": {
    "coding-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/coding-mcp/dist/src/main/stdio.js"],
      "env": {
        "PROJECTS_ROOTS": "/projects"
      }
    }
  }
}

Cursor (STDIO)

{
  "mcpServers": {
    "coding-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/coding-mcp/dist/src/main/stdio.js"],
      "env": {
        "PROJECTS_ROOTS": "/projects,/srv/repos",
        "ENABLE_STDIO": "true",
        "ENABLE_HTTP": "false"
      }
    }
  }
}

Generic HTTP MCP client

{
  "mcpServers": {
    "coding-mcp-http": {
      "url": "http://your-host:4000",
      "headers": {
        "x-api-key": "editor-key"
      }
    }
  }
}

Configuration

Use environment variables directly or provide a JSON/YAML config file via MCP_CONFIG_PATH.

Core settings

VariableDescription
PROJECTS_ROOTSComma-separated list of root directories to scan for projects (preferred).
PROJECTS_ROOTSingle root directory (legacy compatibility).
ENABLE_HTTPEnable the HTTP transport (true/false).
ENABLE_STDIOEnable the STDIO transport (true/false).
HTTP_HOSTHTTP server bind address (default 127.0.0.1).
HTTP_PORTHTTP server port (default 3000).
HTTP_MODEHTTP transport mode: streamable or sse.
MAX_FILE_SIZEMaximum file size for read operations (bytes).
MAX_OUTPUT_SIZEMaximum command or resource output size (bytes).
COMMAND_TIMEOUT_MSTimeout for command execution (milliseconds).
RETRY_MAX_ATTEMPTSNumber of retry attempts for transient failures.
RETRY_BASE_DELAY_MSBase delay between retries (milliseconds).
ALLOWED_COMMANDSComma-separated list of commands permitted by run_command_safe.
PROTECTED_PATHSComma-separated path patterns that cannot be modified.
LOG_LEVELLog verbosity: trace, debug, info, warn, error.
REGISTRY_FILEPath to the project registry JSON file.
AUDIT_LOG_FILEPath to the audit log for mutating operations.
HTTP_REQUEST_LOG_FILEPath to the HTTP request log.

Security settings

VariableDescription
ENABLE_AUTHEnable API-key authentication for the HTTP transport.
AUTH_HEADER_NAMEHTTP header used to pass the API key (default x-api-key).
AUTH_API_KEYSComma-separated list of keys in key:role:id format.

Observability settings

VariableDescription
ENABLE_OTELEnable OpenTelemetry tracing.
OTEL_SERVICE_NAMEService name reported in traces.
OTEL_EXPORTER_OTLP_ENDPOINTOTLP HTTP endpoint for trace export.
OTEL_EXPORTER_OTLP_HEADERSHeaders for the OTLP exporter in key=value,key2=value2 format.

HTTP Security (Auth/RBAC)

Enable API-key authentication when exposing the HTTP transport to external agents.

ENABLE_AUTH=true
AUTH_HEADER_NAME=x-api-key
AUTH_API_KEYS=viewer-key:viewer:viewer1,editor-key:editor:editor1,admin-key:admin:admin1

Pass the key in the request header:

x-api-key: editor-key

Roles:

RolePermissions
viewerRead-only operations
editorRead + non-destructive write, build, and test operations
adminFull access including destructive operations

HTTP Monitoring Endpoints

When HTTP transport is enabled:

EndpointDescription
GET /healthzLiveness check
GET /readyzReadiness check with indexed project count
GET /metricsBasic metrics: request_count, error_count, latency summary

OpenTelemetry

Tracing can be exported over OTLP HTTP:

ENABLE_OTEL=true
OTEL_SERVICE_NAME=coding-mcp
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318/v1/traces
OTEL_EXPORTER_OTLP_HEADERS=authorization=Bearer%20token

Emitted spans:

  • mcp.http.request
  • mcp.tool.{operation}

Response Contract

All tool responses follow the same envelope format.

Successful operation:

{
  "ok": true,
  "project_id": "abc123",
  "operation": "read_file",
  "data": {},
  "warnings": [],
  "errors": [],
  "request_id": "uuid",
  "duration_ms": 12
}

Failed operation:

{
  "ok": false,
  "operation": "write_file",
  "error_code": "SECURITY_ERROR",
  "message": "Operation blocked for protected path",
  "details": {},
  "request_id": "uuid",
  "duration_ms": 7
}

Architecture

The server uses one shared core with modular layers:

  • config: environment/config-file loading and runtime validation
  • core: response contracts, errors, logging, telemetry hooks, locks
  • services: filesystem, git, patching, command execution, auth, project registry
  • mcp: tool/resource/prompt registries bound to shared services
  • main: CLI and transport bootstrap (stdio, http, serve/init/add/remove)

STDIO and HTTP transports share the same service layer, keeping behavior consistent while allowing transport-specific controls (such as HTTP authentication).

Validation

npm run typecheck
npm test

License

MIT

Reviews

No reviews yet

Sign in to write a review