Skip to main content
Glama

MCP Server

MCP Server là hệ thống phân tích ngữ cảnh tài liệu dự án sử dụng Node.js + Express, tích hợp AI (OpenAI), chạy trong Docker.

Cấu trúc dự án

mcp-server/ ├─ Dockerfile ├─ docker-compose.redis.yml # Dùng Redis Stack ├─ .env.example ├─ package.json ├─ src/ │ ├─ index.js # entry point (Express) │ ├─ config.js │ ├─ routes/ │ │ ├─ upload.js # API upload file │ │ ├─ api.js # API truy vấn AI │ │ └─ tools.js # Tooling AI │ ├─ lib/ │ │ ├─ fileParser.js # parse file, ingest │ │ ├─ textSplitter.js # chia nhỏ text │ │ ├─ embeddings.js # tạo embedding │ │ ├─ vectorStore.redis.js# lưu vector (Redis) │ │ ├─ retriever.js # truy xuất context │ │ └─ promptTemplates.js # prompt cho tooling │ └─ scripts/ │ ├─ ingestAll.js # ingest toàn bộ file │ └─ init.js # khởi tạo thư mục/data └─ data/ # docker volume mount └─ uploads/

Related MCP server: RAG Documentation MCP Server

Hướng dẫn setup

  1. Clone repo & cài đặt dependencies

    git clone <repo-url> cd mcp-server npm install
  2. Cấu hình môi trường

    • Copy file .env.example thành .env và điền API key OpenAI:

      cp .env.example .env # Sửa OPENAI_API_KEY trong .env
  3. Khởi tạo thư mục dữ liệu

    node src/scripts/init.js # hoặc sẽ tự động khi chạy Docker
  4. Chạy với Redis Stack (production-ready vector store)

    • Sử dụng file docker-compose.redis.yml:

      docker-compose -f docker-compose.redis.yml up --build
    • Đảm bảo biến môi trường REDIS_URL đã đúng (mặc định: redis://redis:6379).

Sử dụng

1. Upload tài liệu

  • Gửi file qua API:

    POST /upload Content-Type: multipart/form-data file: <tài liệu dự án>
    • File sẽ được ingest, index thành vector lưu vào Redis.

2. Truy vấn AI

  • Gửi câu hỏi qua API:

    POST /api/query Content-Type: application/json { "question": "Nội dung bạn muốn hỏi về tài liệu dự án" }
    • AI sẽ trả lời dựa trên ngữ cảnh tài liệu đã ingest.

3. Ingest toàn bộ file trong thư mục uploads

npm run ingest

Tooling AI

Các API hỗ trợ dự án:

  • Sinh test-case tự động

    POST /tools/generate-testcase Content-Type: application/json { "requirements": "Yêu cầu phần mềm..." }
  • Tóm tắt tài liệu

    POST /tools/summarize Content-Type: application/json {}
  • Traceability tool

    POST /tools/traceability Content-Type: application/json { "requirements": "Yêu cầu phần mềm..." }

Các API này sử dụng prompt template và AI để sinh kết quả dựa trên ngữ cảnh tài liệu đã ingest.

Lưu ý

  • Đảm bảo đã có API key OpenAI hợp lệ.

  • Thư mục data/uploads là nơi chứa file upload.

  • Vector database chỉ sử dụng Redis, không còn lưu file JSON.

  • Có thể mở rộng các loại tài liệu, pipeline, hoặc tích hợp vector DB khác.


Mọi thắc mắc vui lòng liên hệ admin dự án.

-
security - not tested
F
license - not found
-
quality - not tested

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/vietnama10/knowledge-mcp-service'

If you have feedback or need assistance with the MCP directory API, please join our Discord server