Skip to content

Commit ffe801e

Browse files
committed
feat: add welcome docs on sse server
1 parent b6cc9e3 commit ffe801e

File tree

2 files changed

+51
-19
lines changed

2 files changed

+51
-19
lines changed

src/asktable_mcp_server/sse_server.py

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,44 @@ async def home(request: Request):
7272
scheme = request.url.scheme
7373
base_url = f"{scheme}://{host}"
7474

75-
markdown_content = f"""# 欢迎访问 AskTable MCP 服务(SSE)!
76-
77-
## 配置示例
78-
79-
在您的 Agent 配置文件中,添加以下配置:
80-
81-
```json
82-
{{
75+
content = f"""
76+
<!DOCTYPE html>
77+
<html>
78+
<head>
79+
<meta charset="utf-8">
80+
<title>AskTable MCP 服务(SSE)</title>
81+
<style>
82+
body {{
83+
max-width: 800px;
84+
margin: 0 auto;
85+
padding: 20px;
86+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
87+
line-height: 1.6;
88+
}}
89+
pre {{
90+
background: #f5f5f5;
91+
padding: 15px;
92+
border-radius: 5px;
93+
overflow-x: auto;
94+
}}
95+
code {{
96+
white-space: pre-wrap;
97+
}}
98+
h1, h2 {{
99+
border-bottom: 1px solid #eee;
100+
padding-bottom: 10px;
101+
}}
102+
ul {{
103+
padding-left: 20px;
104+
}}
105+
</style>
106+
</head>
107+
<body>
108+
<h1>欢迎访问 AskTable MCP 服务(SSE)!</h1>
109+
110+
<h2>配置示例</h2>
111+
<p>在您的 Agent 配置文件中,添加以下配置:</p>
112+
<pre><code>{{
83113
"mcpServers": {{
84114
"asktable": {{
85115
"type": "sse",
@@ -89,16 +119,18 @@ async def home(request: Request):
89119
"sse_read_timeout": 300
90120
}}
91121
}}
92-
}}
93-
```
94-
95-
## 工具
96-
97-
- 使用 AskTable 生成 SQL
98-
- 使用 AskTable 查询数据
99-
- 列出 AskTable 中的所有数据
100-
"""
101-
return HTMLResponse(content=markdown_content)
122+
}}</code></pre>
123+
124+
<h2>工具</h2>
125+
<ul>
126+
<li>使用 AskTable 生成 SQL</li>
127+
<li>使用 AskTable 查询数据</li>
128+
<li>列出 AskTable 中的所有数据</li>
129+
</ul>
130+
</body>
131+
</html>
132+
"""
133+
return HTMLResponse(content=content)
102134

103135
@mcp.tool(name="使用 AskTable 生成 SQL")
104136
async def gen_sql(question: str) -> str:

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.11
1+
0.2.12

0 commit comments

Comments
 (0)