Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@channel.io/commerce-token-mcp

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@channel.io/commerce-token-mcp

Commerce Token MCP

latest
npmnpm
Version
3.0.0
Version published
Maintainers
3
Created
Source

Commerce Token MCP

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

주요 특징

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

환경 변수

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

변수명설명
REDASH_API_KEYRedash API Key
REDASH_BASE_URLRedash 서버 URL (예: https://redash.example.com)
REDASH_DATA_SOURCE_ID_PSQLRedash에서 사용하는 데이터소스 ID (숫자)

.env 예시:

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

사용 방법

  • MCP 서버 실행 (빌드 후):

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

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

    • 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 플랫폼팀에 문의하세요.

FAQs

Package last updated on 02 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts