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

@channel.io/commerce-token-mcp

v3.0.0

Published

Commerce Token MCP

Downloads

16

Readme

Commerce Token MCP

이 MCP 서버는 커머스 채널의 accessToken을 안전하게 조회해주는 서비스입니다. 외부망 API 호출 없이 Redash를 통해 DB에서 직접 accessToken을 조회합니다.

주요 특징

  • Redash 기반: 외부망 API가 아닌 내부 DB를 Redash로 직접 조회
  • 파라미터 최소화: channelId, env만 입력하면 됨
  • 자동 타입 분기: channel.channels 테이블에서 app_commerce_type을 조회하여 shopify/shopby 등 자동 분기
  • 확장성: 새로운 커머스 타입 추가 시 분기만 추가하면 됨

환경 변수

아래 환경변수들이 반드시 필요합니다:

| 변수명 | 설명 | | ---------------------------- | ------------------------------------------------ | | REDASH_API_KEY | Redash API Key | | REDASH_BASE_URL | Redash 서버 URL (예: https://redash.example.com) | | REDASH_DATA_SOURCE_ID_PSQL | Redash에서 사용하는 데이터소스 ID (숫자) |

.env 예시:

REDASH_API_KEY=your_redash_api_key
REDASH_BASE_URL=https://redash.example.com
REDASH_DATA_SOURCE_ID_PSQL=1

사용 방법

  1. MCP 서버 실행 (빌드 후):

    pnpm build
    node dist/index.js
  2. MCP Tool 호출 시 파라미터 예시:

    {
      "channelId": "your_channel_id",
      "env": "exp" // 또는 "prod"
    }
  3. 동작 방식:

    • channelId, env를 입력받음
    • 내부적으로 channel.channels(또는 channel_exp.channels)에서 app_commerce_type을 조회
    • 타입이 appShopify면 shopify 테이블에서, appShopby면 shopby 테이블에서 accessToken을 조회
    • accessToken을 반환

예시 쿼리 구조

  • app_commerce_type 조회

    SELECT app_commerce_type FROM channel.channels WHERE id = '{channelId}';

    (env가 exp면 channel_exp.channels)

  • accessToken 조회

    • Shopify:
      SELECT access_token FROM channel.app_shopifies WHERE channel_id = '{channelId}';
      (env가 exp면 channel_exp.app_shopifies)
    • Shopby:
      SELECT access_token FROM app_commerce.app_shopbies WHERE channel_id = '{channelId}';
      (env가 exp면 app_commerce_exp.app_shopbies)

확장/유지보수

  • 새로운 커머스 타입이 추가될 경우, tokenService.ts에 분기만 추가하면 됩니다.
  • 환경변수 및 DB 구조가 바뀌면 utils/config.ts와 쿼리 로직만 수정하면 됩니다.

개발 및 테스트

  • 타입 안정성을 위해 EnvType("exp" | "prod")을 사용합니다.
  • 모든 주요 로직은 src/services/tokenService.ts에 구현되어 있습니다.
  • Redash 쿼리 실행 유틸은 src/services/redash.service.ts에 위치합니다.

문의/기여

  • Channel 팀 내부 MCP 도구로, 외부 공개용이 아닙니다.
  • 개선/문의는 Channel 플랫폼팀에 문의하세요.