Skip to content

Commit 334ee57

Browse files
committed
Initial commit 🔥
0 parents  commit 334ee57

30 files changed

+30146
-0
lines changed

‎.dockerignore‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
venv/
8+
env/
9+
ENV/
10+
11+
# Testing
12+
.pytest_cache/
13+
.coverage
14+
htmlcov/
15+
.tox/
16+
.mypy_cache/
17+
.ruff_cache/
18+
19+
# IDE
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# Git
27+
.git/
28+
.gitignore
29+
30+
# Documentation
31+
*.md
32+
README*
33+
docs/
34+
35+
# Development files
36+
pytest.ini
37+
tests/
38+
39+
# Environment files
40+
.env
41+
.env.*
42+
43+
# Misc
44+
.DS_Store
45+
*.log
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build Docker image
16+
run: docker build -t cortex-mcp .
17+
18+
- name: Test Docker container
19+
run: |
20+
# Basic test that container runs
21+
docker run --rm cortex-mcp python -c "print('Container OK')"
22+
23+
# Test MCP server functionality
24+
chmod +x tests/integration/test_docker.sh
25+
CORTEX_API_TOKEN="test-token" ./tests/integration/test_docker.sh
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Log in to GitHub Container Registry
16+
uses: docker/login-action@v3
17+
with:
18+
registry: ghcr.io
19+
username: ${{ secrets.GH_ACTOR }}
20+
password: ${{ secrets.GH_TOKEN }}
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Build and push Docker image
26+
uses: docker/build-push-action@v5
27+
with:
28+
context: .
29+
push: true
30+
tags: ghcr.io/cortexapps/cortex-mcp:latest
31+
platforms: linux/amd64,linux/arm64
32+
cache-from: type=gha
33+
cache-to: type=gha,mode=max
34+
labels: |
35+
org.opencontainers.image.source=https://github.com/cortexapps/cortex-mcp
36+
org.opencontainers.image.description=MCP server for Cortex API integration
37+
org.opencontainers.image.licenses=Apache-2.0

‎.github/workflows/test.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test Suite
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.13'
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -e ".[dev]"
24+
25+
- name: Run linter
26+
run: |
27+
ruff check src tests
28+
29+
- name: Run tests
30+
run: |
31+
pytest

‎.gitignore‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
24+
# Virtual Environment
25+
venv/
26+
env/
27+
ENV/
28+
.venv
29+
30+
# IDE
31+
.vscode/
32+
.idea/
33+
*.swp
34+
*.swo
35+
*~
36+
37+
# Testing
38+
.pytest_cache/
39+
.coverage
40+
htmlcov/
41+
.tox/
42+
.mypy_cache/
43+
.ruff_cache/
44+
45+
# Environment variables
46+
.env
47+
.env.*
48+
49+
# OS
50+
.DS_Store
51+
Thumbs.db
52+
53+
# Logs
54+
*.log
55+
56+
# Local settings
57+
.claude/
58+
**/settings.local.json
59+
60+
# DXT build artifacts
61+
*.dxt

‎Dockerfile‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM python:3.13-alpine AS builder
2+
3+
RUN apk add --no-cache \
4+
gcc \
5+
musl-dev \
6+
libffi-dev \
7+
git
8+
9+
WORKDIR /build
10+
11+
COPY pyproject.toml .
12+
13+
RUN pip install --upgrade pip && \
14+
pip wheel --no-cache-dir --wheel-dir /wheels .
15+
16+
FROM python:3.13-alpine
17+
18+
ENV PYTHONUNBUFFERED=1 \
19+
PIP_NO_CACHE_DIR=1 \
20+
# Use stdio transport for Docker as the default. Revisit after streamable-http
21+
MCP_TRANSPORT=stdio \
22+
LOG_LEVEL=INFO \
23+
OPENAPI_SPEC_PATH=/app/openapi.json
24+
25+
WORKDIR /app
26+
27+
RUN apk add --no-cache git
28+
29+
# Copy wheels from builder and install
30+
COPY --from=builder /wheels /wheels
31+
RUN pip install --no-cache-dir /wheels/*.whl && \
32+
rm -rf /wheels
33+
34+
COPY src/ ./src/
35+
COPY server.py .
36+
COPY swagger.json /app/openapi.json
37+
38+
RUN adduser -D -u 1000 appuser && \
39+
chown -R appuser:appuser /app
40+
41+
USER appuser
42+
43+
ENTRYPOINT ["python", "server.py"]

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Cortex
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
## Cortex MCP Overview
2+
3+
>[!NOTE]
4+
>**Research Preview**
5+
>
6+
>Not seeing the results you expect? This is an early version of the Cortex MCP. Please send feedback and bug reports to Cortex Customer Engineering.
7+
8+
Cortex MCP is a Model Context Protocol server that provides access to the Cortex API. It uses relevant context from your workspace, ensuring awareness of your system's structure when answering your questions.
9+
10+
You can query information in natural language, powering faster decisions and efficient processes. For example:
11+
12+
- Who is the right person to handle an incident with backend-server?
13+
- Show me the services that belong to the platform engineering team
14+
- We're having an incident with backend-server, give me a summary of information to help handle the incident
15+
16+
## Requirements
17+
18+
Before getting started, you'll need:
19+
20+
- **MCP Client**: Claude Desktop or other MCP-compatible client
21+
- **Cortex Personal Access Token**: [Create a token](https://docs.cortex.io/settings/api-keys/personal-tokens) in your Cortex workspace settings.
22+
23+
## Installation
24+
25+
Then configure your MCP client. We've tested this with Claude Desktop, and Cursor, but it should work with any MCP-compatible client.:
26+
27+
### Claude Desktop
28+
29+
```json
30+
{
31+
"mcpServers": {
32+
"cortex": {
33+
"command": "docker",
34+
"args": [
35+
"run",
36+
"--rm",
37+
"-i",
38+
"--env",
39+
"CORTEX_API_TOKEN=YOUR_API_TOKEN_HERE",
40+
"ghcr.io/cortexapps/cortex-mcp:latest"
41+
]
42+
}
43+
}
44+
}
45+
```
46+
47+
48+
### Cursor
49+
50+
```json
51+
{
52+
"mcpServers": {
53+
"cortex": {
54+
"command": "docker",
55+
"args": [
56+
"run",
57+
"--rm",
58+
"-i",
59+
"--env",
60+
"CORTEX_API_TOKEN=YOUR_API_TOKEN_HERE",
61+
"ghcr.io/cortexapps/cortex-mcp:latest"
62+
]
63+
}
64+
}
65+
}
66+
67+
```
68+
69+
### VSCode
70+
71+
[VS Code MCP Servers Documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
72+
73+
Sample `.vscode/mcp.json`
74+
75+
```json
76+
{
77+
"inputs": [
78+
{
79+
"type": "promptString",
80+
"id": "cortex-key",
81+
"description": "Cortex API Key",
82+
"password": true
83+
}
84+
],
85+
"servers": {
86+
"Cortex": {
87+
"type": "stdio",
88+
"command": "docker",
89+
"args": [
90+
"run",
91+
"--rm",
92+
"-i",
93+
"ghcr.io/cortexapps/cortex-mcp:latest"
94+
],
95+
"env": {
96+
"CORTEX_API_TOKEN": "${input:cortex-key}"
97+
}
98+
}
99+
}
100+
}
101+
102+
```
103+
104+
105+
## Support
106+
107+
- GitHub Issues: https://github.com/cortexapps/cortex-mcp/issues
108+
109+
110+
## License
111+
112+
MIT License - see [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)