Skip to content

Commit 11d4821

Browse files
authored
mcp_server_tls v0.1.2 (#208)
1 parent 6521b24 commit 11d4821

26 files changed

Lines changed: 1139 additions & 397 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.build.sh
2+
.devcontainer/
3+
.env
4+
.git/
5+
.venv/
6+
.vscode/
7+
__pycache__/
8+
*.DS_Store
9+
*.pyc
10+
Dockerfile

server/mcp_server_tls/.env_example

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# volcengine
2-
3-
# or VOLC_ACCESSKEY
4-
AK=your_ak
5-
# or VOLC_SECRETKEY
6-
SK=your_sk
7-
REGION=your_region
8-
ENDPOINT=your_endpoint
9-
TOKEN=
10-
ACCOUNT_ID=
2+
VOLCENGINE_ACCESS_KEY=
3+
VOLCENGINE_SECRET_KEY=
4+
VOLCENGINE_REGION=
5+
VOLCENGINE_ENDPOINT=
6+
VOLCENGINE_TOKEN=
7+
VOLCENGINE_ACCOUNT_ID=
118

129
# tls
13-
PROJECT_ID=
14-
TOPIC_ID=
10+
TLS_PROJECT_ID=
11+
TLS_TOPIC_ID=
1512

1613
# mcp
17-
# DEPLOY_MODE controls deployment mode, default is local
18-
# DEPLOY_MODE=local
19-
# ENABLED_TOOLS can be customized to select which tools to turn on, default is all
20-
# ENABLED_TOOLS=all
14+
MCP_SERVER_PORT=8000
15+
# MCP_DEPLOY_MODE controls deployment mode, default is local
16+
# MCP_DEPLOY_MODE=local
17+
# MCP_ENABLED_TOOLS can be customized to select which tools to turn on, default is all
18+
# MCP_ENABLED_TOOLS=all

server/mcp_server_tls/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ wheels/
1919
.env
2020

2121
build.sh
22-
mcp_server_tls.zip
22+
mcp_server_tls.zip

server/mcp_server_tls/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# dockerfile deployment for remote server
2+
FROM python:3.10.18-bookworm
3+
4+
RUN apt-get update \
5+
&& apt-get install -y --no-install-recommends curl \
6+
&& apt clean \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /mcp_server_tls
10+
11+
ENV PATH="/root/.local/bin:$PATH" \
12+
TRANSPORT_TYPE=streamable-http
13+
14+
COPY . .
15+
16+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
17+
&& uv sync
18+
19+
EXPOSE 8000
20+
21+
ENTRYPOINT ["./entrypoint.sh"]

server/mcp_server_tls/README.md

Lines changed: 111 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,68 @@ Retrieve information for multiple topics under a specified project ID within the
350350

351351
Use the describe_topics_tool to find the shard count for the first 10 topics under the current project.
352352

353+
### Tool 7: put_logs_v2_tool
354+
355+
upload logs to the specified log topic.
356+
357+
- Required input parameters for debugging:
358+
359+
`Input`
360+
361+
```json
362+
{
363+
"inputSchema": {
364+
"type": "object",
365+
"required": ["logs"],
366+
"properties": {
367+
"logs": {
368+
"type": "array",
369+
"description": "logs field for the log field to be written, each item in the array is a log, each item consists of multiple key-value key-value pairs"
370+
},
371+
"log_time": {
372+
"type": "int",
373+
"description": "Log timestamp for writing to the log, default is current time",
374+
},
375+
"topic_id": {
376+
"type": "string",
377+
"description": "Optional log topic ID, default is the topic_id set in the environment variable, if not set, then must be passed."
378+
},
379+
"source": {
380+
"type": "string",
381+
"description": "The source of the logs, usually identified by the machine IP",
382+
},
383+
"filename": {
384+
"type": "string",
385+
"description": "Log file name",
386+
},
387+
"hash_key": {
388+
"type": "string",
389+
"description": "HashKey of the log group to specify the partition (Shard) to which the current log group is to be written",
390+
},
391+
"compression": {
392+
"type": "string",
393+
"description": "The compression format of the request body, default is lz4, optional zlib.",
394+
},
395+
}
396+
},
397+
"name": "put_logs_v2_tool",
398+
"description": "Call the PutLogs interface to upload logs to the specified log topic. If you need to use searchLogs to query the logs, please set up the index first."
399+
}
400+
```
401+
402+
`Output`
403+
- [Reference Documentation](https://www.volcengine.com/docs/6470/112191)
404+
405+
```json
406+
{
407+
"request_id": "your_request_id"
408+
}
409+
```
410+
411+
- Example of the most easily triggered prompt:
412+
413+
Use the put_logs_v2_tool tool to help me write the following logs as [{"user": "peter", "age": 18}, {"user": "marry", "age": 16}]
414+
353415
## Supported Platforms
354416

355417
Can be used with cline, cursor, Claude desktop, or other terminals supporting MCP server calls.
@@ -383,7 +445,7 @@ For server-based deployment, set `DEPLOY_MODE=remote` and only configure `REGION
383445

384446
### Run Locally
385447

386-
#### Option 1
448+
#### 1. Launching via local code
387449

388450
```json
389451
{
@@ -401,7 +463,7 @@ For server-based deployment, set `DEPLOY_MODE=remote` and only configure `REGION
401463
}
402464
```
403465

404-
#### Option 2
466+
#### 2. Launch via remote repository
405467

406468
```json
407469
{
@@ -427,25 +489,67 @@ For server-based deployment, set `DEPLOY_MODE=remote` and only configure `REGION
427489
}
428490
```
429491

430-
### Run Remote
492+
### Remote startup
493+
494+
#### Deploying remote services
495+
496+
##### 1. Local direct startup
431497

432-
Set `DEPLOY_MODE=remote`.
498+
Set `DEPLOY_MODE=remote`
433499

434500
```shell
435501
uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER run mcp-server-tls -t sse
436502
```
437503

438-
When used by the caller, authentication information should be base64-encoded and included in the request header as `authorization`:
504+
or
505+
506+
```shell
507+
uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER run mcp-server-tls -t streamable-http
508+
```
509+
510+
> We suggest that using streamable-http
511+
512+
##### 2. Started by DOCKER
513+
514+
We also provide DOCKERFILE to facilitate your deployment, which has not been pushed to the open source repository, so you can manually package it first.
515+
516+
Example of docker compose startup.
517+
518+
```
519+
services:
520+
mcp:
521+
image: your-image:your-version
522+
container_name: mcp_server_tls
523+
restart: always
524+
ports:
525+
- "80:8000"
526+
environment:
527+
MCP_DEPLOY_MODE: remote
528+
TRANSPORT_TYPE: streamable-http
529+
MCP_SERVER_HOST: 0.0.0.0
530+
MCP_SERVER_PORT: 8000
531+
```
532+
533+
#### call
534+
535+
|transport-type| call link example |
536+
| :-: | :-: |
537+
| sse | http://127.0.0.1:8000/sse |
538+
| streamable-http | http://127.0.0.1:8000/mcp/ |
539+
540+
The caller should put the authentication information in the authorization header after encoding it in base64 in the following format
439541

440542
```json
441543
{
442544
"AccessKeyId": "your ak",
443545
"SecretAccessKey": "your sk",
444-
"SessionToken": "your token"
546+
"SessionToken": "your token",
547+
"Region": "your region",
548+
"Endpoint": "your endpoint"
445549
}
446550
```
447551

448-
## Configuration on Different Platforms
552+
`Region` and `Endpoint` is not necessary, default region is `cn-beijing`, endpoint is `https://tls-cn-beijing.volces.com`
449553

450554
## License
451555

0 commit comments

Comments
 (0)