Skip to content
Back to search

mcp-mianshiya-server

基于 Spring AI 的面试鸭搜索题目的 MCP Server 服务,快速让 AI 搜索企业面试真题和答案

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/yuyuanweb--mcp-mianshiya-server/badge.svg)](/listings/yuyuanweb--mcp-mianshiya-server)

HTML

<a href="/listings/yuyuanweb--mcp-mianshiya-server"><img src="/api/listings/yuyuanweb--mcp-mianshiya-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

git clone https://github.com/yuyuanweb/mcp-mianshiya-server

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 161 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # 面试鸭 MCP Server
  2. ## 简介
  3. [面试鸭](https://mianshiya.com/)
  4. 的题目搜索API现已兼容MCP协议,是国内首家兼容MCP协议的面试刷题网站。关于MCP协议,详见MCP官方[文档](https://modelcontextprotocol.io/)。
  5. 依赖`MCP Java SDK`开发,任意支持MCP协议的智能体助手(如`Claude`、`Cursor`以及`千帆AppBuilder`等)都可以快速接入。
  6. 以下会给更出详细的适配说明。
  7. ## 工具列表
  8. #### 题目搜索 `questionSearch`
  9. - 将面试题目检索为面试鸭里的题目链接
  10. - 输入: `题目`
  11. - 输出: `[题目](链接)`
  12. ## 快速开始
  13. 使用面试鸭MCP Server主要通过`Java SDK` 的形式
  14. ### Java 接入
  15. > 前提需要Java 17 运行时环境
  16. #### 安装
  17. ``` bash
  18. git clone https://github.com/yuyuanweb/mcp-mianshiya-server
  19. ```
  20. #### 构建
  21. ``` bash
  22. cd mcp-mianshiya-server
  23. mvn clean package
  24. ```
  25. #### 使用
  26. 1) 打开`Cherry Studio`的`设置`,点击`MCP 服务器`。
  27. ![cherry1.png](img/cherry1.png)
  28. 2) 点击`编辑 JSON`,将以下配置添加到配置文件中。
  29. ``` json
  30. {
  31. "mcpServers": {
  32. "mianshiyaServer": {
  33. "command": "java",
  34. "args": [
  35. "-Dspring.ai.mcp.server.stdio=true",
  36. "-Dspring.main.web-application-type=none",
  37. "-Dlogging.pattern.console=",
  38. "-jar",
  39. "/yourPath/mcp-server-0.0.1-SNAPSHOT.jar"
  40. ],
  41. "env": {}
  42. }
  43. }
  44. }
  45. ```
  46. ![cherry2.png](img/cherry2.png)
  47. 3) 在设置-模型服务里选择一个模型,输入API密钥,选择模型设置,勾选下工具函数调用功能。
  48. ![cherry3.png](img/cherry3.png)
  49. 4) 在输入框下面勾选开启MCP服务。
  50. ![cherry4.png](img/cherry4.png)
  51. 5) 配置完成,然后查询下面试题目
  52. ![cherry5.png](img/cherry5.png)
  53. #### 代码调用
  54. 1) 引入依赖
  55. ``` java
  56. <dependency>
  57. <groupId>com.alibaba.cloud.ai</groupId>
  58. <artifactId>spring-ai-alibaba-starter</artifactId>
  59. <version>1.0.0-M6.1</version>
  60. </dependency>
  61. <dependency>
  62. <groupId>org.springframework.ai</groupId>
  63. <artifactId>spring-ai-mcp-client-spring-boot-starter</artifactId>
  64. <version>1.0.0-M6</version>
  65. </dependency>
  66. ```
  67. 2) 配置MCP服务器
  68. 需要在application.yml中配置MCP服务器的一些参数:
  69. ``` yaml
  70. spring:
  71. ai:
  72. mcp:
  73. client:
  74. stdio:
  75. # 指定MCP服务器配置文件
  76. servers-configuration: classpath:/mcp-servers-config.json
  77. mandatory-file-encoding: UTF-8
  78. ```
  79. 其中mcp-servers-config.json的配置如下:
  80. ``` json
  81. {
  82. "mcpServers": {
  83. "mianshiyaServer": {
  84. "command": "java",
  85. "args": [
  86. "-Dspring.ai.mcp.server.stdio=true",
  87. "-Dspring.main.web-application-type=none",
  88. "-Dlogging.pattern.console=",
  89. "-jar",
  90. "/Users/gulihua/Documents/mcp-server/target/mcp-server-0.0.1-SNAPSHOT.jar"
  91. ],
  92. "env": {}
  93. }
  94. }
  95. }
  96. ```
  97. 客户端我们使用阿里巴巴的通义千问模型,所以引入spring-ai-alibaba-starter依赖,如果你使用的是其他的模型,也可以使用对应的依赖项,比如openAI引入`spring-ai-openai-spring-boot-starter` 这个依赖就行了。
  98. 配置大模型的密钥等信息:
  99. ``` yaml
  100. spring:
  101. ai:
  102. dashscope:
  103. api-key: ${通义千问的key}
  104. chat:
  105. options:
  106. model: qwen-max
  107. ```
  108. 通义千问的key可以直接去[官网](https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key?spm=a2c4g.11186623.0.0.7399482394LUBH) 去申请,模型我们用的是通义千问-Max。
  109. 3) 初始化聊天客户端
  110. ``` java
  111. @Bean
  112. public ChatClient initChatClient(ChatClient.Builder chatClientBuilder,
  113. ToolCallbackProvider mcpTools) {
  114. return chatClientBuilder
  115. .defaultTools(mcpTools)
  116. .build();
  117. }
  118. ```
  119. 4) 接口调用
  120. ``` java
  121. @PostMapping(value = "/ai/answer/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
  122. public Flux<String> generateStreamAsString(@RequestBody AskRequest request) {
  123. Flux<String> content = chatClient.prompt()
  124. .user(request.getContent())
  125. .stream()
  126. .content();
  127. return content
  128. .concatWith(Flux.just("[complete]"));
  129. }
  130. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.