Skip to content

Commit 3978d83

Browse files
committed
...
1 parent 3c152ac commit 3978d83

8 files changed

Lines changed: 21 additions & 177 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ This server is based on [MotherDuck's DuckDB MCP Server](https://github.com/moth
1717

1818
### Prompts
1919

20-
The server provides specialized prompts for wetlands data:
21-
22-
`src/mcp_data_server/wetlands-data.md`
20+
The server accepts custom prompts with --custom-prompt argument.
2321

2422
### Tools
2523

example-custom-prompt-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"args": [
66
"mcp-data-server",
77
"--db-path",
8-
"md:",
8+
":memory:",
99
"--custom-prompt",
10-
"/home/cboettig/Documents/github/boettiger-lab/mcp-data-server/wetlands-data.md"
10+
"custom-data-prompt.md"
1111
]
1212
}
1313
}

k8s/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ spec:
5252
apt-get update && apt-get install -y git && \
5353
git clone https://github.com/boettiger-lab/mcp-data-server.git /app && \
5454
cd /app && \
55-
uv run mcp-data-server --port 8001 --host 127.0.0.1 --db-path :memory: --transport stream --custom-prompt wetlands-data.md
55+
uv run mcp-data-server --port 8001 --host 127.0.0.1 --db-path :memory: --transport stream --custom-prompt custom-data-prompt.md
5656
resources:
5757
requests:
5858
cpu: "4"

src/mcp_data_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
@click.option(
7474
"--custom-prompt",
7575
default=None,
76-
help="Path to a custom prompt markdown file to use instead of the built-in wetlands-data.md. The file will be combined with duckdb-prompt.md to form the system prompt.",
76+
help="Path to a custom prompt markdown file to use. The file will be combined with duckdb-prompt.md to form the system prompt.",
7777
)
7878
def main(
7979
port,

src/mcp_data_server/prompt.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ def get_full_prompt(custom_prompt_path: str | None = None) -> str:
1616
1717
Args:
1818
custom_prompt_path: Optional path to a custom prompt markdown file.
19-
If provided, this will be used instead of the built-in wetlands-data.md.
2019
2120
Returns:
22-
Combined prompt text from custom/wetlands context and DuckDB context.
21+
Combined prompt text from custom context and DuckDB context.
2322
"""
2423
# Load custom prompt if provided, otherwise use built-in wetlands context
2524
if custom_prompt_path:
@@ -34,6 +33,3 @@ def get_full_prompt(custom_prompt_path: str | None = None) -> str:
3433
duckdb_context = load_prompt_from_file('duckdb-prompt.md')
3534

3635
return f"{context}\n\n{duckdb_context}"
37-
38-
# For backwards compatibility, export PROMPT_TEMPLATE
39-
PROMPT_TEMPLATE = get_full_prompt()

src/mcp_data_server/server.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ def build_application(
3030

3131
# Generate the prompt template with custom prompt if provided
3232
prompt_template = get_full_prompt(custom_prompt_path)
33+
34+
# Set prompt metadata based on whether custom prompt is used
35+
if custom_prompt_path:
36+
prompt_name = "data-analyst-prompt"
37+
prompt_description = "A prompt for analyzing data using DuckDB SQL queries"
38+
prompt_result_description = "Data analyst prompt for querying databases"
39+
else:
40+
prompt_name = "data-descriptions-prompt"
41+
prompt_description = "A prompt for analyzing global wetlands data including GLWD, protected areas, carbon storage, species ranges, and more using DuckDB"
42+
prompt_result_description = "Wetlands data analyst prompt for querying global wetlands datasets"
3343
db_client = DatabaseClient(
3444
db_path=db_path,
3545
motherduck_token=motherduck_token,
@@ -70,8 +80,8 @@ async def handle_list_prompts() -> list[types.Prompt]:
7080
logger.info("Listing prompts")
7181
return [
7282
types.Prompt(
73-
name="wetlands-data-analyst-prompt",
74-
description="A prompt for analyzing global wetlands data including GLWD, protected areas, carbon storage, species ranges, and more using DuckDB",
83+
name=prompt_name,
84+
description=prompt_description,
7585
)
7686
]
7787

@@ -81,14 +91,14 @@ async def handle_get_prompt(
8191
) -> types.GetPromptResult:
8292
"""
8393
Generate a prompt by combining arguments with server state.
84-
The prompt provides comprehensive wetlands data analysis capabilities.
94+
The prompt provides data analysis capabilities using DuckDB.
8595
"""
8696
logger.info(f"Getting prompt: {name}::{arguments}")
87-
if name != "wetlands-data-analyst-prompt":
97+
if name != prompt_name:
8898
raise ValueError(f"Unknown prompt: {name}")
8999

90100
return types.GetPromptResult(
91-
description="Wetlands data analyst prompt for querying global wetlands datasets",
101+
description=prompt_result_description,
92102
messages=[
93103
types.PromptMessage(
94104
role="user",

tests/test_custom_prompt.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

wetlands-data.md

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)