Skip to content

Commit bb0b118

Browse files
committed
feat: init slmcp
1 parent d4f31ef commit bb0b118

17 files changed

+348
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
*.tar.gz
66
build.sh
77
compose.yml
8+
__pycache__

slmcp/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

slmcp/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM ghcr.io/astral-sh/uv:python3.13-alpine
2+
3+
COPY requirements.txt /app/requirements.txt
4+
5+
WORKDIR /app
6+
7+
RUN uv pip sync requirements.txt --system -i https://pypi.tuna.tsinghua.edu.cn/simple
8+
9+
COPY . /app
10+
11+
CMD ["python", "__main__.py"]

slmcp/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .config import Config
2+
3+
GLOBAL_CONFIG = Config.from_env()

slmcp/__main__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from server import main
2+
3+
if __name__ == "__main__":
4+
main()

slmcp/config/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .config import Config
2+
3+
GLOBAL_CONFIG = Config.from_env()

slmcp/config/config.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
3+
class Config:
4+
SAFELINE_ADDRESS: str
5+
SAFELINE_API_TOKEN: str
6+
SECRET: str
7+
LISTEN_PORT: int
8+
LISTEN_ADDRESS: str
9+
10+
def __init__(self):
11+
self.SAFELINE_ADDRESS = os.getenv("SAFELINE_ADDRESS")
12+
self.SAFELINE_API_TOKEN = os.getenv("SAFELINE_API_TOKEN")
13+
self.SECRET = os.getenv("SAFELINE_SECRET")
14+
env_listen_port = os.getenv("LISTEN_PORT")
15+
if env_listen_port and env_listen_port.isdigit():
16+
self.LISTEN_PORT = int(env_listen_port)
17+
else:
18+
self.LISTEN_PORT = 5678
19+
env_listen_address = os.getenv("LISTEN_ADDRESS")
20+
if env_listen_address:
21+
self.LISTEN_ADDRESS = env_listen_address
22+
else:
23+
self.LISTEN_ADDRESS = "0.0.0.0"
24+
25+
@staticmethod
26+
def from_env():
27+
return Config()

slmcp/docker-compose.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
slmcp:
3+
image: slmcp:0.1
4+
container_name: slmcp
5+
ports:
6+
- "5678:5678"
7+
environment:
8+
- SAFELINE_SECRET=your_secret_key
9+
- SAFELINE_ADDRESS=https://your_safeline_ip:9443
10+
- SAFELINE_API_TOKEN=your_safeline_api_token
11+
- LISTEN_PORT=5678
12+
- LISTEN_ADDRESS=0.0.0.0

slmcp/pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "slmcp"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"mcp[cli]>=1.6.0",
9+
]

slmcp/requirements.txt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile pyproject.toml -o requirements.txt
3+
annotated-types==0.7.0
4+
# via pydantic
5+
anyio==4.9.0
6+
# via
7+
# httpx
8+
# mcp
9+
# sse-starlette
10+
# starlette
11+
certifi==2025.1.31
12+
# via
13+
# httpcore
14+
# httpx
15+
click==8.1.8
16+
# via
17+
# typer
18+
# uvicorn
19+
h11==0.14.0
20+
# via
21+
# httpcore
22+
# uvicorn
23+
httpcore==1.0.7
24+
# via httpx
25+
httpx==0.28.1
26+
# via mcp
27+
httpx-sse==0.4.0
28+
# via mcp
29+
idna==3.10
30+
# via
31+
# anyio
32+
# httpx
33+
markdown-it-py==3.0.0
34+
# via rich
35+
mcp==1.6.0
36+
# via slmcp (pyproject.toml)
37+
mdurl==0.1.2
38+
# via markdown-it-py
39+
pydantic==2.11.1
40+
# via
41+
# mcp
42+
# pydantic-settings
43+
pydantic-core==2.33.0
44+
# via pydantic
45+
pydantic-settings==2.8.1
46+
# via mcp
47+
pygments==2.19.1
48+
# via rich
49+
python-dotenv==1.1.0
50+
# via
51+
# mcp
52+
# pydantic-settings
53+
rich==14.0.0
54+
# via typer
55+
shellingham==1.5.4
56+
# via typer
57+
sniffio==1.3.1
58+
# via anyio
59+
sse-starlette==2.2.1
60+
# via mcp
61+
starlette==0.46.1
62+
# via
63+
# mcp
64+
# sse-starlette
65+
typer==0.15.2
66+
# via mcp
67+
typing-extensions==4.13.0
68+
# via
69+
# pydantic
70+
# pydantic-core
71+
# typer
72+
# typing-inspection
73+
typing-inspection==0.4.0
74+
# via pydantic
75+
uvicorn==0.34.0
76+
# via mcp

0 commit comments

Comments
 (0)