MCP Tool Server
Read-only inspection of git repositories inside the workspace: current branch, HEAD commit, uncommitted changes, configured remotes and a configurable number of recent commits, so an agent can orient itself in a repo before reading or searching files.
Runs a single read-only SELECT statement or schema PRAGMA against a SQLite database file in the workspace, with bound parameters, a row cap and a per-query timeout, letting agents explore table schemas and aggregate stored data without risking writes.
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.
mcp-tool-server
A Model Context Protocol (MCP) server that gives LLM agents structured, sandboxed access to a working directory: reading and searching files, querying CSV/JSON/JSONL data and SQLite databases, inspecting git repositories, doing arithmetic, and fetching URLs from an allowlist.
Any MCP client (Claude Desktop, Claude Code, the MCP Inspector, or your own agent harness) can
connect over stdio or streamable HTTP, discover the tools and their JSON schemas, and call them
through the standard tools/list and tools/call interface.
I built it around the things I actually want an agent to be able to do when working through an
evaluation run: look around a repo, grep for something, page through a long log, and ask
questions of a results.jsonl without pasting the whole file into context.
Tools
All tools are read-only and return structured output (a JSON object with a published
outputSchema) as well as a text rendering for clients that only read text.
Tool | What it does | Key inputs |
| List directory entries with type and size; optional recursion and glob filter. |
|
| Read a UTF-8 text file, or a window of lines from it, with total line count and a truncation flag. |
|
| grep-style search across the workspace (plain text or regex). Skips hidden dirs and binary files. |
|
| Filter, sort, project, group and summarise records in |
|
| Evaluate an arithmetic expression with math and statistics functions, without |
|
| HTTP GET against allowlisted hosts with a timeout and response size cap. Redirects are re-checked against the allowlist. |
|
| Run a single read-only |
|
| Branch, HEAD, uncommitted changes, remotes and recent commits for a repo inside the workspace. |
|
Resources
URI | Contents |
| JSON: workspace root, HTTP allowlist, timeouts and size limits the server is running with. |
| Plain-text tree of the workspace, two levels deep. |
Prompts
Name | Arguments | Purpose |
|
| Walks the model through reading a file and reporting bugs, risky patterns and readability issues with line numbers. |
|
| Has the model use |
Example calls
// query_records: failures per category in an eval run
{
"path": "runs/2024-11-02/results.jsonl",
"filters": [{ "field": "passed", "op": "eq", "value": false }],
"group_by": "category",
"limit": 0
}
// -> { "total_records": 500, "matched": 87, "group_counts": { "docker": 41, "bash": 30, ... }, ... }
// query_records: pass rate (booleans average as 0/1)
{ "path": "runs/2024-11-02/results.jsonl", "stats_field": "passed", "limit": 0 }
// -> { "stats": { "field": "passed", "count": 500, "mean": 0.826, ... }, ... }
// sqlite_query
{ "database": "data/evals.db", "sql": "SELECT model, avg(score) FROM runs GROUP BY model" }
// calculate
{ "expression": "mean([0.71, 0.64, 0.80]) * 100" }Filter operators: eq, ne, gt, gte, lt, lte, contains, in, exists. Comparisons
coerce numeric strings, so CSV columns behave like their JSON equivalents.
Related MCP server: Enlace
Quickstart
Requires Python 3.11+ and uv.
git clone https://github.com/FaizKhan8957/mcp-tool-server.git
cd mcp-tool-server
uv sync
# stdio (what desktop and CLI clients use)
uv run mcp-tool-server --root ~/code/my-project
# streamable HTTP on http://127.0.0.1:8000/mcp
uv run mcp-tool-server --root ~/code/my-project --transport streamable-http --port 8000
# allow fetch_url to reach specific hosts
uv run mcp-tool-server --root . --allow-host api.github.com --allow-host '*.python.org'To poke at it interactively, run it under the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-tool-server run mcp-tool-server --root /path/to/workspaceConfiguration
Every option can be set with an environment variable (handy in client config files) or a CLI flag. Flags take precedence.
Flag | Environment variable | Default | Meaning |
|
| current directory | Workspace the tools are confined to. |
|
| none | Hosts |
|
|
| Seconds per HTTP request. |
|
|
| Response bodies are truncated beyond this. |
|
|
| Larger files are refused by |
|
|
| Seconds a single SQLite query may run. |
|
|
| |
|
| Bind address for streamable HTTP. | |
|
| Logs go to stderr; stdout is reserved for the protocol. |
Connecting a client
Claude Desktop
Add the server to claude_desktop_config.json (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json, Windows:
%APPDATA%\Claude\claude_desktop_config.json) and restart the app:
{
"mcpServers": {
"workspace-tools": {
"command": "uv",
"args": [
"--directory", "/absolute/path/to/mcp-tool-server",
"run", "mcp-tool-server",
"--root", "/absolute/path/to/workspace"
],
"env": {
"MCP_TOOL_ALLOWED_HOSTS": "api.github.com,docs.python.org"
}
}
}
}Without cloning, uvx can run it straight from GitHub:
{
"mcpServers": {
"workspace-tools": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/FaizKhan8957/mcp-tool-server",
"mcp-tool-server", "--root", "/absolute/path/to/workspace"
]
}
}
}Claude Code
# stdio, scoped to the current project
claude mcp add workspace-tools -- \
uv --directory /absolute/path/to/mcp-tool-server run mcp-tool-server --root "$PWD"
# or connect to a server already running with --transport streamable-http
claude mcp add --transport http workspace-tools http://127.0.0.1:8000/mcpThe same mcpServers block shown above also works in a project-level .mcp.json.
Any MCP client (Python)
import anyio
from mcp import Client, StdioServerParameters
params = StdioServerParameters(
command="uv",
args=[
"--directory",
"/path/to/mcp-tool-server",
"run",
"mcp-tool-server",
"--root",
"/path/to/workspace",
],
)
async def main() -> None:
async with Client(params) as client: # or Client("http://127.0.0.1:8000/mcp")
tools = await client.list_tools()
print([t.name for t in tools.tools])
result = await client.call_tool("search_files", {"query": "TODO", "glob": "*.py"})
print(result.structured_content)
anyio.run(main)Architecture
src/mcp_tool_server/
├── cli.py argument parsing, env/flag merge, transport selection
├── config.py ServerConfig (frozen dataclass) + MCP_TOOL_* env loading
├── server.py build_server(config): registers tools, resources, prompts on MCPServer
└── tools/
├── sandbox.py Workspace.resolve(): the single path-validation choke point
├── files.py list_files, read_file, search_files, render_tree
├── data.py query_records + CSV/JSON/JSONL loading
├── calc.py AST-walking arithmetic evaluator
├── http.py fetch_url (httpx, allowlist, redirects, size cap)
├── sqlite.py sqlite_query (read-only connection + authorizer)
└── git.py git_info (subprocess, hardened config)The server is built on the official MCP Python SDK
(mcp.server.mcpserver.MCPServer, the high-level API that was called FastMCP in SDK 1.x).
A few design decisions:
Tool logic is separate from registration. Each module in
tools/is plain Python that takes its dependencies (theWorkspace, theServerConfig) explicitly and returns a pydantic model.server.pywraps each one in a thin function whose signature is the tool's input schema. That keeps the tool code unit-testable without an MCP session, and the wrappers are where the agent-facing descriptions live.Schemas come from type hints. Parameters are annotated with
Annotated[..., Field(...)], so descriptions, defaults and bounds (ge/le) end up in the published JSON Schema, and the SDK rejects invalid arguments before the tool runs. Return types are pydantic models, which gives each tool anoutputSchemaand structured results.Errors are results, not crashes. Anticipated failures (bad path, invalid SQL, blocked host, timeout) raise
ToolError, which the SDK turns into aCallToolResultwithisError: trueand a message the model can read and act on. Unexpected exceptions are logged with a traceback on the server and surface to the client as a generic tool error, so the session keeps running.Config is built once and closed over.
build_server(config)creates a fresh server bound to one workspace, which makes it easy to run several isolated instances in tests.
Security notes
This server is meant to give an agent useful, bounded access, not to be a hardened multi-tenant sandbox. What it does and does not protect against:
Filesystem. Every path goes through
Workspace.resolve, which resolves symlinks and rejects anything that ends up outside the root (../, absolute paths, symlinks pointing out, NUL bytes). Directory walks skip symlinks that escape the root and do not follow symlinked directories. No tool writes to disk.SQLite. Databases are opened with
mode=ro, and an authorizer callback denies everything except reads, functions and a handful of introspection pragmas, soATTACH, DDL, writes and state-changing pragmas are rejected before they run. A progress handler aborts queries that exceed the time budget.Git. Commands run without a shell, with a timeout, and with
core.fsmonitor,core.hooksPath,core.pageranddiff.externaloverridden so a malicious repo config cannot execute programs.GIT_CEILING_DIRECTORIESstops repo discovery at the workspace boundary. Credentials embedded in remote URLs are stripped from the output.HTTP. Outbound requests are off unless you allowlist hosts. Only
http/https, no credentials in URLs, every redirect hop is re-checked, bodies are capped and requests time out. Matching is by hostname, so allowlisting a name that resolves to an internal address will allow it; keep the list tight and avoid*on machines with access to internal services.Calculator. Expressions are parsed with
astand evaluated by walking a whitelist of node types. There is noeval, no attribute access and no names beyond a few constants. Exponents, integer size and factorial inputs are bounded to avoid CPU/memory blowups.Streamable HTTP binds to
127.0.0.1by default and has no authentication. Do not expose it on a public interface without putting it behind something that does.Prompt injection. File contents and fetched pages are returned to the model verbatim. If the workspace or allowed hosts contain untrusted text, treat the agent's follow-up actions accordingly.
Development
uv sync # creates .venv with runtime + dev dependencies
uv run pytest # full test suite
uv run pytest tests/test_server.py -v
uv run ruff check . && uv run ruff format --check .Tests are split into two layers:
Unit tests (
test_files.py,test_data.py,test_calc.py,test_http.py,test_sqlite.py,test_git.py,test_config.py) call the tool functions directly against a temporary workspace built inconftest.py(source files, a JSONL results file, a CSV, a SQLite database and a throwaway git repo). HTTP is tested withhttpx.MockTransport, so nothing goes over the network.Protocol tests (
test_server.py) connect a real MCP client to the server in-process and exercisetools/list,tools/call, resources and prompts, check the published schemas and error results, and launch the CLI as a subprocess over stdio.
CI runs lint and the test suite on Python 3.11 to 3.13 (Linux) and 3.13 on macOS.
Adding a tool
Write the implementation in
tools/<name>.pyas a function that returns a pydantic model and raisesToolErrorfor expected failures.Register a wrapper in
build_serverwith@app.tool(...), annotating each parameter with aField(description=...).Add unit tests for the function and extend
EXPECTED_TOOLSintests/test_server.py.
License
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
Let ChatGPT and Claude read and edit files, search and run commands on your own computer.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Sandbox workspace tools: search, file read, DB queries, integrations. Returns synthetic data.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI models to securely analyze SQLite datasets and read local text documents through a local stdio interface. It provides read-only querying, schema discovery, pagination, and timeout protections to prevent data leaks or destructive changes.MIT
- AlicenseNot gradedqualityCmaintenanceExposes four stdio tools that let an agent research an application's documented interface, produce a validated single-use plan, and execute read-only operations against public HTTP JSON APIs, static HTML/JSON/text sources, and host-configured CLIs. Runs in-process with no listening port, accounts, or model dependency, returning bounded results while keeping inputs and outputs inside a host-enforced research-plan-execute lifecycle.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to perform sandboxed file-system operations, read-only SQLite querying and schema inspection, environment diagnostics, and cryptographic hashing over Stdio or HTTP using JSON-RPC.2MIT
- AlicenseAqualityBmaintenanceEnables secure, read-only PostgreSQL queries, sandboxed file reads within a confined directory tree, and host CPU, memory, and disk metrics over stdio. It exposes these capabilities through narrowly scoped tools with strict validation and fail-closed guardrails.1MIT