Skip to content

feat: support for tree model #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ uv.lock
# IDE settings (optional)
.vscode/
.idea/
.specstory/
.cursor/

# Distribution directories
*.dist-info/
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,30 @@ The server doesn't expose any resources.
The server doesn't provide any prompts.

### Tools
The server offers three core tools:
The server offers different tools for IoTDB Tree Model and Table Model. You can choose between them by setting the "IOTDB_SQL_DIALECT" configuration to either "tree" or "table".

#### Query Tools
#### Tree Model
- `metadata_query`
- Execute SHOW/COUNT queries to read metadata from the database
- Input:
- `query_sql` (string): The SHOW/COUNT SQL query to execute
- Returns: Query results as array of objects
- `select_query`
- Execute SELECT queries to read data from the database
- Input:
- `query_sql` (string): The SELECT SQL query to execute
- Returns: Query results as array of objects

#### Table Model

##### Query Tools
- `read_query`
- Execute SELECT queries to read data from the database
- Input:
- `query` (string): The SELECT SQL query to execute
- Returns: Query results as array of objects


#### Schema Tools
##### Schema Tools
- `list_tables`
- Get a list of all tables in the database
- No input required
Expand All @@ -37,7 +50,6 @@ The server offers three core tools:
- Returns: Array of column definitions with names and types



## Claude Desktop Integration

## Prerequisites
Expand Down Expand Up @@ -90,7 +102,8 @@ Location: `%APPDATA%/Claude/claude_desktop_config.json`
"IOTDB_PORT": "6667",
"IOTDB_USER": "root",
"IOTDB_PASSWORD": "root",
"IOTDB_DATABASE": "test"
"IOTDB_DATABASE": "test",
"IOTDB_SQL_DIALECT": "table"
}
}
}
Expand Down
31 changes: 22 additions & 9 deletions src/iotdb_mcp_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ class Config:

database: str
"""
IoTDB database name
IoTDB database
"""

sql_dialect: str
"""
SQL dialect: tree or table
"""

@staticmethod
Expand All @@ -73,13 +78,6 @@ def from_env_arguments() -> "Config":
default=os.getenv("IOTDB_PORT", 6667),
)

parser.add_argument(
"--database",
type=str,
help="IoTDB connect database name",
default=os.getenv("IOTDB_DATABASE", "test"),
)

parser.add_argument(
"--user",
type=str,
Expand All @@ -94,11 +92,26 @@ def from_env_arguments() -> "Config":
default=os.getenv("IOTDB_PASSWORD", "root"),
)

parser.add_argument(
"--database",
type=str,
help="IoTDB connect database name",
default=os.getenv("IOTDB_DATABASE", "test"),
)

parser.add_argument(
"--sql-dialect",
type=str,
help="SQL dialect: tree or table",
default=os.getenv("IOTDB_SQL_DIALECT", "table"),
)

args = parser.parse_args()
return Config(
host=args.host,
port=args.port,
database=args.database,
user=args.user,
password=args.password,
database=args.database,
sql_dialect=args.sql_dialect,
)
Loading