npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

copilot-elastic-mcp

v1.0.0

Published

MCP server bridging GitHub Copilot to an Elasticsearch vector / text knowledge base

Readme

Copilot Elasticsearch MCP

MCP server yang menghubungkan GitHub Copilot Chat di VS Code ke knowledge base internal yang disimpan di Elasticsearch (text + vector search).

Struktur

  • index.js — MCP server (stdio) dengan tool search_vector_db & list_indices.
  • docker-compose.yml — Elasticsearch 8.x single-node untuk development.
  • scripts/seed.js — Mengisi index rag_documents dengan dokumen contoh.
  • scripts/search-test.js — Tes pencarian dari CLI (tanpa MCP).
  • .vscode/mcp.json — Konfigurasi MCP server untuk VS Code.

Fase 1 — Jalankan Elasticsearch

docker compose up -d
# tunggu ~1 menit, lalu verifikasi:
curl http://localhost:9200

Fase 2 — Install Dependencies & Seed Data

npm install
npm run seed          # mengisi index "rag_documents" dengan dokumen contoh
npm run search "microservices"   # opsional: tes pencarian

Fase 3 — Aktifkan MCP di VS Code

File .vscode/mcp.json sudah dikonfigurasi otomatis. Setelah membuka folder d:\repo\mcp di VS Code:

  1. Buka Command Palette → MCP: List Servers (atau panel Copilot MCP).
  2. Pilih elasticsearch-ragStart Server.
  3. Buka Copilot Chat dalam mode Agent, pastikan tool search_vector_db muncul di daftar tools.

Konfigurasi User-level (opsional)

Jika Anda ingin server ini aktif di semua workspace, tambahkan ke settings.json (User):

"mcp": {
  "servers": {
    "elasticsearch-rag": {
      "type": "stdio",
      "command": "node",
      "args": ["d:\\repo\\mcp\\index.js"],
      "env": { "ES_NODE": "http://localhost:9200", "ES_INDEX": "rag_documents" }
    }
  }
}

Catatan: gunakan path absolut dengan double backslash di Windows.

Cara Pengujian

Buka Copilot Chat (mode Agent), lalu coba prompt:

Tolong cari di search_vector_db bagaimana standar arsitektur microservices kita.

Copilot akan memanggil MCP, mengambil dokumen dari Elasticsearch, dan menjawab berdasarkan data internal Anda.

Mengganti BM25 → Vector / kNN

Untuk pencarian semantik, ubah body query di index.js menjadi:

query: {
  knn: {
    field: "embedding",
    query_vector: <embedding dari query>,
    k: 5,
    num_candidates: 50
  }
}

dan saat indexing, simpan field embedding (dense_vector dims sesuai model embedding yang Anda pakai, mis. 768/1024/1536). Embedding bisa dihasilkan oleh model lokal (Ollama, sentence-transformers) atau API (OpenAI, Azure OpenAI, dsb.).

Variabel Lingkungan

| Variable | Default | Keterangan | |---|---|---| | ES_NODE | http://localhost:9200 | URL Elasticsearch | | ES_INDEX | rag_documents | Nama index | | ES_API_KEY | — | API key (jika security on) | | ES_USERNAME / ES_PASSWORD | — | Basic auth alternatif | | SEARCH_SIZE | 5 | Jumlah hasil default |