Skip to content

Commit 68f4773

Browse files
authored
Merge branch 'main' into freeznet/refine-features-doc
2 parents 8a86bf2 + 25e8020 commit 68f4773

14 files changed

+259
-212
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ If you want to access to your StreamNative Cloud, you will need to have followin
5858

5959
```bash
6060
# Start MCP server with StreamNative Cloud authentication
61-
snmcp stdio --organization my-org --key-file /path/to/key-file.json
61+
bin/snmcp stdio --organization my-org --key-file /path/to/key-file.json
6262

6363
# Start MCP server with external Kafka
6464
bin/snmcp stdio --use-external-kafka --kafka-bootstrap-servers localhost:9092 --kafka-auth-type SASL_SSL --kafka-auth-mechanism PLAIN --kafka-auth-user user --kafka-auth-pass pass --kafka-use-tls --kafka-schema-registry-url https://sr.local --kafka-schema-registry-auth-user user --kafka-schema-registry-auth-pass pass
@@ -186,7 +186,8 @@ The StreamNative MCP Server allows you to enable or disable specific groups of f
186186

187187
You can combine these features as needed using the `--features` flag. For example, to enable only Pulsar client features:
188188
```bash
189-
snmcp stdio --organization my-org --key-file /path/to/key-file.json --features pulsar-client
189+
# Enable only Pulsar client features
190+
bin/snmcp stdio --organization my-org --key-file /path/to/key-file.json --features pulsar-client
190191
```
191192

192193
## Integration with MCP Clients
@@ -197,25 +198,31 @@ This server can be used with any MCP-compatible client, such as:
197198
- Other AI assistants supporting the MCP protocol
198199
- Custom applications built with MCP client libraries
199200

201+
> ⚠️ Reminder: Please ensure you have an active paid plan with your LLM provider to fully utilize the MCP server.
202+
Without it, you may encounter the error: `message will exceed the length limit for this chat`.
203+
204+
200205
### Usage with Claude Desktop
201206

202207
```json
203208
{
204209
"mcpServers": {
205-
"github": {
206-
"command": "snmcp",
210+
"snmcp": {
211+
"command": "${PATH_TO_SNMCP}/bin/snmcp",
207212
"args": [
208213
"stdio",
209214
"--organization",
210-
"my-org",
215+
"${STREAMNATIVE_CLOUD_ORGANIZATION_ID}",
211216
"--key-file",
212-
"/path/to/key-file.json"
213-
],
217+
"${STREAMNATIVE_CLOUD_KEY_FILE}"
218+
]
214219
}
215220
}
216221
}
217222
```
218223

224+
Please remember to replace `${PATH_TO_SNMCP}` with the actual path to the `snmcp` binary and `${STREAMNATIVE_CLOUD_ORGANIZATION_ID}` and `${STREAMNATIVE_CLOUD_KEY_FILE}` with your StreamNative Cloud organization ID and key file path, respectively.
225+
219226
## About Model Context Protocol (MCP)
220227

221228
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs. MCP helps build agents and complex workflows on top of LLMs by providing:

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/99designs/keyring v1.2.2
77
github.com/apache/pulsar-client-go v0.13.1
88
github.com/dgrijalva/jwt-go v3.2.0+incompatible
9+
github.com/hamba/avro/v2 v2.28.0
910
github.com/mark3labs/mcp-go v0.26.0
1011
github.com/mitchellh/go-homedir v1.1.0
1112
github.com/pkg/errors v0.9.1
@@ -43,7 +44,6 @@ require (
4344
github.com/golang/protobuf v1.5.4 // indirect
4445
github.com/google/uuid v1.6.0 // indirect
4546
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
46-
github.com/hamba/avro/v2 v2.26.0 // indirect
4747
github.com/hashicorp/errwrap v1.1.0 // indirect
4848
github.com/hashicorp/go-multierror v1.1.1 // indirect
4949
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -75,10 +75,11 @@ require (
7575
github.com/twmb/franz-go/pkg/kmsg v1.9.0 // indirect
7676
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
7777
go.uber.org/atomic v1.11.0 // indirect
78-
golang.org/x/crypto v0.32.0 // indirect
79-
golang.org/x/mod v0.20.0 // indirect
80-
golang.org/x/sys v0.29.0 // indirect
81-
golang.org/x/term v0.28.0 // indirect
78+
golang.org/x/crypto v0.36.0 // indirect
79+
golang.org/x/mod v0.23.0 // indirect
80+
golang.org/x/net v0.38.0 // indirect
81+
golang.org/x/sys v0.31.0 // indirect
82+
golang.org/x/term v0.30.0 // indirect
8283
google.golang.org/protobuf v1.35.1 // indirect
8384
)
8485

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
9898
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
9999
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
100100
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
101-
github.com/hamba/avro/v2 v2.26.0 h1:IaT5l6W3zh7K67sMrT2+RreJyDTllBGVJm4+Hedk9qE=
102-
github.com/hamba/avro/v2 v2.26.0/go.mod h1:I8glyswHnpED3Nlx2ZdUe+4LJnCOOyiCzLMno9i/Uu0=
101+
github.com/hamba/avro/v2 v2.28.0 h1:E8J5D27biyAulWKNiEBhV85QPc9xRMCUCGJewS0KYCE=
102+
github.com/hamba/avro/v2 v2.28.0/go.mod h1:9TVrlt1cG1kkTUtm9u2eO5Qb7rZXlYzoKqPt8TSH+TA=
103103
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
104104
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
105105
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -251,16 +251,16 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
251251
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
252252
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
253253
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
254-
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
255-
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
256-
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
257-
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
254+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
255+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
256+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
257+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
258258
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
259259
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
260260
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
261261
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
262-
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
263-
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
262+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
263+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
264264
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
265265
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
266266
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -272,16 +272,16 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
272272
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
273273
golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
274274
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
275-
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
276-
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
275+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
276+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
277277
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
278-
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
279-
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
278+
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
279+
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
280280
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
281281
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
282282
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
283-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
284-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
283+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
284+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
285285
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
286286
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
287287
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

go.work.sum

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,18 @@ go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kT
136136
go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A=
137137
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
138138
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
139-
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
140-
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
141139
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
142140
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
143141
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
144142
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=
145143
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
146-
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
147144
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
148145
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
149146
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
147+
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
148+
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
150149
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw=
151-
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
152-
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
153-
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
154-
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
155150
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
156-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
157-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
158151
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
159152
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
160153
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -163,6 +156,8 @@ golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
163156
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k=
164157
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
165158
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
159+
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
160+
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
166161
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
167162
google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=
168163
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=

pkg/cmd/mcp/stdio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func newStdioServer(configOpts *ServerOptions, logrusLogger *logrus.Logger) *ser
138138
"streamnative-mcp-server",
139139
"0.0.1",
140140
server.WithResourceCapabilities(true, true),
141-
server.WithInstructions(mcp.GetStreamNativeCloudServerInstructions(userName)),
141+
server.WithInstructions(mcp.GetStreamNativeCloudServerInstructions(userName, snConfig)),
142142
server.WithLogging())
143143

144144
mcp.RegisterPrompts(s)

pkg/mcp/instructions.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,22 @@ package mcp
1919

2020
import (
2121
"fmt"
22+
23+
"github.com/streamnative/streamnative-mcp-server/pkg/config"
2224
)
2325

24-
func GetStreamNativeCloudServerInstructions(userName string) string {
26+
func GetStreamNativeCloudServerInstructions(userName string, snConfig *config.SnConfig) string {
27+
contextInformation := ""
28+
if snConfig.Context.PulsarCluster != "" && snConfig.Context.PulsarInstance != "" {
29+
contextInformation = fmt.Sprintf(`
30+
You are currently logged in to StreamNative Cloud with the following context:
31+
- Pulsar Cluster: %s
32+
- Pulsar Instance: %s
33+
`, snConfig.Context.PulsarCluster, snConfig.Context.PulsarInstance)
34+
} else {
35+
contextInformation = `No context is set, use 'sncloud_context_available_clusters' to list the available clusters and 'sncloud_context_use_cluster' to set the context to a specific cluster.
36+
`
37+
}
2538
return fmt.Sprintf(`StreamNative Cloud MCP Server provides resources and tools for AI agents to interact with StreamNative Cloud resources and services.
2639
2740
### StreamNative Cloud API Server Resources
@@ -55,13 +68,14 @@ func GetStreamNativeCloudServerInstructions(userName string) string {
5568
7. **Data Streaming Engine**
5669
- **Concept**: The Data Streaming Engine is the core technology that runs StreamNative Cloud clusters. There are two options: Classic Engine and Ursa Engine.
5770
- **Classic Engine**: The default engine, based on ZooKeeper and BookKeeper, offering low-latency storage suitable for latency-sensitive workloads. It supports Pulsar, Kafka, and MQTT protocols. For Classic Engine, Pulsar protocol will be the default protocol.
58-
- **Ursa Engine**: A next-generation engine based on Oxia and object storage (like S3), providing cost-optimized storage for latency-relaxed scenarios. It currently focuses on Kafka protocol support. For Ursa Engine, you can only uses 'kafka-client-*' or 'kafka-admin-*' tools, do not use 'pulsar-client-*' or 'pulsar-admin-*' tools.
71+
- **Ursa Engine**: A next-generation engine based on Oxia and object storage (like S3), providing cost-optimized storage for latency-relaxed scenarios. It currently focuses on Kafka protocol support. For Ursa Engine, you can only uses 'kafka-client-*' or 'kafka-admin-*' tools, do not use 'pulsar-client-*' or 'pulsar-admin-*' tools on Ursa Engine clusters.
5972
- **Relationship**: The Data Streaming Engine is associated with an instance, determining how clusters within that instance operate and what features they support.
6073
6174
### Protocol-Specific Tools
6275
- When working with **Pulsar protocol resources**, you should only use 'pulsar-admin-*' or 'pulsar-client-*' tools. Do not use 'kafka-client-*' or 'kafka-admin-*' tools for Pulsar protocol operations.
6376
- When working with **Kafka protocol resources**, you should only use 'kafka-client-*' or 'kafka-admin-*' tools. Do not use 'pulsar-admin-*' or 'pulsar-client-*' tools for Kafka protocol operations.
6477
- Using the appropriate protocol-specific tools ensures correct functionality and prevents errors when interacting with different protocol resources.
78+
- Avoid mixing different protocol tools: When working with a specific protocol (Pulsar or Kafka), consistently use only the tools designated for that protocol throughout your entire workflow. Mixing different protocol tools in the same operation sequence may lead to inconsistent behavior, data format incompatibilities, or authentication issues. Always maintain protocol consistency for reliable and predictable results.
6579
6680
### Hierarchical Relationship Summary of Resources
6781
- **Organization** is the top level, containing all other resources.
@@ -71,7 +85,7 @@ func GetStreamNativeCloudServerInstructions(userName string) string {
7185
- **Secrets** belong to an organization and can be shared across instances for securely storing sensitive data.
7286
- **Data Streaming Engine** is associated with an instance, defining the technical architecture and feature support for clusters.
7387
74-
Logged in as %s.`, userName)
88+
Logged in as %s. %s`, userName, contextInformation)
7589
}
7690

7791
func GetExternalKafkaServerInstructions(bootstrapServers string) string {

pkg/mcp/kafka_admin_groups_tools.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func KafkaAdminAddGroupsTools(s *server.MCPServer, readOnly bool, features []str
109109
mcp.Description("The name of the Kafka topic to operate on. "+
110110
"Required for the 'delete' operation. "+
111111
"Must be an existing topic name in the Kafka cluster.")),
112-
mcp.WithString("partition",
112+
mcp.WithNumber("partition",
113113
mcp.Description("The partition number to set offset for. "+
114114
"Required for the 'set-offset' operation. "+
115115
"Must be a valid partition number for the specified topic.")),
@@ -191,7 +191,17 @@ func handleKafkaGroupDescribe(ctx context.Context, admin *kadm.Client, request m
191191
return mcp.NewToolResultError(fmt.Sprintf("Failed to describe group: %v", err)), nil
192192
}
193193

194-
jsonBytes, err := json.Marshal(response)
194+
lags, err := admin.Lag(ctx, groupName)
195+
if err != nil {
196+
return mcp.NewToolResultError(fmt.Sprintf("Failed to get lag: %v", err)), nil
197+
}
198+
199+
result := map[string]interface{}{
200+
"group": response,
201+
"lag": lags,
202+
}
203+
204+
jsonBytes, err := json.Marshal(result)
195205
if err != nil {
196206
return mcp.NewToolResultError(fmt.Sprintf("Failed to marshal response: %v", err)), nil
197207
}

0 commit comments

Comments
 (0)