Skip to content

Commit 94e5db2

Browse files
committed
Tests: Add software tests for examples/mcptools.sh
1 parent 5c95e00 commit 94e5db2

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
enable-cache: true
6969
version: "latest"
7070

71+
- name: Set up mcptools
72+
run: |
73+
go install github.com/f/mcptools/cmd/mcptools@latest
74+
7175
- name: Set up project
7276
run: |
7377
uv pip install --editable='.[all,develop,test]'

examples/mcptools.sh

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
24

35
# CrateDB MCP Server example with `mcptools`
46
#
@@ -12,6 +14,9 @@
1214
# brew tap f/mcptools
1315
# brew install mcp uv
1416

17+
# Some systems do not provide the `mcpt` alias.
18+
alias mcpt=mcptools
19+
1520
# Explore the Text-to-SQL tools.
1621
mcpt call query_sql --params '{"query":"SELECT * FROM sys.summits LIMIT 3"}' uvx cratedb-mcp serve
1722
mcpt call get_table_metadata uvx cratedb-mcp serve
@@ -22,3 +27,5 @@ mcpt call get_cratedb_documentation_index uvx cratedb-mcp serve
2227
mcpt call \
2328
fetch_cratedb_docs --params '{"link":"https://cratedb.com/docs/cloud/en/latest/_sources/cluster/integrations/mongo-cdc.md.txt"}' \
2429
uvx cratedb-mcp serve
30+
31+
echo "Ready."

tests/test_examples.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ruff: noqa: S603, S607
2+
import subprocess
3+
from shutil import which
4+
5+
import pytest
6+
7+
8+
@pytest.mark.skipif(not which("mcptools"), reason="requires mcptools")
9+
def test_mcptools():
10+
proc = subprocess.run(["examples/mcptools.sh"], capture_output=True, timeout=15, check=True)
11+
assert proc.returncode == 0
12+
assert b"Ready." in proc.stdout

0 commit comments

Comments
 (0)