KWDB

KWDB

Reading, writing, querying, modifying data, and performing DDL operations with data in your KWDB Database.

4
Stars
2
Forks
3
Releases

Overview

The KWDB MCP Server is a server implementation of the Model Context Protocol (MCP) that exposes tools and resources to interact with the KWDB database and enable business intelligence workflows through MCP. It supports reading, writing, querying, and modifying data, as well as performing DDL operations. The architecture includes components to parse MCP requests (StdIO or HTTP), schedule MCP Tools by operation type, automatically augment SQL with a LIMIT 20 clause for queries lacking a limit, and format all API responses in a consistent JSON structure. The server defines standard API responses: tool errors are wrapped in result objects with an isError flag; resources errors are returned as standard JSON-RPC errors; successful operations return content arrays or results. It enforces security by providing separate tools for read and write, validating queries against expected operation types, and printing clear error messages for unauthorized operations. MCP Resources expose read-only data such as product information, database metadata, and table schemas for MCP clients as context. MCP Tools expose executable functionality (e.g., read-query and write-query) to LLMs and external clients. Prompts, prompts.go, and embedded Markdown files define reusable templates and guides; three transport modes (StdIO, HTTP, SSE) enable flexible deployment, including LLM agent integration and troubleshooting.

Details

Owner
KWDB
Language
Go
License
MIT License
Updated
2025-12-07

Features

Read Operations

Execute read-only queries such as SELECT, SHOW, EXPLAIN, and other data-retrieval commands.

Write Operations

Execute data modification queries (INSERT, UPDATE, DELETE) and DDL statements (CREATE, DROP, ALTER).

Database Information

Provide access to database information, including tables and their schemas.

Syntax Guide

Offer a comprehensive syntax guide for KWDB via MCP Prompts.

Standard API Response

Maintain consistent error handling: tool errors use isError-wrapped results; resources return standard JSON-RPC errors; successes return content arrays.

Automatic LIMIT

Automatically add LIMIT 20 to SELECT queries that lack a LIMIT clause to prevent large result sets.

Security

Enforce separation of read/write tools, validate query types, and provide clear error messages for unauthorized operations.

MCP Resources

Expose read-only MCP Resources such as product info, database metadata, and table schemas for client context.

Audience

Data scientistsLeverage MCP to query, analyze, and extract insights from KWDB data for BI workflows.
LLM developersIntegrate KWDB via MCP Tools and Resources to build AI-assisted data applications.
Database adminsManage database information, schemas, and DDL operations using standardized MCP channels.

Tags

KWDBMCPModel Context ProtocoldatabaseSQLreadwriteDDLMCP ToolsMCP ResourcesMCP PromptsLLM integrationAPISecurityStdIOHTTPSSE