添加 contributors 头像支持
This commit is contained in:
parent
212b32ca82
commit
4aa83ba860
@ -6,13 +6,9 @@ import { InlineLinkPreviewElementTransform } from '@nolebase/vitepress-plugin-in
|
||||
import { ThumbnailHashImages } from '@nolebase/vitepress-plugin-thumbnail-hash/vite';
|
||||
import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links';
|
||||
|
||||
import { contributors } from './contributors';
|
||||
import { withMermaid } from "vitepress-plugin-mermaid";
|
||||
|
||||
export const customIcons = {
|
||||
share: {
|
||||
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/></svg>'
|
||||
}
|
||||
}
|
||||
import { customIcons } from './theme/hook/icons';
|
||||
|
||||
export const baseUrl = '/openmcp';
|
||||
|
||||
@ -31,8 +27,11 @@ export default withMermaid({
|
||||
GitChangelog({
|
||||
// 填写在此处填写您的仓库链接
|
||||
repoURL: () => 'https://gitea.3geeks.top/kirigaya/openmcp-document',
|
||||
mapAuthors: contributors
|
||||
}),
|
||||
GitChangelogMarkdownSection({
|
||||
excludes: ['preview/contributors.md', 'index.md']
|
||||
}),
|
||||
GitChangelogMarkdownSection(),
|
||||
ThumbnailHashImages(),
|
||||
],
|
||||
optimizeDeps: {
|
||||
|
80
.vitepress/contributors.ts
Normal file
80
.vitepress/contributors.ts
Normal file
@ -0,0 +1,80 @@
|
||||
interface SocialEntry {
|
||||
type: 'github' | 'twitter' | 'email' | string;
|
||||
link: string;
|
||||
}
|
||||
|
||||
interface Contributor {
|
||||
/**
|
||||
* The overriding display name of the contributor in default locale
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The overriding display name of the contributor in other locales if needed
|
||||
*/
|
||||
i18n?: Record<string, string>;
|
||||
/**
|
||||
* The overriding GitHub, GitLab, Gitea username of the contributor
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* The overriding avatar of the contributor
|
||||
*/
|
||||
avatar?: string;
|
||||
/**
|
||||
* Whether to add a link to the contributor's profile
|
||||
*/
|
||||
links?: string | SocialEntry[];
|
||||
/**
|
||||
* More names to be recognized as the same contributor.
|
||||
*
|
||||
* Useful when you changed your name or email address in the past.
|
||||
*
|
||||
* @deprecated Use `mapByNameAliases` instead
|
||||
* @see mapByNameAliases
|
||||
*/
|
||||
nameAliases?: string[];
|
||||
/**
|
||||
* More names to be recognized as the same contributor.
|
||||
*
|
||||
* Useful when you changed your name or email address in the past.
|
||||
*/
|
||||
mapByNameAliases?: string[];
|
||||
/**
|
||||
* More emails to be recognized as the same contributor.
|
||||
*
|
||||
* Useful when you changed your email address in the past.
|
||||
*
|
||||
* @deprecated Use `mapByEmailAliases` instead
|
||||
* @see mapByEmailAliases
|
||||
*/
|
||||
emailAliases?: string[];
|
||||
/**
|
||||
* More emails to be recognized as the same contributor.
|
||||
*
|
||||
* Useful when you changed your email address in the past.
|
||||
*/
|
||||
mapByEmailAliases?: string[];
|
||||
}
|
||||
|
||||
export const contributors = [
|
||||
{
|
||||
name: '锦恢',
|
||||
nameAliases: ['LSTM-Kirigaya', 'Kirigaya'],
|
||||
mapByEmailAliases: ['1193466151@qq.com'],
|
||||
links: [{ type: '', link: 'https://www.zhihu.com/people/can-meng-zhong-de-che-xian' }]
|
||||
},
|
||||
{
|
||||
name: 'PeaceSheep',
|
||||
nameAliases: ['li1553770945'],
|
||||
avatar: 'https://avatars.githubusercontent.com/u/55867654?v=4',
|
||||
mapByEmailAliases: ['1553770945@qq.com'],
|
||||
links: [{ type: '', link: 'https://peacesheep.cn/home' }]
|
||||
},
|
||||
{
|
||||
name: '星弧梦影',
|
||||
nameAliases: ['StarArc'],
|
||||
avatar: 'https://avatars.githubusercontent.com/u/115577936?v=4',
|
||||
mapByEmailAliases: ['3951001763@qq.com'],
|
||||
links: [{ type: '', link: 'https://b23.tv/bqflzuJ' }]
|
||||
}
|
||||
] as Contributor[];
|
48
.vitepress/theme/components/Contributors/index.vue
Normal file
48
.vitepress/theme/components/Contributors/index.vue
Normal file
@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<VPTeamPage>
|
||||
<VPTeamPageTitle>
|
||||
<template #title>
|
||||
OpenMCP 贡献者列表
|
||||
</template>
|
||||
<template #lead>
|
||||
OpenMCP 是一个非盈利的开源项目,它由对编程和AI技术热爱的开发者共同开发。我们欢迎任何有兴趣参与的开发者加入我们的项目中,一起努力提高AI技术的应用水平。
|
||||
</template>
|
||||
</VPTeamPageTitle>
|
||||
<VPTeamMembers :members />
|
||||
</VPTeamPage>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, PropType } from 'vue';
|
||||
import { VPTeamPage, VPTeamPageTitle, VPTeamMembers } from 'vitepress/theme';
|
||||
import { customIcons } from '../../hook/icons';
|
||||
|
||||
interface Contributor {
|
||||
name: string;
|
||||
avatar: string;
|
||||
title: string;
|
||||
links: { icon: string; link: string; }[];
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
contributors: { type: Array as PropType<Contributor[]>, required: true },
|
||||
});
|
||||
|
||||
const members = computed(() => {
|
||||
return props.contributors.map((contributor) => ({
|
||||
avatar: contributor.avatar,
|
||||
name: contributor.name,
|
||||
title: contributor.title,
|
||||
links: contributor.links.map(({ icon, link }) => {
|
||||
if (icon in customIcons) {
|
||||
return { icon: customIcons[icon as keyof typeof customIcons], link };
|
||||
}
|
||||
return { icon, link };
|
||||
}),
|
||||
}));
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style></style>
|
11
.vitepress/theme/hook/icons.ts
Normal file
11
.vitepress/theme/hook/icons.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export const customIcons = {
|
||||
share: {
|
||||
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/></svg>'
|
||||
},
|
||||
bilibili: {
|
||||
svg: '<svg t="1748584827072" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5040" width="200" height="200"><path d="M777.514667 131.669333a53.333333 53.333333 0 0 1 0 75.434667L728.746667 255.829333h49.92A160 160 0 0 1 938.666667 415.872v320a160 160 0 0 1-160 160H245.333333A160 160 0 0 1 85.333333 735.872v-320a160 160 0 0 1 160-160h49.749334L246.4 207.146667a53.333333 53.333333 0 1 1 75.392-75.434667l113.152 113.152c3.370667 3.370667 6.186667 7.04 8.448 10.965333h137.088c2.261333-3.925333 5.12-7.68 8.490667-11.008l113.109333-113.152a53.333333 53.333333 0 0 1 75.434667 0z m1.152 231.253334H245.333333a53.333333 53.333333 0 0 0-53.205333 49.365333l-0.128 4.010667v320c0 28.117333 21.76 51.157333 49.365333 53.162666l3.968 0.170667h533.333334a53.333333 53.333333 0 0 0 53.205333-49.365333l0.128-3.968v-320c0-29.44-23.893333-53.333333-53.333333-53.333334z m-426.666667 106.666666c29.44 0 53.333333 23.893333 53.333333 53.333334v53.333333a53.333333 53.333333 0 1 1-106.666666 0v-53.333333c0-29.44 23.893333-53.333333 53.333333-53.333334z m320 0c29.44 0 53.333333 23.893333 53.333333 53.333334v53.333333a53.333333 53.333333 0 1 1-106.666666 0v-53.333333c0-29.44 23.893333-53.333333 53.333333-53.333334z" p-id="5041"></path></svg>'
|
||||
},
|
||||
blog: {
|
||||
svg: '<svg t="1748584860211" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8850" width="200" height="200"><path d="M344.407934 453.627004c-29.198618-5.799725-56.39733 17.799157-56.39733 47.597746V602.019978c0 20.399034 14.199328 36.798258 33.398419 43.997917 36.398277 13.599356 62.597036 48.79769 62.597037 89.995739 0 52.997491-42.997964 95.995455-95.995456 95.995456s-95.995455-42.997964-95.995455-95.995456V240.037116c0-26.598741-21.398987-47.997728-47.997727-47.997728H48.021966c-26.598741 0-47.997728 21.398987-47.997727 47.997728v495.976518c0 178.991526 164.192227 320.384832 349.98343 281.386678 108.794849-22.798921 196.590693-110.794755 219.389614-219.389613 34.798353-165.792151-73.996497-314.385116-224.989349-344.383695zM418.00445 0.048478c-18.399129-0.999953-33.99839 13.599356-33.99839 31.998485v63.197008c0 16.999195 13.199375 30.998532 29.998579 31.798494 258.787748 13.999337 466.777901 223.989396 481.777191 482.977134 0.999953 16.799205 14.99929 29.99858 31.798495 29.99858h64.196961c18.399129 0 32.998438-15.599261 31.998485-33.99839C1006.776575 279.635241 744.388998 17.247663 418.00445 0.048478z m0.599972 191.99091c-18.599119-1.399934-34.598362 13.399366-34.598362 32.198476v64.19696c0 16.799205 12.999385 30.598551 29.598598 31.798495 153.592728 12.599403 275.986934 136.393543 289.786281 290.386252 1.599924 16.599214 15.19928 29.398608 31.798494 29.398608h64.396952c18.599119 0 33.598409-15.999243 32.198475-34.598362-16.799205-220.189575-192.990863-396.381234-413.180438-413.380429z" p-id="8851"></path></svg>'
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import TwoSideLayout from './components/home/TwoSideLayout.vue';
|
||||
import KTab from './components/KTab/index.vue';
|
||||
import BiliPlayer from './components/bilibli-player/index.vue';
|
||||
import KNavItem from './components/nav-item/index.vue';
|
||||
import Contributors from './components/Contributors/index.vue';
|
||||
|
||||
import { NolebaseGitChangelogPlugin } from '@nolebase/vitepress-plugin-git-changelog/client';
|
||||
import { NolebaseInlineLinkPreviewPlugin } from '@nolebase/vitepress-plugin-inline-link-preview/client';
|
||||
@ -32,6 +33,8 @@ export default {
|
||||
app.component('KTab', KTab);
|
||||
app.component('BiliPlayer', BiliPlayer);
|
||||
app.component('KNavItem', KNavItem);
|
||||
app.component('Contributors', Contributors);
|
||||
|
||||
app.component('el-collapse', ElCollapse);
|
||||
app.component('el-collapse-item', ElCollapseItem);
|
||||
app.component('el-timeline', ElTimeline);
|
||||
|
@ -191,69 +191,15 @@ ChatCompletionMessage(
|
||||
|
||||
|
||||
|
||||
## 开始你的第一个 mcp 服务器
|
||||
## 使用 Inspector 进行调试
|
||||
|
||||
接下里就要让我们大显身手了!MCP 官方提供了几个封装好的 mcp sdk 来让我们快速开发一个 MCP 服务器。我看了一下,目前使用最爽,最简单的是 python 的 sdk,所以我就用 python 来简单演示一下了。
|
||||
|
||||
当然,如果想要使用 typescript 开发也是没问题的,typescript 的优势就是打包和部署更加简单。可以看我自用的一个模板库:[mcp-server-template](https://github.com/LSTM-Kirigaya/mcp-server-template)
|
||||
|
||||
### 安装基本环境
|
||||
|
||||
首先让我们打开一个项目,安装基本的库:
|
||||
Claude 原生提供的 MCP 协议可以通过官方提供的 Inspector 进行调试,对于 [[first-mcp|你的第一个 MCP]] 中的例子,可以如下进行调试,在命令行输入如下命令启动 Inspector:
|
||||
|
||||
```bash
|
||||
pip install uv
|
||||
mcp dev main.py
|
||||
```
|
||||
|
||||
然后进入一个目录后初始化 uv 项目并安装对应的依赖:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/code/mcp-server
|
||||
cd ~/code/mcp-server
|
||||
uv init --no-workspace
|
||||
uv add mcp "mcp[cli]"
|
||||
```
|
||||
|
||||
创建 `server.py`
|
||||
|
||||
```python
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP('锦恢的 MCP Server', version="11.45.14")
|
||||
|
||||
@mcp.tool('add', '对两个数字进行实数域的加法')
|
||||
def add(a: int, b: int) -> int:
|
||||
return a + b
|
||||
|
||||
@mcp.resource("greeting://{name}", 'greeting', '用于演示的一个资源协议')
|
||||
def get_greeting(name: str) -> str:
|
||||
# 访问处理 greeting://{name} 资源访问协议,然后返回
|
||||
# 此处方便起见,直接返回一个 Hello,balabala 了
|
||||
return f"Hello, {name}!"
|
||||
|
||||
@mcp.prompt('translate', '进行翻译的prompt')
|
||||
def translate(message: str) -> str:
|
||||
return f'请将下面的话语翻译成中文:\n\n{message}'
|
||||
```
|
||||
|
||||
上面的代码在装饰器的作用下非常容易读懂,`@mcp.tool`, `@mcp.resource` 和 `@mcp.prompt` 分别实现了
|
||||
|
||||
- 一个名为 add 的 tool
|
||||
- 一个 greeting 协议的 resource
|
||||
- 一个名为 translate 的 prompt
|
||||
|
||||
> 不明白装饰器是什么小白可以看看我之前的文章[Python进阶笔记(一)装饰器实现函数/类的注册](https://zhuanlan.zhihu.com/p/350821621)
|
||||
> 虽然注册器里面的第二个参数 description 不是必要的,但是仍然建议写一下,要不然大模型怎么知道你这个工具是干啥的。
|
||||
|
||||
### 使用 Inspector 进行调试
|
||||
|
||||
我们可以使用 MCP 官方提供的 Inspector 工具对上面的 server 进行调试:
|
||||
|
||||
```bash
|
||||
mcp dev server.py
|
||||
```
|
||||
|
||||
这会启动一个前端服务器并,打开 `http://localhost:5173/` 后我们可以看到 inspector 的调试界面,先点击左侧的 `Connect` 来运行我们的 server.py 并通过 stdio 为通信管道和 web 建立通信。
|
||||
这会启动一个前端服务器,并打开 `http://localhost:5173/` 后我们可以看到 inspector 的调试界面,先点击左侧的 `Connect` 来运行我们的 server.py 并通过 stdio 为通信管道和 web 建立通信。
|
||||
|
||||
Fine,可以开始愉快地进行调试了,Inspector 主要给了我们三个板块,分别对应 Resources,Prompts 和 Tools。
|
||||
|
||||
|
@ -42,10 +42,20 @@ VLE 的插件商城页面有一个三个点的按钮,点击它后,你能看
|
||||
|
||||
### 方法二:通过命令行
|
||||
|
||||
如果您的 VLE 是全局安装的,会自动存在一个命令行工具,此处以 vscode 为例子(trae 的命令为 trae),打开命令行,输入
|
||||
如果您的 VLE 是全局安装的,会自动存在一个命令行工具,命令如下:
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
```bash [vscode]
|
||||
code --install-extension /path/to/openmcp-0.1.1.vsix
|
||||
```
|
||||
|
||||
/path/to/openmcp-0.1.1.vsix 代表你刚刚下载的 vsix 文件的绝对路径。这样也可以安装插件。
|
||||
```bash [trae]
|
||||
trae --install-extension /path/to/openmcp-0.1.1.vsix
|
||||
```
|
||||
|
||||
```bash [cursor]
|
||||
cursor --install-extension /path/to/openmcp-0.1.1.vsix
|
||||
```
|
||||
:::
|
||||
|
||||
`/path/to/openmcp-0.1.1.vsix` 代表你刚刚下载的 vsix 文件的绝对路径。这样也可以安装插件。
|
@ -3,28 +3,27 @@ layout: page
|
||||
---
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
VPTeamPage,
|
||||
VPTeamPageTitle,
|
||||
VPTeamMembers
|
||||
} from 'vitepress/theme'
|
||||
import { VPTeamPage, VPTeamPageTitle, VPTeamMembers } from 'vitepress/theme';
|
||||
|
||||
const members = [
|
||||
const contributors = [
|
||||
{
|
||||
avatar: 'https://pic1.zhimg.com/v2-b4251de7d2499e942c7ebf447a90d2eb_xll.jpg?source=32738c0c',
|
||||
name: 'LSTM-Kirigaya (锦恢)',
|
||||
title: 'Creator & Developer',
|
||||
links: [
|
||||
{ icon: 'github', link: 'https://github.com/LSTM-Kirigaya' },
|
||||
{ icon: 'zhihu', link: 'https://www.zhihu.com/people/can-meng-zhong-de-che-xian' }
|
||||
{ icon: 'zhihu', link: 'https://www.zhihu.com/people/can-meng-zhong-de-che-xian' },
|
||||
{ icon: 'bilibili', link: 'https://space.bilibili.com/434469188?spm_id_from=333.1007.0.0' },
|
||||
{ icon: 'blog', link: 'https://kirigaya.cn/home' },
|
||||
]
|
||||
},
|
||||
{
|
||||
avatar: 'https://avatars.githubusercontent.com/u/55867654?v=4',
|
||||
name: 'li1553770945 (Li Yaning)',
|
||||
name: 'PeaceSheep',
|
||||
title: 'Creator & Developer',
|
||||
links: [
|
||||
{ icon: 'github', link: 'https://github.com/li1553770945' },
|
||||
{ icon: 'blog', link: 'https://peacesheep.xyz' },
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -40,20 +39,13 @@ const members = [
|
||||
name: 'AmeSoraQwQ (AmeZora)',
|
||||
title: 'Creator & Operation',
|
||||
links: [
|
||||
{ icon: 'github', link: 'https://github.com/AmeSoraQwQ' },
|
||||
{ icon: 'bilibili', link: 'https://b23.tv/bqflzuJ' },
|
||||
{ icon: 'github', link: 'https://github.com/ArcStellar2025' },
|
||||
]
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<VPTeamPage>
|
||||
<VPTeamPageTitle>
|
||||
<template #title>
|
||||
OpenMCP 贡献者列表
|
||||
</template>
|
||||
<template #lead>
|
||||
OpenMCP 是一个非盈利的开源项目,它由对编程和AI技术热爱的开发者共同开发。我们欢迎任何有兴趣参与的开发者加入我们的项目中,一起努力提高AI技术的应用水平。
|
||||
</template>
|
||||
</VPTeamPageTitle>
|
||||
<VPTeamMembers :members />
|
||||
</VPTeamPage>
|
||||
<Contributors
|
||||
:contributors="contributors"
|
||||
/>
|
@ -17,4 +17,18 @@
|
||||
- 为我们的项目设计新的功能,这未必一定需要阁下写代码,只是在 [MVP 需求规划](https://github.com/LSTM-Kirigaya/openmcp-client?tab=readme-ov-file#%E9%9C%80%E6%B1%82%E8%A7%84%E5%88%92) 中提出有意义的功能也是很不错的贡献。
|
||||
- 通过 OpenMCP 来完成不同的 agent 开发的例子或者打磨新的开发 AI Agent 的方法论。在征得阁下本人同意后,我们将会将你的教程整合到这个网站中。
|
||||
|
||||
通过向 OpenMCP 贡献以上内容或是其他,阁下将能成为 OpenMCP 的贡献者。
|
||||
通过向 OpenMCP 贡献以上内容或是其他,阁下将能成为 OpenMCP 的贡献者。
|
||||
|
||||
## 为 openmcp 文档站点添砖加瓦
|
||||
|
||||
如果您想要为 openmcp 文档站点修复专业错误或者贡献您的例子,请 fork [openmcp-document](https://github.com/LSTM-Kirigaya/openmcp-document) 提交 PR 。
|
||||
|
||||
如果您对 github 的操作不熟悉,请 [进入 OpenMCP 开发群](https://qm.qq.com/cgi-bin/qm/qr?k=C6ZUTZvfqWoI12lWe7L93cWa1hUsuVT0&jump_from=webapi&authKey=McW6B1ogTPjPDrCyGttS890tMZGQ1KB3QLuG4aqVNRaYp4vlTSgf2c6dMcNjMuBD) 并联系管理员锦恢,请提供如下几件东西:
|
||||
|
||||
- 您希望贡献的内容
|
||||
- 您的 github 账号(主页链接)
|
||||
- 您的邮箱
|
||||
- 您希望展现在网站上的 ID 和 头像
|
||||
- 您希望关联的网站链接(比如b站,知乎,个人网站什么的)
|
||||
|
||||
完成添加后,您就可以向 [openmcp-document](https://github.com/LSTM-Kirigaya/openmcp-document) 提交 PR 了。
|
@ -14,15 +14,15 @@ OpenMCP Client 提供了一体化的 MCP 调试解决方案,这很好,但是
|
||||
## 安装
|
||||
|
||||
::: code-group
|
||||
```[npm]
|
||||
```bash [npm]
|
||||
npm install openmcp-sdk
|
||||
```
|
||||
|
||||
```[yarn]
|
||||
```bash [yarn]
|
||||
yarn add openmcp-sdk
|
||||
```
|
||||
|
||||
```[pnpm]
|
||||
```bash [pnpm]
|
||||
pnpm add openmcp-sdk
|
||||
```
|
||||
:::
|
||||
|
Loading…
x
Reference in New Issue
Block a user