每日一词MCP服务器
一个模型上下文协议(MCP)服务器,使用惊人的 免费词典API! 🎉
🙏 特别感谢
巨大的呐喊 免费词典API 感谢团队提供这项令人难以置信的免费开源词典服务!如果没有他们出色的API,这个项目是不可能的,它提供了全面的单词定义、发音、示例等等。
API终结点: https://api.dictionaryapi.dev/api/v2/entries/en/
特性
- 获取单词定义:获取任何英语单词的全面定义、发音、含义和示例
- 一天中的随机单词:获取一个随机单词及其定义,按难度级别分类
- 丰富的信息:包括语音发音、词性、示例、同义词、反义词和词源(如果可用)
安装
- 克隆或下载此项目
- 安装依赖项:
npm install- 构建项目:
npm run build用法
作为MCP服务器
服务器配置为通过MCP协议运行。将其添加到MCP客户端配置中:
{
"mcpServers": {
"word-of-the-day": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/Word_of_the_day"
}
}
}🛠️ 可用的MCP工具
此服务器提供了两个强大的词汇增强工具:
📖 get_word_definition
说明: 使用API词典获取任何英语单词的全面定义、发音和含义。
输入架构:
{
"type": "object",
"properties": {
"word": {
"type": "string",
"description": "The word to get the definition for"
},
"language": {
"type": "string",
"description": "Language code (default: en)",
"default": "en"
}
},
"required": ["word"]
}示例用法:
{
"name": "get_word_definition",
"arguments": {
"word": "serendipity"
}
}样本响应:
**serendipity**
**Pronunciation:** /ˌsɛɹənˈdɪpɪti/
**Meanings:**
1. **noun**
1. An unsought finding or discovery; a pleasant surprise.
*Example: "A fortunate stroke of serendipity brought the two old friends together."*
2. The faculty or phenomenon of finding valuable or agreeable things not sought for.
**Audio Pronunciation:**
1. https://api.dictionaryapi.dev/media/pronunciations/en/serendipity-us.mp3______________________________________________________________________
🎲 get_random_word
说明: 根据难度级别,随机选择一个单词及其完整的日常词汇构建定义。
输入架构:
{
"type": "object",
"properties": {
"difficulty": {
"type": "string",
"enum": ["easy", "medium", "hard"],
"description": "Difficulty level of the random word",
"default": "medium"
}
},
"required": []
}示例用法:
{
"name": "get_random_word",
"arguments": {
"difficulty": "hard"
}
}样本响应:
**surreptitious** 🕵️
**Pronunciation:** /ˌsʌɹɪpˈtɪʃəs/
**Meanings:**
1. **adjective**
1. Stealthy, furtive, well hidden, covert (especially movements).
**Audio Pronunciation:**
1. https://api.dictionaryapi.dev/media/pronunciations/en/surreptitious-us.mp3难度级别:
- 简单:日常常用词(快乐、房子、水、光、音乐、朋友)
- 中等:复杂的词汇(偶然、雄辩、坚韧、华丽)
- 困难:高级词汇(短暂、无处不在、敏锐、隐秘)
📚 API集成
此服务器与 免费词典API -一个完全免费、开源的词典API,无需身份验证!
为什么我们喜欢这个API:
- ✅ 完全免费 -没有API密钥或速率限制
- ✅ 开源 -社区驱动项目
- ✅ 综合数据 -丰富的单词信息
- ✅ 无身份验证 -只需提出请求并获取数据!
API提供:
- 单词定义和含义
- 语音发音(文本和音频)
- 词性信息
- 使用示例
- 同义词、反义词
- 词源/起源信息
单词难度级别
- 简单:常见的日常词汇(快乐、房子、水等)
- 中等:更复杂的词汇(意外发现、雄辩、坚韧等)
- 困难:高级词汇(短暂的、无处不在的、敏锐的等)
发展
- 开发模式:
npm run dev - 构建:
npm run build - 开始:
npm start
示例响应
当你请求“hello”的定义时,你会得到:
**hello**
**Pronunciation:** həˈləʊ, hɛˈləʊ
**Origin:** early 19th century: variant of earlier hollo ; related to holla.
**Meanings:**
1. **exclamation**
1. used as a greeting or to begin a phone conversation.
*Example: "hello there, Katie!"*
2. **noun**
1. an utterance of 'hello'; a greeting.
*Example: "she was getting polite nods and hellos from people"*
3. **verb**
1. say or shout 'hello'.
*Example: "I pressed the phone button and helloed"*
**Audio Pronunciation:**
1. //ssl.gstatic.com/dictionary/static/sounds/20200429/hello--_gb_1.mp3错误处理
服务器优雅地处理:
- 字典里找不到的单词
- API连接问题
- 无效参数
- 网络超时
许可证
这个项目是开源的,可以在MIT许可证下使用。
______________________________________________________________________
由以下材料制成❤️ 通过特拉维斯Theberge
