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

@ludovicl33/cds-mcp

v1.6.1

Published

MCP server for CDS API with OAuth2 authentication, product search, delivery information, SAV management, and customer service capabilities

Downloads

44

Readme

CDS MCP Server

Un serveur MCP (Model Context Protocol) pour interagir avec l'API CDS et le système d'authentification Peaksys.

Installation

npm install
npm run build

Utilisation

Démarrer le serveur MCP

npm start

Ou en mode développement :

npm run dev

Méthodes disponibles

1. Authentification OAuth2

Authentification via le flux OAuth2 avec PKCE (Proof Key for Code Exchange) sur https://auth.peaksys.com.

Fonctionnement :

  1. Génération d'une URL d'autorisation avec PKCE
  2. Ouverture automatique du navigateur pour l'authentification utilisateur
  3. L'utilisateur saisit ses identifiants (login/mot de passe) sur la page Peaksys
  4. Récupération du code d'autorisation via un serveur de callback local
  5. Échange du code contre un token d'accès

Paramètres :

  • clientId (string) : L'ID client OAuth
  • clientSecret (string, optionnel) : Le secret client OAuth (non nécessaire avec PKCE)
  • redirectUri (string, optionnel) : L'URI de redirection (défaut: http://localhost:3000/callback)
  • scope (string, optionnel) : Le scope OAuth (défaut: read write)

Retour : Token d'authentification et informations de session

Sécurité : Utilise PKCE pour sécuriser le flux d'authentification sans nécessiter de client_secret

2. Recherche de produits

Recherche de produits par mot-clé.

Paramètres :

  • searchWord (string) : Le mot-clé de recherche

Retour : Liste des produits correspondants avec leurs détails

3. Détails d'un produit

Récupération des détails complets d'un produit.

Paramètres :

  • productId (string) : L'ID du produit

Retour : Détails complets du produit (prix, marque, description, etc.)

4. Informations de livraison

Récupération des meilleures informations de livraison pour un produit.

Paramètres :

  • productId (string) : L'ID du produit
  • offerId (string) : L'ID de l'offre
  • postalCode (string) : Code postal
  • longitude (number) : Longitude
  • latitude (number) : Latitude
  • city (string) : Ville
  • country (string) : Code pays (ex: FR)

Retour : Informations de livraison (gratuité, délais, etc.)

Configuration MCP

Pour utiliser ce serveur avec un client MCP en local, ajoutez la configuration suivante :

{
  "mcpServers": {
    "cdiscount-mcp-local": {
      "command": "node",
      "args": ["/path/to/your/dist/index.js"],
      "env": {}
    }
  }
}

en distant :

{
  "mcpServers": {
    "cdiscount-mcp": {
      "command": "npx",
      "args": [
        "@ludovicl33/cds-mcp"
      ]
    },
  }
}

Exemple d'utilisation

Authentification OAuth2

// Exemple d'appel pour l'authentification OAuth2 (sans client_secret)
const authResult = await authenticateOAuth(
  "your-client-id",
  undefined, // client_secret optionnel - PKCE sécurise le flux
  "http://localhost:3000/callback",
  "read write"
);

// Le navigateur s'ouvrira automatiquement pour l'authentification
// L'utilisateur devra saisir ses identifiants sur la page Peaksys

Donnée pour le test oauth2
login	[email protected]
password	Fierce-Kingfisher-16

Recherche de produits

// Exemple d'appel pour la recherche
const searchResult = await searchByKeyword("smartphone");

Développement

Structure du projet

  • src/index.ts : Serveur MCP principal
  • src/mcp.ts : Implémentation des méthodes CDS et OAuth
  • src/http.ts : Utilitaires pour les requêtes HTTP
  • src/cli.ts : Interface en ligne de commande

Tests

npm test

Notes importantes

  • L'authentification OAuth2 utilise le flux d'autorisation avec PKCE pour une sécurité maximale
  • Le client_secret n'est pas nécessaire grâce au PKCE qui sécurise le flux sans secret
  • Le navigateur s'ouvre automatiquement pour l'authentification utilisateur
  • Un serveur de callback local est démarré temporairement pour récupérer le code d'autorisation
  • Toutes les requêtes CDS utilisent les headers appropriés pour simuler une requête mobile
  • Les erreurs sont gérées et retournées de manière formatée

Licence

ISC