Skip to main content
Glama
MaryamSarfraz77

Dictionary Lookup MCP Server

词典查询 MCP 服务器

一个基于官方 Python SDK 构建的极简 模型上下文协议 服务器。它暴露了一个工具 define,用于通过免费的 dictionaryapi.dev API 查询英文单词的定义。

本项目是作为学习练习而构建的,旨在理解 MCP 服务器是如何构建的、如何与客户端通信,以及如何公开部署。

功能

  • 暴露一个工具:define(word: str) -> str

  • 给定一个单词,返回其词性和定义

  • 无需 API 密钥或身份验证

Related MCP server: yifanli-mcp-add-demo

环境要求

  • Python 3.10+

  • uv(推荐)或 pip

本地设置

# 1. Clone this repo
git clone <your-repo-url>
cd my-mcp-server

# 2. Install dependencies
uv sync

本地运行

选项 A — MCP Inspector(可视化测试工具,最适合初学者):

uv run mcp dev server.py

这会打开一个基于浏览器的检查器,您可以直接调用 define 工具并查看请求/响应,而无需完整的 AI 客户端。

选项 B — 连接到 Claude Desktop:

将以下内容添加到您的 Claude Desktop 配置文件(claude_desktop_config.json)中:

{
  "mcpServers": {
    "dictionary-lookup": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/my-mcp-server",
        "run",
        "server.py"
      ]
    }
  }
}

重启 Claude Desktop,然后询问类似这样的问题: "使用词典工具查询 'ephemeral' 的定义。"

使用示例

输入: define("ephemeral") 输出: ephemeral (形容词):持续很短的时间。

部署

此服务器已发布在 Smithery 上:<部署后添加链接>

要部署您自己的副本:

  1. 将此仓库推送到 GitHub。

  2. 确保 server.py 支持 streamable-http 传输以进行远程托管。

  3. 托管它(例如 Render/Railway),或使用 Smithery 的发布流程。

  4. 在 Smithery 上,选择"通过 URL 发布",并将其指向您托管的服务器端点。

为什么做这个项目

为了学习 MCP 的基础知识:客户端如何发现服务器的工具、工具调用如何被发起和响应,以及一个可用的服务器如何通过像 Smithery 这样的市场公开分享。

Available Tools

1 tool
defineA

Look up the definition of an English word and return it as text.

ParametersJSON Schema
NameRequiredDescriptionDefault
wordYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the full behavioral burden. It conveys a read-only lookup behavior by saying 'Look up' and specifies the return type as 'text.' It does not cover edge cases like unknown words or multiple definitions, but these are not critical for a simple dictionary lookup tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that directly states the action, scope, and output. Every word earns its place and there is no unnecessary elaboration or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read-only lookup tool with an output schema, the description is substantially complete. It covers the input type ('English word'), the operation, and the return format ('text'). It does not mention failure behavior, but that is a minor gap given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only has a parameter titled 'Word' with zero description coverage. The description compensates by specifying that the word must be an English word, which adds meaningful semantic context beyond the schema. Though format and edge cases are not detailed, the parameter and its expected value are straightforward.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Look up') and a clear resource ('the definition of an English word'), and it states the output form ('return it as text'). There are no sibling tools, so no differentiation is needed. This makes the tool's purpose immediately obvious.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use the tool: whenever an agent needs to retrieve the meaning of an English word. It also implicitly excludes non-English words. Because there are no sibling tools or alternatives, explicit when-not-to-use guidance is not necessary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observeddefine

TDQS

A4.4/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is no possibility of confusing it with another tool. Its purpose is immediately clear and unambiguous.

Naming Consistency5/5

The single tool name 'define' is a clear imperative verb that matches its action. With only one tool, there are no mixed naming conventions or inconsistencies.

Tool Count3/5

One tool feels thin for a server labeled as a dictionary lookup service, though it does cover the core definition lookup need. It is borderline rather than extreme.

Completeness4/5

The core lookup functionality is covered well, but a dictionary server might reasonably include related operations like synonyms, usage examples, or pronunciation. These are minor gaps rather than fatal omissions.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal Model Context Protocol server built with FastAPI that provides a basic "Hello World" resource and tool. Serves as a starting point for building and validating MCP client integrations with richer resources and tools.
    -
  • F
    license
    B
    quality
    Not graded
    maintenance
    A minimal Model Context Protocol server that provides a simple tool for adding two integers. It serves as a demonstration of the official Python MCP SDK and is designed for local execution via stdio.
    1
    -
  • F
    license
    A
    quality
    D
    maintenance
    A minimal starting point for a Model Context Protocol server with stdio transport and one tool, enabling quick setup and custom tool addition.
    1
    -