Skip to content

Commit 60423e1

Browse files
committed
chore(cursor): harden MCP SSE config, tighten settings, and improve CI gates
1 parent 6b4c211 commit 60423e1

5 files changed

Lines changed: 145 additions & 7 deletions

File tree

.cursor/environment.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"commands": {
3-
"dev:mcp": "uvicorn mcp-server.server:app --reload --host 127.0.0.1 --port 8000",
3+
"dev:mcp": "uvicorn mcp_server.server:app --reload --host 127.0.0.1 --port 8765",
4+
"health": "curl -fsS http://127.0.0.1:8765/healthz || curl -fsS http://127.0.0.1:8765/ | head -n 1",
45
"test": "pytest -q",
56
"test:security": "pytest lab/security/tests/ -v",
67
"test:integration": "pytest lab/tests/ -v",
@@ -11,11 +12,11 @@
1112
"lint": "ruff check .",
1213
"format": "ruff format . && black .",
1314
"format:check": "ruff format --check . && black --check .",
14-
"docs:check": "find docs/ -name '*.md' -exec grep -L '<!-- Version:' {} \\;",
15-
"health": "curl -s http://127.0.0.1:8000/health | jq ."
15+
"docs:check": "find docs/ -name '*.md' -exec grep -L '<!-- Version:' {} \\;"
1616
},
1717
"environment": {
1818
"PYTHONPATH": ".",
19-
"LOG_LEVEL": "INFO"
19+
"LOG_LEVEL": "INFO",
20+
"GUARDIAN_ALLOW_TOOLS": "health,tools/search_docs,tools/summarize"
2021
}
2122
}

.cursor/mcp.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[
22
{
33
"name": "lab-server",
4-
"url": "http://127.0.0.1:8000",
4+
"url": "http://127.0.0.1:8765/sse",
5+
"method": "sse",
56
"allowTools": [
67
"search_docs",
78
"summarize",
@@ -13,6 +14,7 @@
1314
"audit_by_tool"
1415
],
1516
"timeout": 30,
16-
"retries": 3
17+
"retries": 3,
18+
"gracePeriodSec": 2
1719
}
1820
]

.cursor/settings.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,26 @@
55
"contextWindow": 128000,
66
"includeCodeContext": true,
77
"includeGitContext": true,
8-
"includeTerminalContext": true
8+
"includeTerminalContext": true,
9+
"includePaths": [
10+
"app/",
11+
"lab/",
12+
"mcp_server/",
13+
"docs/",
14+
"tests/",
15+
"evidence/",
16+
".github/workflows/"
17+
],
18+
"excludePaths": [
19+
"node_modules/",
20+
".venv/",
21+
"__pycache__/",
22+
"*.pyc",
23+
"data/",
24+
"logs/",
25+
".coverage",
26+
"coverage.xml",
27+
"evidence/**/artifacts/**"
28+
],
29+
"contextCap": 50000
930
}

.cursorignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Large datasets and temporary files
2+
data/**
3+
*.ipynb_checkpoints/
4+
__pycache__/
5+
*.pyc
6+
*.pyo
7+
*.pyd
8+
.Python
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
25+
# Coverage files
26+
.coverage
27+
coverage.xml
28+
.coverage.*
29+
30+
# Test cache
31+
.pytest_cache/
32+
.mypy_cache/
33+
34+
# Logs
35+
logs/
36+
*.log
37+
38+
# Environment files
39+
.env
40+
.env.local
41+
.env.*.local
42+
43+
# IDE files
44+
.vscode/
45+
.idea/
46+
*.swp
47+
*.swo
48+
49+
# OS files
50+
.DS_Store
51+
Thumbs.db
52+
53+
# Node modules
54+
node_modules/
55+
56+
# Evidence artifacts
57+
evidence/**/artifacts/**
58+
59+
# Git
60+
.git/

.github/workflows/cursor-audit.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Cursor MCP Audit
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.cursor/**'
7+
- '.vscode/**'
8+
- '.cursorignore'
9+
10+
jobs:
11+
audit:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
26+
- name: Run pre-commit
27+
uses: pre-commit/action@v3.0.0
28+
29+
- name: MCP Server Health Check
30+
run: |
31+
uvicorn mcp_server.server:app --host 127.0.0.1 --port 8765 --log-level info &
32+
SERVER_PID=$!
33+
sleep 5
34+
curl -fsS http://127.0.0.1:8765/healthz || curl -fS http://127.0.0.1:8765/ >/dev/null
35+
kill $SERVER_PID
36+
timeout-minutes: 2
37+
38+
- name: Validate Cursor Configs (JSON)
39+
run: |
40+
sudo apt-get update && sudo apt-get install -y jq
41+
jq empty .cursor/mcp.json
42+
jq empty .cursor/settings.json
43+
jq empty .cursor/environment.json
44+
jq empty .vscode/settings.json
45+
46+
- name: Check PR Size (≤300 changed LOC)
47+
run: |
48+
MERGE_BASE=$(git merge-base origin/${{ github.base_ref }} HEAD)
49+
CHANGED_LINES=$(git diff --numstat "$MERGE_BASE"...HEAD | awk '{add+=$1; del+=$2} END {print add+del}')
50+
echo "Changed LOC: $CHANGED_LINES"
51+
if [ "${CHANGED_LINES:-0}" -gt 300 ]; then
52+
echo "PR size exceeds 300 LOC limit: $CHANGED_LINES"
53+
exit 1
54+
fi

0 commit comments

Comments
 (0)