@@ -3,6 +3,10 @@ title: 针对服务端开发人员
33description : 快速开始 - 针对服务端开发人员
44---
55
6+ import { Accordion , Accordions } from ' fumadocs-ui/components/accordion' ;
7+
8+ import { Tab , Tabs } from ' fumadocs-ui/components/tabs' ;
9+
610# 针对服务端开发人员
711
812> 开始构建自己的服务器,以便在Claude中用于Desktop和其他客户端
@@ -39,7 +43,6 @@ MCP服务器可以提供三种主要功能:
3943
4044本教程将主要关注工具。
4145
42- import { Tab , Tabs } from ' fumadocs-ui/components/tabs' ;
4346
4447<Tabs items = { [' Python' , ' Node' , ' Java' ,' Kotlin' ,' C#' ]} >
4548 <Tab title = " Python" >
@@ -62,20 +65,25 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
6265 首先,让我们安装uv并设置我们的Python项目和环境:
6366
6467 <CodeGroup >
68+ <CodeGroupItem title = " bash" >
6569 ``` bash MacOS/Linux
6670 curl -LsSf https://astral.sh/uv/install.sh | sh
6771 ```
72+ </CodeGroupItem >
6873
74+ <CodeGroupItem title = " powershell" >
6975 ``` powershell Windows
7076 powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
7177 ```
78+ </CodeGroupItem >
7279 </CodeGroup >
7380
7481 确保之后重新启动终端,以确保收到uv命令。
7582
7683 现在,让我们创建并设置我们的项目:
7784
7885 <CodeGroup >
86+ <CodeGroupItem title = " bash" >
7987 ``` bash MacOS/Linux
8088 # Create a new directory for our project
8189 uv init weather
@@ -91,7 +99,9 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
9199 # Create our server file
92100 touch weather.py
93101 ```
102+ </CodeGroupItem >
94103
104+ <CodeGroupItem title = " powershell" >
95105 ``` powershell Windows
96106 # Create a new directory for our project
97107 uv init weather
@@ -107,6 +117,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
107117 # Create our server file
108118 new-item weather.py
109119 ```
120+ </CodeGroupItem >
110121 </CodeGroup >
111122
112123 现在,让我们开始构建您的服务器。
@@ -350,6 +361,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
350361 现在,让我们创建并设置我们的项目:
351362
352363 <CodeGroup >
364+ <CodeGroupItem title = " bash" >
353365 ``` bash MacOS/Linux
354366 # Create a new directory for our project
355367 mkdir weather
@@ -366,7 +378,9 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
366378 mkdir src
367379 touch src/index.ts
368380 ```
381+ </CodeGroupItem >
369382
383+ <CodeGroupItem title = " powershell" >
370384 ``` powershell Windows
371385 # Create a new directory for our project
372386 md weather
@@ -383,6 +397,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
383397 md src
384398 new-item src\index.ts
385399 ```
400+ </CodeGroupItem >
386401 </CodeGroup >
387402
388403 Update your package.json to add type: "module" and a build script:
@@ -715,6 +730,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
715730 <Tabs items = { [' MacOS/Linux' , ' Windows' ]} >
716731 <Tab title = " MacOS/Linux" >
717732 <CodeGroup >
733+ <CodeGroupItem title = " json" >
718734 ``` json Node
719735 {
720736 "mcpServers" : {
@@ -727,23 +743,27 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
727743 }
728744 }
729745 ```
746+ </CodeGroupItem >
730747 </CodeGroup >
748+
731749 </Tab >
732750
733751 <Tab title = " Windows" >
734752 <CodeGroup >
753+ <CodeGroupItem title = " json" >
735754 ``` json Node
736755 {
737756 "mcpServers" : {
738- "weather" : {
739- "command" : " node" ,
740- "args" : [
741- " C:\\ PATH\\ TO\\ PARENT\\ FOLDER\\ weather\\ build\\ index.js"
742- ]
743- }
744- }
757+ "weather" : {
758+ "command" : " node" ,
759+ "args" : [
760+ " C:\\ PATH\\ TO\\ PARENT\\ FOLDER\\ weather\\ build\\ index.js"
761+ ]
762+ }
763+ }
745764 }
746765 ```
766+ </CodeGroupItem >
747767 </CodeGroup >
748768 </Tab >
749769 </Tabs >
@@ -809,11 +829,14 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
809829 然后通过设置应用程序属性来配置应用程序:
810830
811831 <CodeGroup >
832+ <CodeGroupItem title = " properties" >
812833 ``` bash application.properties
813834 spring.main.bannerMode =off
814835 logging.pattern.console =
815836 ```
837+ </CodeGroupItem >
816838
839+ <CodeGroupItem title = " yaml" >
817840 ``` yaml application.yml
818841 logging :
819842 pattern :
@@ -822,6 +845,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
822845 main :
823846 banner-mode : off
824847 ` ` `
848+ </CodeGroupItem>
825849 </CodeGroup>
826850
827851 这个 [服务器配置属性](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html#_configuration_properties) 记录所有可用的属性。
@@ -1078,6 +1102,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
10781102 现在,让我们创建并设置您的项目:
10791103
10801104 <CodeGroup >
1105+ <CodeGroupItem title = " bash" >
10811106 ``` bash MacOS/Linux
10821107 # Create a new directory for our project
10831108 mkdir weather
@@ -1086,7 +1111,9 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
10861111 # Initialize a new kotlin project
10871112 gradle init
10881113 ```
1114+ </CodeGroupItem >
10891115
1116+ <CodeGroupItem title = " powershell" >
10901117 ``` powershell Windows
10911118 # Create a new directory for our project
10921119 md weather
@@ -1095,6 +1122,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
10951122 # Initialize a new kotlin project
10961123 gradle init
10971124 ```
1125+ </CodeGroupItem >
10981126 </CodeGroup >
10991127
11001128 运行` gradle init ` 后,您将看到创建项目的选项。
@@ -1104,6 +1132,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
11041132 或者,您可以使用[ IntelliJ IDEA项目向导] 创建Kotlin应用程序(https://kotlinlang.org/docs/jvm-get-started.html ).
11051133
11061134 <CodeGroup >
1135+ <CodeGroupItem title = " Kotlin DSL" >
11071136 ``` kotlin build.gradle.kts
11081137 val mcpVersion = " 0.4.0"
11091138 val slf4jVersion = " 2.0.9"
@@ -1116,7 +1145,9 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
11161145 implementation(" io.ktor:ktor-serialization-kotlinx-json:$ktorVersion " )
11171146 }
11181147 ```
1148+ </CodeGroupItem >
11191149
1150+ <CodeGroupItem title = " Groovy" >
11201151 ``` groovy build.gradle
11211152 def mcpVersion = '0.3.0'
11221153 def slf4jVersion = '2.0.9'
@@ -1129,24 +1160,29 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
11291160 implementation "io.ktor:ktor-serialization-kotlinx-json:$ktorVersion"
11301161 }
11311162 ```
1163+ </CodeGroupItem >
11321164 </CodeGroup >
11331165
11341166 此外,将以下插件添加到您的构建脚本中:
11351167
11361168 <CodeGroup >
1169+ <CodeGroupItem title = " Kotlin DSL" >
11371170 ``` kotlin build.gradle.kts
11381171 plugins {
1139- kotlin(" plugin.serialization" ) version " your_version_of_kotlin"
1140- id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
1141- }
1172+ kotlin(" plugin.serialization" ) version " your_version_of_kotlin"
1173+ id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
1174+ }
11421175 ```
1176+ </CodeGroupItem >
11431177
1178+ <CodeGroupItem title = " Groovy" >
11441179 ``` groovy build.gradle
11451180 plugins {
1146- id 'org.jetbrains.kotlin.plugin.serialization' version 'your_version_of_kotlin'
1147- id 'com.github.johnrengelman.shadow' version '8.1.1'
1148- }
1181+ id 'org.jetbrains.kotlin.plugin.serialization' version 'your_version_of_kotlin'
1182+ id 'com.github.johnrengelman.shadow' version '8.1.1'
1183+ }
11491184 ```
1185+ </CodeGroupItem >
11501186 </CodeGroup >
11511187
11521188 现在,让我们开始构建您的服务器。
@@ -1367,13 +1403,17 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
13671403 例如,如果你有[ VS code] ( https://code.visualstudio.com/ ) 已安装:
13681404
13691405 <CodeGroup >
1406+ <CodeGroupItem title = " JSON" >
13701407 ``` bash MacOS/Linux
13711408 code ~ /Library/Application\ Support/Claude/claude_desktop_config.json
13721409 ```
1410+ </CodeGroupItem >
13731411
1412+ <CodeGroupItem title = " PowerShell" >
13741413 ``` powershell Windows
13751414 code $env:AppData\Claude\claude_desktop_config.json
13761415 ```
1416+ </CodeGroupItem >
13771417 </CodeGroup >
13781418
13791419 然后,您将在` mcpServers ` 键中添加服务器。
@@ -1383,6 +1423,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
13831423 在这种情况下,我们将添加单个天气服务器,如下所示:
13841424
13851425 <CodeGroup >
1426+ <CodeGroupItem title = " JSON" >
13861427 ``` json MacOS/Linux
13871428 {
13881429 "mcpServers" : {
@@ -1396,7 +1437,9 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
13961437 }
13971438 }
13981439 ```
1440+ </CodeGroupItem >
13991441
1442+ <CodeGroupItem title = " JSON" >
14001443 ``` json Windows
14011444 {
14021445 "mcpServers" : {
@@ -1410,6 +1453,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
14101453 }
14111454 }
14121455 ```
1456+ </CodeGroupItem >
14131457 </CodeGroup >
14141458
14151459 这将告诉Claude for Desktop:
@@ -1447,21 +1491,25 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
14471491 现在,让我们创建并设置您的项目:
14481492
14491493 <CodeGroup >
1494+ <CodeGroupItem title = " Bash" >
14501495 ``` bash MacOS/Linux
14511496 # Create a new directory for our project
14521497 mkdir weather
14531498 cd weather
14541499 # Initialize a new C# project
14551500 dotnet new console
14561501 ```
1502+ </CodeGroupItem >
14571503
1504+ <CodeGroupItem title = " PowerShell" >
14581505 ``` powershell Windows
14591506 # Create a new directory for our project
14601507 mkdir weather
14611508 cd weather
14621509 # Initialize a new C# project
14631510 dotnet new console
14641511 ```
1512+ </CodeGroupItem >
14651513 </CodeGroup >
14661514
14671515 运行` dotnetnew console ` 后,您将看到一个新的C#项目。
@@ -1709,7 +1757,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
17091757
17101758## 故障排除
17111759
1712- <AccordionGroup >
1760+ <Accordions type = " multiple " >
17131761 <Accordion title = " Claude桌面集成问题" >
17141762 ** 从Claude获取桌面日志**
17151763
@@ -1772,7 +1820,7 @@ import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
17721820
17731821 这不是一个错误,只是意味着该州目前没有天气警报。尝试不同的状态或在恶劣天气下检查。
17741822 </Accordion >
1775- </AccordionGroup >
1823+ </Accordions >
17761824
17771825<Note >
17781826 有关更高级的故障排除,请查看我们的[ 调试MCP] 指南(https://mcp.thinkinai.xyz/docs/tutorials/debugging)
0 commit comments