From 04f2b4e3794f7d729c6e408ebd17aac24eb57d5e Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Mon, 9 Jun 2025 01:42:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20sse=20neo4j=20=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-tutorial/examples/go-neo4j-sse.md | 21 ++++++++++++--- .../examples/python-simple-stdio.md | 2 ++ preview/contributors.md | 26 ++++++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/plugin-tutorial/examples/go-neo4j-sse.md b/plugin-tutorial/examples/go-neo4j-sse.md index 5e70ebe..24a11db 100644 --- a/plugin-tutorial/examples/go-neo4j-sse.md +++ b/plugin-tutorial/examples/go-neo4j-sse.md @@ -1,5 +1,7 @@ # go 实现 neo4j 的只读 mcp 服务器 (SSE) +[本期教程视频](https://www.bilibili.com/video/BV1g8TozyEE7/) + ## 前言 本篇教程,演示一下如何使用 go 语言写一个可以访问 neo4j 数据库的 mcp 服务器。实现完成后,我们不需要写任何 查询代码 就能通过询问大模型了解服务器近况。 @@ -150,7 +152,6 @@ package main import ( "fmt" - "github.com/neo4j/neo4j-go-driver/v5/neo4j" "neo4j-go-server/util" ) @@ -222,7 +223,14 @@ func main() { // 将真实函数和申明的 schema 绑定 s.AddTool(executeReadOnlyCypherQuery, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - cypher := request.Params.Arguments["cypher"].(string) + args, ok := request.Params.Arguments.(map[string]interface{}) + if !ok { + return mcp.NewToolResultText(""), fmt.Errorf("invalid arguments type") + } + cypher, ok := args["cypher"].(string) + if !ok { + return mcp.NewToolResultText(""), fmt.Errorf("cypher argument is not a string") + } result, err := util.ExecuteReadOnlyCypherQuery(cypher) fmt.Println(result) @@ -438,7 +446,14 @@ func GetNodeFields(nodeType string) ([]string, error) { }) s.AddTool(getNodeField, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - nodeLabel := request.Params.Arguments["nodeLabel"].(string) + args, ok := request.Params.Arguments.(map[string]interface{}) + if !ok { + return mcp.NewToolResultText(""), fmt.Errorf("invalid arguments type") + } + nodeLabel, ok := args["nodeLabel"].(string) + if !ok { + return mcp.NewToolResultText(""), fmt.Errorf("nodeLabel argument is not a string") + } result, err := util.GetNodeFields(nodeLabel) fmt.Println(result) diff --git a/plugin-tutorial/examples/python-simple-stdio.md b/plugin-tutorial/examples/python-simple-stdio.md index ec11cc4..02ddf47 100644 --- a/plugin-tutorial/examples/python-simple-stdio.md +++ b/plugin-tutorial/examples/python-simple-stdio.md @@ -1,5 +1,7 @@ # python 实现天气信息 mcp 服务器 +[本期教程视频](https://www.bilibili.com/video/BV1zYGozgEHc) + ## hook 等等,开始前,先让我们看一个小例子,假设我下周要去明日方舟锈影新生的漫展,所以我想要知道周六杭州的天气,于是我问大模型周六的天气,结果大模型给了我如下的回复: diff --git a/preview/contributors.md b/preview/contributors.md index 5689839..d8a72c6 100644 --- a/preview/contributors.md +++ b/preview/contributors.md @@ -34,7 +34,7 @@ const contributors = [ { icon: 'github', link: 'https://github.com/appli456' }, ] }, - { + { avatar: 'https://avatars.githubusercontent.com/u/115577936?v=4', name: 'AmeSoraQwQ (AmeZora)', title: 'Creator & Operation', @@ -43,6 +43,30 @@ const contributors = [ { icon: 'github', link: 'https://github.com/ArcStellar2025' }, ] }, + { + avatar: 'https://avatars.githubusercontent.com/u/129645384?v=4', + name: 'SFXJX (社奉行佳婿)', + title: 'Developer', + links: [ + { icon: 'github', link: 'https://github.com/STUzhy' }, + ] + }, + { + avatar: 'https://avatars.githubusercontent.com/u/37235140?v=4', + name: 'hao (cybermanhao)', + title: 'Developer', + links: [ + { icon: 'github', link: 'https://github.com/cybermanhao' }, + ] + }, + { + avatar: 'https://avatars.githubusercontent.com/u/213030338?v=4', + name: 'reliedejuedouzhe2', + title: 'Developer', + links: [ + { icon: 'github', link: 'https://github.com/reliedejuedouzhe2' }, + ] + } ]