Skip to main content
Glama

CBCI MCP

by ci671233

CBCI MCP

CBCI MCP (Model Context Protocol) - ChatBot CI with Dynamic Database Querying

이 패키지는 LLM을 활용한 동적 데이터베이스 질의응답 챗봇 시스템입니다.

설치

pip install cbci-mcp

사용법

기본 사용법

from cbci_mcp import CBCIMCPClient # 클라이언트 생성 client = CBCIMCPClient() # 서버 시작 client.start_server() # 설정 (키워드 인수 지원) client.setup(config="config.yaml", questions="questions.yaml", schema="schema.yaml") # 질문하기 answer = client.ask("서울 2023년 학생수") print(answer) # 서버 종료 client.stop_server()

설정 파일 예시

config.yaml
# OpenAI API 설정 openai: api_key: "your-api-key-here" model: "gpt-4" temperature: 0.3 max_tokens: 1000 # 데이터베이스 연결 database: host: "your-db-host" port: 25010 user: "your-username" password: "your-password" database: "your-database" db_type: "db2" # 챗봇 설정 chatbot: name: "데이터 분석 어시스턴트" show_sql: false show_technical_details: false max_history: 20
questions.yaml (예시)
qa_pairs: - id: "example_students" question: "학생수" keywords: ["학생수", "학생", "총", "전체"] sql_template: | SELECT SUM(A.STDNT_NOPE) AS TOTAL_STUDENTS FROM YOUR_TABLE A LEFT JOIN REGION_TABLE B ON A.RGN_CD = B.RGN_CD WHERE 1=1 {{REGION_FILTER}} {{YEAR_FILTER}} answer_template: "조건에 맞는 학생수는 {TOTAL_STUDENTS:,}명입니다." verified: true sql_filters: REGION_FILTER: "AND B.RGN_NM = '{{RGN_NM}}'" YEAR_FILTER: "AND A.CRTR_YR = {{CRTR_YR}}" matching: similarity_threshold: 0.3 fallback_message: "죄송합니다. 해당 질문에 대한 정보를 찾을 수 없습니다."
schema.yaml (예시)
tables: students_table: description: "학생수 테이블" columns: RGN_CD: "지역 코드" CRTR_YR: "기준 연도" STDNT_NOPE: "학생수" business_rules: join_patterns: - "지역 조회시: [데이터테이블] LEFT JOIN REGION_TABLE ON RGN_CD" data_structure: - "RGN_CD: 지역별 고유코드" - "CRTR_YR: 연도별 데이터"

API

CBCIMCPClient

__init__(server_script=None)
  • server_script: 서버 스크립트 경로 (기본값: 자동 감지)
start_server()

MCP 서버를 시작합니다.

stop_server()

MCP 서버를 종료합니다.

setup(config="config.yaml", questions="questions.yaml", schema="schema.yaml")
  • config: 설정 파일명
  • questions: 질문 템플릿 파일명
  • schema: 스키마 정보 파일명
  • 반환값: 설정 결과 딕셔너리
ask(question)
  • question: 질문 문자열
  • 반환값: 답변 문자열
get_questions()
  • 반환값: 사용 가능한 질문 목록

특징

  • LLM 파라미터 추출: 자연어 질문에서 자동으로 연도, 지역, 카테고리 등 추출
  • 동적 SQL 생성: 템플릿 기반으로 파라미터에 맞는 SQL 자동 생성
  • 유연한 설정: config, questions, schema 파일을 자유롭게 지정 가능
  • 키워드 인수 지원: 직관적인 setup 방식
  • 확장 가능: 다양한 도메인과 데이터베이스에 적용 가능

의존성

  • openai>=1.0.0: OpenAI API 클라이언트
  • pandas>=1.5.0: 데이터 처리
  • pyyaml>=6.0: YAML 설정 파일 처리
  • ibm-db>=3.1.0: DB2 데이터베이스 연결

라이선스

MIT License

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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables dynamic database querying through natural language questions using LLM-powered parameter extraction and template-based SQL generation. Supports flexible configuration for various domains and databases with automated response formatting.

  1. 설치
    1. 사용법
      1. 기본 사용법
      2. 설정 파일 예시
    2. API
      1. CBCIMCPClient
    3. 특징
      1. 의존성
        1. 라이선스

          Related MCP Servers

          • A
            security
            F
            license
            A
            quality
            Enables querying WolframAlpha's LLM API for natural language questions, providing structured and simplified answers optimized for LLM consumption.
            Last updated -
            3
            36
            TypeScript
          • A
            security
            A
            license
            A
            quality
            Enables querying documents through a Langflow backend using natural language questions, providing an interface to interact with Langflow document Q\&A flows.
            Last updated -
            1
            14
            JavaScript
            MIT License
            • Apple
          • A
            security
            A
            license
            A
            quality
            A server that enables LLMs like Claude to query AWS DynamoDB databases through natural language requests, supporting table management, data querying, and schema analysis.
            Last updated -
            7
            666
            JavaScript
            MIT License
            • Apple
          • -
            security
            F
            license
            -
            quality
            A FastMCP server that enables natural language querying of PostgreSQL databases through LLM integration, allowing users to generate SQL queries from plain English and visualize the results.
            Last updated -
            2
            Python

          View all related MCP servers

          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/ci671233/cbci_mcp'

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