Skip to content

Conversation

@killme2008
Copy link
Contributor

@killme2008 killme2008 commented Nov 30, 2025

Main changes:

  1. Updated dependencies to use fast MCP and simplified the server.
  2. Added support for CTE queries in property results.
  3. Added JSON and Markdown output formats.
  4. Introduced a connection pool for GreptimeDB.
  5. New tools:
Tool Description
execute_sql Executes SQL queries with configurable output format (CSV/JSON/Markdown) and row limits
describe_table Returns table schema, including column names, types, and constraints
health_check Checks database connectivity and returns server version
execute_tql Runs TQL (PromQL-compatible) queries for time-series analysis
query_range Performs time-window aggregations with RANGE/ALIGN syntax
explain_query Shows execution plans for SQL or TQL queries
  1. Improved security (closes Enhance security #14).
  2. Desensitized query results (closes Query data desensitization #6):
id customer_name credit_card cvv bank_account amount ts
3 Charlie Brown ****** ****** ****** 299.0 2024-01-03 12:00:00
2 Bob Johnson ****** ****** ****** 149.5 2024-01-02 11:00:00
1 Alice Smith ****** ****** ****** 99.99 2024-01-01 10:00:00
  1. Added more prompt templates (closes Add prompts for support security logs anylysis #13).
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008 killme2008 requested a review from Copilot November 30, 2025 04:00
Copilot finished reviewing on behalf of killme2008 November 30, 2025 04:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes CTE (Common Table Expression) query support and adds several new features to the GreptimeDB MCP server. The main changes include fixing a spelling error ("Forbided" → "Forbidden"), adding support for WITH clauses in SQL queries, implementing new database tools (describe_table, health_check, execute_tql, query_range, explain_query), adding connection pooling, and enhancing the execute_sql tool with multiple output formats (CSV, JSON, Markdown) and row limiting.

Key changes:

  • Fixed CTE queries: Added "WITH" to allowed SQL statement prefixes to enable Common Table Expressions
  • New database tools: Added 5 new tools for table inspection, health checking, TQL queries, range queries, and query explanation
  • Enhanced output formats: Added JSON and Markdown formatting options with proper datetime handling

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/greptimedb_mcp_server/utils.py Fixed spelling error: "Forbided" → "Forbidden" in security gate error messages
src/greptimedb_mcp_server/server.py Added connection pooling, new format_results function, 5 new tool implementations (_health_check, _describe_table, _execute_tql, _query_range, _explain_query), enhanced execute_sql with format/limit options, and refactored resource methods to use async patterns
tests/test_utils.py Updated tests for spelling fixes, added comprehensive tests for format_value and format_results functions, added security gate tests for newly allowed operations (EXPLAIN, WITH, TQL, SHOW, DESC)
tests/test_server.py Updated expected tool count to 6, adjusted test assertions for new CSV quoting behavior, added tests for all new tools and their parameter validation
conftest.py Enhanced mocks to support fetchmany/fetchone, added MockConnectionPool for testing connection pooling, added mock responses for DESCRIBE, VERSION, TQL, EXPLAIN, and ALIGN queries
README.md Updated documentation to describe new tools, features, security controls, and usage examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008 killme2008 requested a review from Copilot November 30, 2025 04:19
Copilot finished reviewing on behalf of killme2008 November 30, 2025 04:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008 killme2008 requested a review from Copilot November 30, 2025 04:58
Copilot finished reviewing on behalf of killme2008 November 30, 2025 05:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
@killme2008
Copy link
Contributor Author

@sunng87 @JetSquirrel

All set. Most of the code is just templates and tests, so no worries. 😄

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants