Local Docs MCP 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., "@Local Docs MCP Serversearch for 'authentication' in the api namespace"
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.
Local Docs MCP Server
A TypeScript-based Model Context Protocol (MCP) server that exposes multiple local documentation folders (namespaces) to AI assistants via tools and resources.
Features
🔌 HTTP Transport: Uses Streamable HTTP on
POST /mcp(no stdio)📁 Multi-Namespace Support: Organize docs across multiple roots with namespace isolation
🔗 Resource Access: Dynamic resource template
docs://{namespace}/{path}for file access🛠️ Three Tools:
list_files- List files matching glob patterns across namespacesread_file- Read specific file contents from a namespacesearch- Search for text across multiple files and namespaces
🔒 Security: Path traversal prevention, symlink escape detection, binary file filtering, configurable file size limits
📝 MIME Types: Automatic MIME type detection for all files
⚙️ Flexible Configuration: Configure via environment variables or
docs.config.json
Related MCP server: MCP Docs Server
Installation
Dependencies are already installed. If you need to reinstall:
npm installConfiguration
Method 1: Configuration File (docs.config.json)
Create a docs.config.json file in the project root:
{
"roots": [
{
"ns": "docs",
"path": "./docs"
},
{
"ns": "api",
"path": "./api-docs"
},
{
"ns": "guides",
"path": "C:/absolute/path/to/guides"
}
],
"maxFileKB": 256,
"allowSymlinks": false,
"ignore": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/build/**"
]
}Method 2: Environment Variables
Set the DOCS_DIRS environment variable with comma-separated namespace:path pairs:
# Windows PowerShell
$env:DOCS_DIRS="docs:./docs,api:./api-docs,guides:C:/path/to/guides"
npm run devNote: Environment variables take precedence and will override/merge with docs.config.json.
Configuration Options
roots: Array of namespace definitionsns: Namespace identifier (alphanumeric, hyphens, underscores)path: Absolute or relative path to the root directory
maxFileKB: Maximum file size in kilobytes (default: 256)allowSymlinks: Allow symlinks that point outside the namespace (default: false)ignore: Glob patterns to ignore (default: node_modules, .git, etc.)PORT: Server port via environment variable (default: 3000)
Running the Server
Development Mode (with auto-reload)
npm run devProduction Mode
npm startThe server will print the MCP URL on startup:
🚀 Local Docs MCP Server running
📁 Registered namespaces:
- docs: C:\Users\...\mcp-day\docs
- api: C:\Users\...\mcp-day\api-docs
🔗 MCP URL: http://localhost:3000/mcp
💚 Health check: http://localhost:3000/healthTesting with MCP Inspector
Install MCP Inspector (if not already installed):
npx @modelcontextprotocol/inspectorStart the server in one terminal:
npm run devOpen MCP Inspector in another terminal:
npx @modelcontextprotocol/inspectorConnect to the server:
In the Inspector UI, enter the MCP URL:
http://localhost:3000/mcpTransport type:
HTTP
Test the tools:
List Files (all namespaces):
{ "pattern": "**/*.md", "max": 50 }List Files (specific namespace):
{ "pattern": "**/*.md", "ns": "docs", "max": 50 }List Files (multiple namespaces):
{ "pattern": "**/*.md", "ns": ["docs", "api"], "max": 50 }Read File:
{ "ns": "docs", "path": "welcome.md" }Search (all namespaces):
{ "query": "MCP", "glob": "**/*.md", "max": 100 }Search (specific namespace):
{ "query": "MCP", "glob": "**/*.md", "ns": "docs", "max": 100 }Test Resources:
Resources now use namespace URIs:
docs://{namespace}/{path}Example:
docs://docs/welcome.md,docs://api/endpoints.mdClick on any resource link in the Inspector
The file content should appear with proper MIME type
Project Structure
mcp-day/
├── server.ts # Main MCP server implementation
├── src/
│ └── roots.ts # RootRegistry implementation
├── package.json # Project configuration
├── tsconfig.json # TypeScript configuration
├── docs.config.json # Namespace configuration
├── README.md # This file
└── docs/ # Default documentation namespace
├── welcome.md # Sample markdown file
├── api.md # API reference
└── config.json # Sample JSON fileTools Reference
list_files
Lists files in the docs directory matching a glob pattern. Can filter by namespace(s).
Input:
pattern(optional): Glob pattern (default:**/*.{md,mdx,txt,json})ns(optional): Namespace(s) to search - string or array. If omitted, searches all namespacesmax(optional): Maximum results (default: 200)
Output:
count: Number of files returnednamespaces: Array of searched namespacesfiles: Array withns,path,uri,size,mtime,mimeTypeResource links for each file as
docs://{ns}/{path}
read_file
Reads a file from a specific namespace in the docs directory.
Input:
ns(required): Namespace to read frompath(required): Relative path to the file within the namespace
Output:
ns: Namespacepath: File pathbytes: File sizelines: Line countResource link to the file content as
docs://{ns}/{path}
search
Searches for text in files. Can filter by namespace(s).
Input:
query(required): Search textglob(optional): File pattern to searchns(optional): Namespace(s) to search - string or array. If omitted, searches all namespacesmax(optional): Maximum matches (default: 100)contextLines(optional): Context lines (default: 1)
Output:
query: Search termnamespaces: Array of searched namespacesmatchCount: Number of matchesmatches: Array withns,path,lineNumber,line,start,end,uriResource links to matched files as
docs://{ns}/{path}
Resources
The server exposes dynamic resource templates for each namespace:
URI Pattern:
docs://{namespace}/{path}Examples:
docs://docs/welcome.mddocs://api/endpoints.mddocs://guides/tutorial.md
Returns: File content with correct MIME type
Resources are automatically linked in tool responses and can be opened directly in the MCP Inspector.
Security Features
Path Traversal Protection: All paths are validated to ensure they're within the namespace root
Symlink Escape Detection: By default, symlinks pointing outside the namespace are blocked (configurable)
Binary File Rejection: Binary files are automatically skipped
Configurable File Size Limits: Files larger than the configured limit are rejected (default: 256KB)
Namespace Validation: Namespace identifiers are validated (alphanumeric, hyphens, underscores only)
Ignore Patterns: Automatically skip node_modules, .git, and other configured patterns
Sanitized Errors: Error messages don't expose internal paths
Customization
Using Multiple Namespaces
Example 1: Via environment variable
# Windows PowerShell
$env:DOCS_DIRS="docs:./docs,api:./api-docs,guides:C:/guides"
npm run devExample 2: Via docs.config.json
{
"roots": [
{ "ns": "docs", "path": "./docs" },
{ "ns": "api", "path": "./api-docs" },
{ "ns": "guides", "path": "C:/absolute/path/to/guides" }
]
}To add new namespaces, edit the docs.config.json file and restart the server.
Configuring File Size Limits
Edit docs.config.json:
{
"maxFileKB": 512,
"roots": [...]
}Allowing Symlinks
Edit docs.config.json:
{
"allowSymlinks": true,
"roots": [...]
}Warning: Only enable if you trust the symlink targets. This allows symlinks to point outside namespace roots.
Custom Ignore Patterns
Edit docs.config.json:
{
"ignore": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/build/**",
"**/*.log",
"**/tmp/**"
],
"roots": [...]
}Troubleshooting
Server won't start:
Check if port 3000 is already in use
Try a different port:
$env:PORT="3001"; npm startCheck TypeScript compilation errors
Files not appearing:
Verify namespace configuration in
docs.config.jsonorDOCS_DIRSCheck that namespace paths exist and are accessible
Ensure files match the glob pattern
Check file permissions
Review ignore patterns
Namespace not found errors:
Run
roots.listtool to see registered namespacesCheck namespace spelling (case-sensitive)
Verify
docs.config.jsonis valid JSONCheck console logs for initialization warnings
Inspector can't connect:
Verify the server is running
Check the MCP URL is correct:
http://localhost:3000/mcpEnsure no firewall is blocking the connection
Check health endpoint:
http://localhost:3000/health
Path traversal or symlink errors:
Ensure paths are relative to the namespace root
Check
allowSymlinkssetting if using symlinksVerify symlinks don't escape the namespace directory
File too large errors:
Increase
maxFileKBindocs.config.jsonOr filter out large files using ignore patterns
License
ISC
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/JWears/Mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server