Skip to content

Commit c74e16f

Browse files
authored
Merge pull request #39 from tishun/topic/tishu/issue-37-2
Step 2 of publishing to PyPI
2 parents 3e3717e + e08b823 commit c74e16f

24 files changed

+4202
-52
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*
22
!src
33
!uv.lock
4-
!pyproject.toml
4+
!pyproject.toml
5+
!README.md

.github/workflows/ci.yml

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ jobs:
3636
run: |
3737
uv python install 3.12
3838
uv sync --all-extras --dev
39-
uv add --dev ruff isort mypy
39+
uv add --dev ruff mypy
4040
4141
- name: ⚙️ Run linters and formatters
4242
run: |
4343
uv run ruff check src/ tests/
4444
uv run ruff format --check src/ tests/
45-
uv run isort --check-only src/ tests/
46-
uv run mypy src/ --ignore-missing-imports
45+
# uv run mypy src/ --ignore-missing-imports
4746

4847

4948
security-scan:
@@ -66,14 +65,12 @@ jobs:
6665
run: |
6766
uv python install 3.12
6867
uv sync --all-extras --dev
69-
uv add --dev bandit safety
68+
uv add --dev bandit
7069
7170
- name: ⚙️ Run security scan with bandit
7271
run: |
7372
uv run bandit -r src/ -f json -o bandit-report.json || true
7473
uv run bandit -r src/
75-
uv run safety check --output json > safety-report.json || true
76-
uv run safety check
7774
7875
- name: ⚙️ Upload security reports
7976
uses: actions/upload-artifact@v4
@@ -82,16 +79,14 @@ jobs:
8279
name: security-reports
8380
path: |
8481
bandit-report.json
85-
safety-report.json
8682
retention-days: 30
8783

8884

89-
test:
90-
runs-on: ${{ matrix.os }}
85+
test-ubuntu:
86+
runs-on: ubuntu-latest
9187
strategy:
9288
fail-fast: false
9389
matrix:
94-
os: [ubuntu-latest, windows-latest, macos-latest]
9590
python-version: ["3.10", "3.11", "3.12", "3.13"]
9691

9792
services:
@@ -110,7 +105,6 @@ jobs:
110105
uses: step-security/harden-runner@v2
111106
with:
112107
egress-policy: audit
113-
if: matrix.os == 'ubuntu-latest'
114108

115109
- name: ⚙️ Checkout the project
116110
uses: actions/checkout@v4
@@ -139,7 +133,53 @@ jobs:
139133
env:
140134
REDIS_HOST: localhost
141135
REDIS_PORT: 6379
142-
if: matrix.os != 'windows-latest'
136+
137+
- name: ⚙️ Upload coverage reports
138+
uses: codecov/codecov-action@v4
139+
if: matrix.python-version == '3.12'
140+
with:
141+
file: ./coverage.xml
142+
flags: unittests
143+
name: codecov-umbrella
144+
145+
test-other-os:
146+
runs-on: ${{ matrix.os }}
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
os: [windows-latest, macos-latest]
151+
python-version: ["3.10", "3.11", "3.12", "3.13"]
152+
153+
steps:
154+
- name: ⚙️ Checkout the project
155+
uses: actions/checkout@v4
156+
157+
- name: ⚙️ Install uv
158+
uses: astral-sh/setup-uv@v4
159+
with:
160+
version: "latest"
161+
162+
- name: ⚙️ Set Python ${{ matrix.python-version }} up and add dependencies
163+
run: |
164+
uv python install ${{ matrix.python-version }}
165+
uv sync --all-extras --dev
166+
uv add --dev pytest pytest-cov pytest-asyncio coverage
167+
168+
- name: ⚙️ Run tests (without Redis services)
169+
run: |
170+
uv run pytest tests/ -v
171+
env:
172+
REDIS_HOST: localhost
173+
REDIS_PORT: 6379
174+
175+
- name: ⚙️ Test MCP server startup (macOS)
176+
run: |
177+
brew install coreutils
178+
gtimeout 10s uv run python src/main.py || test $? = 124
179+
env:
180+
REDIS_HOST: localhost
181+
REDIS_PORT: 6379
182+
if: matrix.os == 'macos-latest'
143183

144184
- name: ⚙️ Test MCP server startup (Windows)
145185
run: |
@@ -149,18 +189,10 @@ jobs:
149189
REDIS_PORT: 6379
150190
if: matrix.os == 'windows-latest'
151191

152-
- name: ⚙️ Upload coverage reports
153-
uses: codecov/codecov-action@v4
154-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
155-
with:
156-
file: ./coverage.xml
157-
flags: unittests
158-
name: codecov-umbrella
159-
160192

161193
build-test:
162194
runs-on: ubuntu-latest
163-
needs: [lint-and-format, security-scan, test]
195+
needs: [lint-and-format, security-scan, test-ubuntu, test-other-os]
164196
steps:
165197
- name: ⚙️ Harden Runner
166198
uses: step-security/harden-runner@v2

.github/workflows/release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ jobs:
5555
run: |
5656
uv python install 3.12
5757
uv sync --all-extras --dev
58-
uv add --dev bandit safety
58+
uv add --dev bandit
5959
6060
- name: ⚙️ Run security scan with bandit
6161
run: |
6262
uv run bandit -r src/
63-
uv run safety check
6463
6564
test:
6665
runs-on: ubuntu-latest

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Redis MCP Server
2-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2+
[![Integration](https://github.com/redis/mcp-redis/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/redis/lettuce/actions/workflows/integration.yml)
33
[![Python Version](https://img.shields.io/badge/python-3.13%2B-blue)](https://www.python.org/downloads/)
4+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
45
[![smithery badge](https://smithery.ai/badge/@redis/mcp-redis)](https://smithery.ai/server/@redis/mcp-redis)
56
[![Verified on MseeP](https://mseep.ai/badge.svg)](https://mseep.ai/app/70102150-efe0-4705-9f7d-87980109a279)
7+
[![codecov](https://codecov.io/gh/redis/mcp-redis/branch/master/graph/badge.svg?token=yenl5fzxxr)](https://codecov.io/gh/redis/mcp-redis)
8+
9+
10+
[![Discord](https://img.shields.io/discord/697882427875393627.svg?style=social&logo=discord)](https://discord.gg/redis)
11+
[![Twitch](https://img.shields.io/twitch/status/redisinc?style=social)](https://www.twitch.tv/redisinc)
12+
[![YouTube](https://img.shields.io/youtube/channel/views/UCD78lHSwYqMlyetR0_P4Vig?style=social)](https://www.youtube.com/redisinc)
13+
[![Twitter](https://img.shields.io/twitter/follow/redisinc?style=social)](https://twitter.com/redisinc)
14+
[![Stack Exchange questions](https://img.shields.io/stackexchange/stackoverflow/t/mcp-redis?style=social&logo=stackoverflow&label=Stackoverflow)](https://stackoverflow.com/questions/tagged/mcp-redis)
615

716
## Overview
817
The Redis MCP Server is a **natural language interface** designed for agentic applications to efficiently manage and search data in Redis. It integrates seamlessly with **MCP (Model Content Protocol) clients**, enabling AI-driven workflows to interact with structured and unstructured data in Redis. Using this MCP Server, you can ask questions like:

pyproject.toml

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,32 @@ skips = ["B101", "B601"] # Skip assert_used and shell_injection_process_args if
5252
[tool.bandit.assert_used]
5353
skips = ["*_test.py", "*/test_*.py"]
5454

55-
# Test configuration
55+
56+
57+
[dependency-groups]
58+
dev = [
59+
"bandit[toml]>=1.8.6",
60+
"black>=25.1.0",
61+
"coverage>=7.10.1",
62+
"mypy>=1.17.0",
63+
"pytest>=8.4.1",
64+
"pytest-asyncio>=1.1.0",
65+
"pytest-cov>=6.2.1",
66+
"pytest-mock>=3.12.0",
67+
"ruff>=0.12.5",
68+
"safety>=3.6.0",
69+
"twine>=4.0",
70+
]
71+
72+
test = [
73+
"pytest>=8.4.1",
74+
"pytest-asyncio>=1.1.0",
75+
"pytest-cov>=6.2.1",
76+
"pytest-mock>=3.12.0",
77+
"coverage>=7.10.1",
78+
]
79+
80+
# Testing configuration
5681
[tool.pytest.ini_options]
5782
testpaths = ["tests"]
5883
python_files = ["test_*.py"]
@@ -62,23 +87,45 @@ addopts = [
6287
"--strict-markers",
6388
"--strict-config",
6489
"--verbose",
90+
"--cov=src",
91+
"--cov-report=html",
92+
"--cov-report=term",
93+
"--cov-report=xml",
94+
"--cov-fail-under=80",
6595
]
6696
markers = [
67-
"slow: marks tests as slow",
97+
"unit: marks tests as unit tests",
6898
"integration: marks tests as integration tests",
99+
"slow: marks tests as slow running",
100+
]
101+
asyncio_mode = "auto"
102+
filterwarnings = [
103+
"ignore::DeprecationWarning",
104+
"ignore::PendingDeprecationWarning",
69105
]
70106

71-
[dependency-groups]
72-
dev = [
73-
"bandit[toml]>=1.8.6",
74-
"black>=25.1.0",
75-
"coverage>=7.10.1",
76-
"isort>=6.0.1",
77-
"mypy>=1.17.0",
78-
"pytest>=8.4.1",
79-
"pytest-asyncio>=1.1.0",
80-
"pytest-cov>=6.2.1",
81-
"ruff>=0.12.5",
82-
"safety>=3.6.0",
83-
"twine>=4.0",
107+
[tool.coverage.run]
108+
source = ["src"]
109+
omit = [
110+
"*/tests/*",
111+
"*/test_*.py",
112+
"*/__pycache__/*",
113+
"*/venv/*",
114+
"*/.venv/*",
84115
]
116+
117+
[tool.coverage.report]
118+
exclude_lines = [
119+
"pragma: no cover",
120+
"def __repr__",
121+
"if self.debug:",
122+
"if settings.DEBUG",
123+
"raise AssertionError",
124+
"raise NotImplementedError",
125+
"if 0:",
126+
"if __name__ == .__main__.:",
127+
"class .*\\bProtocol\\):",
128+
"@(abc\\.)?abstractmethod",
129+
]
130+
131+

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.0"

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Tests package for Redis MCP Server

0 commit comments

Comments
 (0)