Skip to content

Commit 5ebf8df

Browse files
Merge pull request #30 from keboola/KAB-906-big-query
Kab 906 big query
2 parents ec1fb64 + 6a792c8 commit 5ebf8df

File tree

12 files changed

+624
-214
lines changed

12 files changed

+624
-214
lines changed

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A Model Context Protocol (MCP) server for interacting with Keboola Connection. T
1111

1212
- Python 3.10 or newer
1313
- Keboola Storage API token
14-
- Snowflake Read Only Workspace
14+
- Snowflake or BigQuery Read Only Workspace
1515

1616
## Installation
1717

@@ -70,7 +70,7 @@ To use this server with Claude Desktop, follow these steps:
7070
],
7171
"env": {
7272
"KBC_STORAGE_TOKEN": "your-keboola-storage-token",
73-
"KBC_WORKSPACE_USER": "your-workspace-user"
73+
"KBC_WORKSPACE_SCHEMA": "your-workspace-schema"
7474
}
7575
}
7676
}
@@ -79,15 +79,15 @@ To use this server with Claude Desktop, follow these steps:
7979

8080
Replace:
8181
- `/path/to/keboola-mcp-server` with your actual path to the cloned repository
82-
- `your-keboola-storage-token` with your Keboola Storage API token
8382
- `YOUR_REGION` with your Keboola region (e.g., `north-europe.azure`, etc.). You can remove it if your region is just `connection` explicitly
84-
- `your-workspace-user` with your Snowflake workspace username
83+
- `your-keboola-storage-token` with your Keboola Storage API token
84+
- `your-workspace-schema` with your Snowflake schema or BigQuery dataset of your workspace
8585

8686
> Note: If you are using a specific version of Python (e.g. 3.11 due to some package compatibility issues),
8787
> you'll need to update the `command` into using that specific version, e.g. `/path/to/keboola-mcp-server/.venv/bin/python3.11`
8888
89-
> Note: The Read Only Snowflake Workspace can be created in your Keboola project. It is the same project where you got
90-
> your Storage Token. The workspace will provide all the necessary Snowflake connection parameters including the username.
89+
> Note: The Workspace can be created in your Keboola project. It is the same project where you got
90+
> your Storage Token. The workspace will provide all the necessary connection parameters including the schema or dataset name.
9191
9292
3. After updating the configuration:
9393
- Completely quit Claude Desktop (don't just close the window)
@@ -117,7 +117,7 @@ To use this server with Cursor AI, you have two options for configuring the tran
117117
{
118118
"mcpServers": {
119119
"keboola": {
120-
"url": "http://localhost:8000/sse?storage_token=YOUR-KEBOOLA-STORAGE-TOKEN&workspace_user=YOUR-WORKSPACE-USER"
120+
"url": "http://localhost:8000/sse?storage_token=YOUR-KEBOOLA-STORAGE-TOKEN&workspace_schema=YOUR-WORKSPACE-SCHEMA"
121121
}
122122
}
123123
}
@@ -129,7 +129,7 @@ To use this server with Cursor AI, you have two options for configuring the tran
129129
{
130130
"mcpServers": {
131131
"keboola": {
132-
"command": "/path/to/keboola-mcp-server/venv/bin/python",
132+
"command": "/path/to/keboola-mcp-server/.venv/bin/python",
133133
"args": [
134134
"-m",
135135
"keboola_mcp_server",
@@ -140,7 +140,7 @@ To use this server with Cursor AI, you have two options for configuring the tran
140140
],
141141
"env": {
142142
"KBC_STORAGE_TOKEN": "your-keboola-storage-token",
143-
"KBC_WORKSPACE_USER": "your-workspace-user"
143+
"KBC_WORKSPACE_SCHEMA": "your-workspace-schema"
144144
}
145145
}
146146
}
@@ -160,7 +160,7 @@ When running the MCP server from Windows Subsystem for Linux with Cursor AI, use
160160
"-c",
161161
"'source /wsl_path/to/keboola-mcp-server/.env",
162162
"&&",
163-
"/wsl_path/to/keboola-mcp-server/venv/bin/python -m keboola_mcp_server.cli --transport stdio'"
163+
"/wsl_path/to/keboola-mcp-server/.venv/bin/python -m keboola_mcp_server.cli --transport stdio'"
164164
]
165165
}
166166
}
@@ -169,21 +169,35 @@ When running the MCP server from Windows Subsystem for Linux with Cursor AI, use
169169
- where `/wsl_path/to/keboola-mcp-server/.env` file contains environment variables:
170170
```shell
171171
export KBC_STORAGE_TOKEN="your-keboola-storage-token"
172-
export KBC_WORKSPACE_USER="your-workspace-user"
172+
export KBC_WORKSPACE_SCHEMA="your-workspace-schema"
173173
```
174174

175-
Replace all placeholder values (`your_*`) with your actual Keboola and Snowflake credentials. These can be obtained from your Keboola project's Read Only Snowflake Workspace.
176-
Replace `YOUR_REGION` with your Keboola region (e.g., `north-europe.azure`, etc.). You can remove it if your region is just `connection` explicitly.
175+
Replace:
176+
- `/path/to/keboola-mcp-server` with your actual path to the cloned repository
177+
- `YOUR_REGION` with your Keboola region (e.g., `north-europe.azure`, etc.). You can remove it if your region is just `connection` explicitly
178+
- `your-keboola-storage-token` with your Keboola Storage API token
179+
- `your-workspace-schema` with your Snowflake schema or BigQuery dataset of your workspace
177180

178181
After updating the configuration:
179182
1. Restart Cursor AI
180183
2. If you use the `sse` transport make sure to start your MCP server. You can do so by running this in the activated
181184
virtual environment where you built the server:
182185
```
183-
/path/to/keboola-mcp-server/venv/bin/python -m keboola_mcp_server --transport sse --api-url https://connection.YOUR_REGION.keboola.com
186+
/path/to/keboola-mcp-server/.venv/bin/python -m keboola_mcp_server --transport sse --api-url https://connection.YOUR_REGION.keboola.com
184187
```
185188
3. Cursor AI should be automatically detect your MCP server and enable it.
186189

190+
## BigQuery support
191+
192+
If your Keboola project uses BigQuery backend you will need to set `GOOGLE_APPLICATION_CREDENTIALS` environment variable
193+
in addition to `KBC_STORAGE_TOKEN` and `KBC_WORKSPACE_SCHEMA`.
194+
195+
1. Go to your Keboola BigQuery workspace and display its credentials (click `Connect` button).
196+
2. Download the credentials file to your local disk. It is a plain JSON file.
197+
3. Set the full path of the downloaded JSON credentials file to `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
198+
199+
This will give your MCP server instance permissions to access your BigQuery workspace in Google Cloud.
200+
187201
## Available Tools
188202

189203
The server provides the following tools for interacting with Keboola Connection:

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "keboola-mcp-server"
7-
version = "0.3.0"
7+
version = "0.4.0"
88
description = "MCP server for interacting with Keboola Connection"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -16,6 +16,7 @@ dependencies = [
1616
"mcp[cli] ~= 1.6",
1717
"kbcstorage ~= 0.9",
1818
"httpx ~= 0.28",
19+
"google-cloud-bigquery ~= 3.31"
1920
]
2021

2122
[project.optional-dependencies]

src/keboola_mcp_server/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class KeboolaClient:
1919
@classmethod
2020
def from_state(cls, state: Mapping[str, Any]) -> "KeboolaClient":
2121
instance = state[cls.STATE_KEY]
22-
assert isinstance(instance, KeboolaClient)
22+
assert isinstance(instance, KeboolaClient), f"Expected KeboolaClient, got: {instance}"
2323
return instance
2424

2525
def __init__(

src/keboola_mcp_server/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Config:
1414

1515
storage_token: Optional[str] = None
1616
storage_api_url: str = "https://connection.keboola.com"
17-
workspace_user: Optional[str] = None
17+
workspace_schema: Optional[str] = None
1818

1919
@classmethod
2020
def _read_options(cls, d: Mapping[str, str]) -> Mapping[str, str]:

src/keboola_mcp_server/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _(params: SessionParams) -> SessionState:
4343
raise
4444

4545
try:
46-
workspace_manager = WorkspaceManager(client, cfg.workspace_user)
46+
workspace_manager = WorkspaceManager(client, cfg.workspace_schema)
4747
state[WorkspaceManager.STATE_KEY] = workspace_manager
4848
logger.info("Successfully initialized Storage API Workspace manager.")
4949
except Exception as e:

0 commit comments

Comments
 (0)