mcp-readonly-code-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-readonly-code-serverlist files in the src directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-readonly-code-server
Minimal Node + TypeScript example project for a read-only MCP server that exposes one local code workspace to an AI client over stdio.
Project position
This repository is currently an example project, not a production-ready remote service.
It demonstrates how to:
build a read-only MCP server with the official TypeScript SDK
expose one local workspace root safely
serve MCP resources and a simple search tool over
stdioenforce basic deny rules for sensitive paths and file types
Related MCP server: MCP Filesystem Python
What this project exposes
Official MCP TypeScript SDK wired through
McpServerstdiobootstrap entry for local MCP hostsThree read-only resources:
repo://overviewrepo://tree/{path}repo://file/{path}
One read-only tool:
search_code
A path guard that keeps all file access inside one workspace root
A
sample-private-code/directory for local smoke testing
Current behavior
This build exposes a real read-only code workspace through MCP resources plus one minimal search tool:
repo://overviewexplains the boundary and available surfacerepo://tree/{path}lists files and directories under an allowed subtreerepo://file/{path}reads one allowed text filesearch_coderecursively searches text files and returns line-level matches
Safety rules:
all access stays inside
WORKSPACE_ROOTdenied directories:
.git,node_modules,dist,coveragedenied suffixes:
.env,.pem,.key,.crtbinary and oversized files are rejected
Install
npm installRun
Start the server in development mode:
npm run devBy default, it exposes this sample directory:
sample-private-code/Specify the project directory
Use WORKSPACE_ROOT to choose which local project the MCP server exposes.
Expose the sample directory explicitly:
WORKSPACE_ROOT=/home/zsp0509/node-projects/mcp-readonly-code-server/sample-private-code npm run devExpose this repository itself:
WORKSPACE_ROOT=/home/zsp0509/node-projects/mcp-readonly-code-server npm run devExpose another project:
WORKSPACE_ROOT=/path/to/your-project npm run devIf the path contains spaces, quote it:
WORKSPACE_ROOT="/home/zsp0509/My Projects/app" npm run devNotes:
use an absolute path
one server instance exposes one workspace root
if you need multiple projects, configure multiple MCP server entries with different
WORKSPACE_ROOTvalues
How agents call it
This project is a stdio MCP server.
That means:
it does not open an HTTP port
an MCP host starts the process directly
the host communicates with it through
stdinandstdout
There are two common ways to use it:
1. Manual local run
You start it yourself in a terminal:
WORKSPACE_ROOT=/path/to/your-project npm run devIn this mode, the process must keep running. If you stop it, the agent cannot call it.
2. Host-managed run
You register it in an MCP-capable host such as an inspector or desktop client.
In this mode, the host usually starts the process automatically when needed. You do not need to keep a separate terminal open.
Example MCP host configuration
Development command:
{
"command": "node",
"args": [
"--import",
"tsx",
"/home/zsp0509/node-projects/mcp-readonly-code-server/src/index.ts"
],
"env": {
"WORKSPACE_ROOT": "/path/to/your-project"
}
}Built command:
{
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/path/to/your-project"
}
}Multiple project host configuration
If you want one agent host to access multiple projects, register multiple MCP server entries.
Each entry uses the same server program but a different WORKSPACE_ROOT.
Example:
{
"mcpServers": {
"crm-code": {
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/crm"
}
},
"admin-panel-code": {
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/admin-panel"
}
}
}
}In that setup:
crm-codeexposes only/srv/projects/crmadmin-panel-codeexposes only/srv/projects/admin-paneleach server process keeps its own workspace boundary
You can do the same with the development entrypoint:
{
"mcpServers": {
"crm-code-dev": {
"command": "node",
"args": [
"--import",
"tsx",
"/home/zsp0509/node-projects/mcp-readonly-code-server/src/index.ts"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/crm"
}
},
"admin-panel-code-dev": {
"command": "node",
"args": [
"--import",
"tsx",
"/home/zsp0509/node-projects/mcp-readonly-code-server/src/index.ts"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/admin-panel"
}
}
}
}Use different server names so the host can distinguish them clearly.
Common host examples
Different MCP hosts may wrap server definitions differently, but the important part stays the same:
the command points to this server
each project gets its own server entry
each entry sets a different
WORKSPACE_ROOT
Claude Desktop style
Some hosts use a top-level mcpServers object like this:
{
"mcpServers": {
"crm-code": {
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/crm"
}
},
"admin-panel-code": {
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/admin-panel"
}
}
}
}If you want to use the TypeScript entry during development, replace the command arguments with:
[
"--import",
"tsx",
"/home/zsp0509/node-projects/mcp-readonly-code-server/src/index.ts"
]Cherry Studio style
If your host asks you to add one MCP server at a time in a form or list UI, create two separate local command entries:
Server 1:
{
"name": "crm-code",
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/crm"
}
}Server 2:
{
"name": "admin-panel-code",
"command": "node",
"args": [
"/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.js"
],
"env": {
"WORKSPACE_ROOT": "/srv/projects/admin-panel"
}
}If the UI exposes separate fields instead of raw JSON, fill them like this:
Name:crm-codeCommand:nodeArgs:/home/zsp0509/node-projects/mcp-readonly-code-server/dist/src/index.jsWORKSPACE_ROOT:/srv/projects/crm
Then add a second entry with a different name and project path.
Practical notes
prefer the built entrypoint
dist/src/index.jsfor long-term useuse the
src/index.tsentrypoint mainly for local developmentif your host uses a different outer JSON shape, keep the inner
command,args, andenv.WORKSPACE_ROOTvalues the same
Build
Build the TypeScript output:
npm run buildRun the built server:
WORKSPACE_ROOT=/path/to/your-project npm run startSmoke test
Run the in-process MCP client validation script:
npm run smokeIt validates:
repo://overviewrepo://tree/{+path}repo://file/{+path}search_codedenied-path rejection for
.git/config
Inspector checklist
If you want to verify the real stdio workflow with an MCP inspector or host:
Start the server or register the command in your host.
Point the inspector or host command at:
node --import tsx src/index.tsSet
WORKSPACE_ROOTto the project you want to expose.Verify these calls:
read
repo://overviewread
repo://tree/controllersread
repo://file/controllers/user-controller.tscall
search_codewith{"query":"return","path":"controllers"}try denied path
repo://file/.git/config
Limitations
Current scope:
stdiotransport onlyone workspace root per process
read-only resources and one minimal text search tool
If you want to deploy this on a remote server for agents on other machines, you would typically add an HTTP-based MCP transport in a follow-up implementation.
Available Tools
1 toolsearch_codeB
Search text matches inside the configured read-only workspace root.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Relative directory path inside the workspace root. | . |
| query | Yes | Search text. |
TDQS
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 states 'read-only workspace root' but does not explicitly confirm the tool is read-only, nor does it discuss side effects, permissions, search limitations (e.g., binary files, recursion, case sensitivity). This lack of transparency could lead to incorrect assumptions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is concise and to the point. It avoids unnecessary words, but could be slightly more informative without sacrificing brevity. It is well-structured and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of output schema and annotations, the description does not provide enough context for an agent to fully understand the tool's behavior. Missing details include return format, result limits, recursion behavior, and case sensitivity. For a search tool, more completeness is expected.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the parameter descriptions are already present. The description adds no additional semantic value beyond the schema, meeting the baseline of 3. It does not enhance understanding of parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches for text matches within the configured read-only workspace root. The verb 'search' and resource 'text matches' are specific, and the scope is defined. Even without sibling tools, the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use or when-not-to-use guidance is provided. The description implies it is for text search inside the workspace, but does not mention alternatives or exclusions. Given no sibling tools, the lack of differentiation is less critical, but some guidance on when to choose this tool would be helpful.
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 tool update
v0.1.0- First observed
search_code
TDQS
With only one tool, there is no possibility of confusion between tools. The single tool's purpose is clearly defined.
The sole tool 'search_code' follows a clear verb_noun pattern, making its purpose immediately understandable. Consistency is trivially maintained.
A read-only code server with only one tool feels excessively limited. Typically, such a server would need multiple tools (e.g., list files, read file content) to be useful, making a single tool insufficient for the apparent scope.
The toolset is severely incomplete for a read-only code server. Essential operations like listing files or reading file contents are missing, leaving agents unable to perform basic code exploration tasks.
Maintenance
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
Read-only MCP server exposing a user ORANO library to their own AI agent.
1Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA secure MCP server enabling read-only access and file search capabilities within a specified directory, while respecting .gitignore patterns.-
- AlicenseBqualityDmaintenanceA secure, read-only MCP server for browsing and searching files in a specified directory with path traversal protection and .gitignore support.3MIT
- AlicenseNot gradedqualityBmaintenanceA read-only MCP server for code reading with intelligent caching, line-range selection, and language detection, enabling AI assistants to efficiently and safely explore file systems.MIT
- FlicenseAqualityCmaintenanceA read-only MCP server that enables AI assistants to search files, list directories, retrieve system info, and get file metadata on the local file system.4-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/John0615/mcp-readonly-code-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server