Skip to main content
Glama
local-pc-mcp

local-pc-mcp

by contra333

local-pc-mcp

A stdio MCP server for working with files and Git repositories on your machine. Give a client a project directory and it can search source, read a PDF page, inspect a staged diff, or write a UTF-8 file there.

Quickstart

Install Python 3.12 or later and Git. Install Poppler's pdftoppm on PATH for PDF page images and the full test suite. PDF text extraction uses pypdf.

From the project directory on Linux or macOS:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[dev]'
mkdir -p example-workspace
export ALLOWED_ROOTS="$(pwd)/example-workspace"
local-pc-mcp

The server waits for MCP messages on standard input. Stop it with Ctrl+C. For a client that supports stdio servers, replace both paths below with absolute paths. The client launches the process itself.

{
  "mcpServers": {
    "local-pc": {
      "command": "/absolute/path/to/local-pc-mcp/.venv/bin/local-pc-mcp",
      "env": { "ALLOWED_ROOTS": "/absolute/path/to/example-workspace" }
    }
  }
}

On Windows, create the environment with py -3.12 -m venv .venv, install with .venv\Scripts\python.exe -m pip install -e ".[dev]", and point the client at .venv\Scripts\local-pc-mcp.exe using an absolute path. Escape backslashes in JSON. Set environment variables directly in the client configuration or shell. The server does not load dotenv files.

To check the connection, ask the client to call file_list with {"path":"."}. With one configured workspace, the result contains that directory's entries.

Related MCP server: fsguard-mcp

Architecture and tools

The Python MCP SDK registers ten tools in server.py. Each tool resolves its path through sandbox.py before invoking a local filesystem operation or one of the modules below.

Tools

Behavior

file_list, file_read, file_write

List one directory, preview text or PDF content, and create or overwrite a UTF-8 file in an existing directory. Ordinary text reads and writes are limited to 1 MiB.

file_read_lines, file_search, file_json_get

Page through text, search for a literal in names or text, or select a JSON value by JSON Pointer. Search visits up to 600 files and returns up to 30 matches. JSON input is limited to 4 MiB.

file_read_pdf

Extract up to 20 pages of text or render one page as a PNG. PDF input is limited to 256 MiB. Rendering uses Poppler and performs no OCR.

git_status, git_diff, git_log

Inspect a working tree, staged or unstaged changes, and up to 100 commits. Returned diff text is truncated at 1 MiB plus a marker.

Security model

  • ALLOWED_ROOTS is a semicolon-separated list of absolute directories on all platforms. A missing or empty value makes tool calls fail closed. Relative paths require exactly one root. Canonical path checks resolve links before comparing directory boundaries.

  • gitops.py checks the repository top level and builds argument lists for status, diff, log, and internal rev-parse. The caller supplies a path, a staging flag, or a count. Git runs without a shell and has a 30-second timeout.

  • Run the server as a low-privilege user and expose only directories and repositories you trust. Clients can overwrite files in those directories. The checks run in the server process and rely on trusted local Git configuration, executables, and a filesystem that other users cannot change during a call. Directory listings and Git status can grow with the workspace.

Tests

With the development dependencies, Git, and Poppler installed:

python -m pytest -q

The suite creates temporary directories, Git repositories, worktrees, and a sample PDF. It exercises path boundaries, size limits, the registered tool list, and the MCP client/server calls.

Available Tools

10 tools
file_json_getSelect JSON valueB
Read-only

Read one bounded JSON value by JSON Pointer under the local read policy.

Inputs: path (required), pointer (required). Returns: path, content, pointer

file_listList filesA
Read-only

List a directory under the local read policy. Does not follow symlink entries.

Inputs: path (required). Returns: path, entries

file_readRead fileA
Read-only

Read UTF-8 text or a PDF text preview. PDF continuation/images: file_read_pdf.

Inputs: path (required). Returns: path, content

file_read_linesRead text linesB
Read-only

Read a bounded line range of a UTF-8 file under the local read policy.

Inputs: path (required), max_lines, start_line. Returns: path, reason, content, end_line, +3 more

file_read_pdfRead PDF pagesA
Read-only

Read PDF pages (1-based, max 20). render=true returns one page image for scans/figures. Local read policy applies.

Inputs: path (required), render, max_pages, start_page.

file_writeWrite fileA
DestructiveIdempotent

Create or overwrite a UTF-8 text file inside ALLOWED_ROOTS. Does not delete files.

Inputs: path (required), content (required). Returns: path, bytes_written

git_diffGit diffB
Read-only

Show git diff --no-ext-diff. Set staged=true for --cached.

Inputs: path (required), staged. Returns: diff, repo, staged

git_logGit logB
Read-only

Show recent git commits. max_count is capped at 100.

Inputs: path (required), max_count. Returns: repo, commits

git_statusGit statusA
Read-only

Show git status --porcelain for a repository whose root is inside ALLOWED_ROOTS.

Inputs: path (required). Returns: repo, status

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 10 tools

    Disambiguation3/5

    The file-reading tools overlap: file_read, file_read_lines, and file_read_pdf all read file content, and file_read even mentions a PDF preview that competes with file_read_pdf. Descriptions do help distinguish bounded line ranges and PDF-specific behavior, but an agent can easily misselect among the three read tools.

    Naming Consistency4/5

    Names consistently use snake_case with clear file_/git_ prefixes and mostly follow a resource_action pattern. Minor deviations like file_json_get (action not at the end) and compound suffixes in file_read_pdf/file_read_lines keep it from being perfectly uniform.

    Tool Count5/5

    Ten tools is well within the ideal 3-15 range and each tool maps to a distinct operation on local files or git repositories. The set is compact and purpose-scoped without obvious filler.

    Completeness3/5

    Read coverage is strong (text, lines, PDF, JSON pointer, search, list) and git inspection is covered, but the write lifecycle is incomplete: no delete, move, append, or directory creation, and git is read-only with no commit/add/branch operations. These are notable gaps agents cannot fully work around with the current surface.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Exposes a secure, path-confined bridge to a local workspace and git remotes, enabling MCP clients to search, read, write, reset files, and perform git operations.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables safe filesystem and git operations confined within a single allowed directory tree, using symlink-resolved path containment to protect against path traversal. Users can read, write, list, and search files, as well as initialize repos and run status, stage, commit, diff, and log operations through MCP.
      11
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to manage files in an isolated workspace and perform lightweight Git operations through a protected Streamable HTTP endpoint, including listing, reading, writing, searching, replacing, and deleting files plus checking status and diffs.
      1
      -