mcp-code
Click on "Deploy 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-codelist the files in the project root and read README.md"
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-code
MCP server chạy trên máy của bạn, cho phép Claude đọc và tìm kiếm code trong một thư mục được chỉ định. Server chỉ có quyền đọc, không ghi file và không chạy lệnh.
Tính năng
Tool | Mô tả |
| Liệt kê file và thư mục |
| Đọc nội dung một file text |
| Tìm chuỗi trong code, trả về |
Các thư mục .git, node_modules, __pycache__, .venv bị bỏ qua. Các file .env, id_rsa, id_ed25519 bị chặn không cho đọc.
Related MCP server: claude-projects-mcp-server
Yêu cầu
Python 3.10 trở lên
Cài đặt
git clone https://github.com/itgiup/mcp-code.git
cd mcp-code
uv syncDự án dùng mcp bản 1.x (mcp[cli]<2). Bản 2.x đã đổi API (FastMCP thành MCPServer) nên chưa tương thích.
Chạy thử
MCP_CODE_ROOT=/path/to/your/project uv run mcp-codeServer dùng giao thức stdio nên sẽ đứng im chờ input, không in gì ra. Đó là bình thường, nhấn Ctrl+C để thoát. Nếu có traceback thì là lỗi cài đặt.
Muốn thử các tool qua giao diện web:
uv run mcp dev src/mcp_code/__init__.pyCấu hình Claude Desktop
Mở file cấu hình claude_desktop_config.json (trong Claude Desktop: Settings → Developer → Edit Config) và thêm:
{
"mcpServers": {
"mcp-code": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/mcp-code",
"run",
"mcp-code"
],
"env": {
"MCP_CODE_ROOT": "/path/to/your/project"
}
}
}
}Thay các đường dẫn cho đúng máy của bạn:
command: đường dẫn tuyệt đối tớiuv, lấy bằngwhich uv.--directory: thư mục chứa projectmcp-codenày. Bắt buộc, vì Claude Desktop không chạy lệnh trong thư mục project.MCP_CODE_ROOT: thư mục Claude được phép đọc. Nếu bỏ trống, server dùng thư mục làm việc hiện tại của tiến trình, thường không phải thứ bạn muốn.
Nếu file đã có sẵn nội dung khác, chỉ thêm khối mcpServers và nhớ dấu phẩy để JSON hợp lệ. Sau đó thoát hẳn Claude Desktop rồi mở lại.
Kiểm tra bằng cách mở chat mới và hỏi, ví dụ: "Liệt kê file trong thư mục gốc rồi đọc README.md".
Bảo mật
Server chỉ đọc được bên trong
MCP_CODE_ROOT. Mọi đường dẫn thoát ra ngoài (ví dụ../) đều bị từ chối.Hãy trỏ
MCP_CODE_ROOTvào một dự án cụ thể, không trỏ vào cả thư mục home.Nội dung các file Claude đọc sẽ được gửi tới Claude, nên đừng trỏ vào thư mục chứa bí mật.
Muốn chặn thêm file nhạy cảm, thêm tên file vào tập
BLOCKEDtrongsrc/mcp_code/__init__.py.
Xử lý lỗi
Hiện tượng | Cách xử lý |
| Sai đường dẫn |
| Đang dùng mcp 2.x. Chạy |
Server thoát ngay sau khi khởi động | Chạy tay |
Có tool nhưng không đọc được file | Kiểm tra |
Khi viết thêm code, không dùng print() ra stdout vì stdout dành cho giao thức MCP. Dùng print(..., file=sys.stderr) để debug.
Giấy phép
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Give Claude only the Google Drive files you choose. Every action logged.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Path-scoped team memories, rules and skills for Claude Code, Cursor, Codex and other MCP clients.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides Claude Desktop with direct access to your local file system for development tasks, enabling file operations (read, write, edit), directory browsing, command execution, and codebase search within a configured projects directory.6MIT
- AlicenseAqualityAmaintenanceEnables Claude Code to read, create, update, and delete Claude Cowork/claude.ai projects and their knowledge documents, including syncing local folders to projects, with safety features like backups and overwrite protection.17MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Web to securely inspect, search, and modify local project files through a sandboxed MCP server with atomic writes, path traversal protection, and sensitive file blocking.MIT
- FlicenseAqualityCmaintenanceA read-only MCP server that lets Claude read and search source code from local project folders, with path containment security.4-