mcp-trial
mcp-trial
Я изучаю Model Context Protocol, создавая сервер для GitHub API. Python SDK v2, работает через stdio и подключён к Claude Code.
Что он делает
Два инструмента: один для сводки по репозиторию, другой для недавних сообщений коммитов. Также есть ресурс, который отдаёт сырой README репозитория, и шаблон промпта для оценки репозитория как элемента портфолио.
Related MCP server: GitHub MCP Server
Запуск
uv sync
uv run mcp dev server.py # opens the inspector
uv run python test_server.py # calls the server directly, no host neededЧтобы зарегистрировать его в Claude Code:
claude mcp add gh-lab -- uv run --directory /path/to/mcp-trial mcp run server.pyЧто я узнал
Ваши аннотации типов — это фактический контракт API, поскольку SDK строит JSON-схему инструмента прямо из сигнатуры функции. Написание limit: int = 5 также делает этот параметр необязательным, так что модель может его пропустить.
Docstrings оказались важнее, чем я ожидал, потому что они отправляются модели как описание инструмента и определяют, какой инструмент она выберет. Я спросил Claude Code, активно ли поддерживается репозиторий, и он вызвал оба инструмента и разобрался, что произошло только потому, что описания делали их совместимыми.
Всё, что возвращает инструмент, становится текстом в контексте модели, поэтому каждое поле стоит токенов. GitHub отдаёт около сотни полей, а я возвращаю пять.
Выбрасывание ошибки лучше, чем возврат, поскольку выбрасывание устанавливает флаг, который проверяет хост, и сообщение доходит до модели как то, на что она может отреагировать.
Async ничего не ускоряет. Один вызов занимает одинаковое время в любом случае. Что делает await — это приостанавливает функцию и освобождает цикл событий, чтобы другие вызовы могли выполняться во время ожидания.
Заметки
mcp-reference.md содержит мои рабочие заметки по созданию этого.
Available Tools
2 toolsget_repoA
Get summary info for a GitHub repository: description, stars, language, last push.
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | ||
| owner | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral transparency burden. 'Get summary info' conveys a read-only operation and names the returned fields, but it does not mention authentication needs, rate limits, error behavior, or edge cases like repositories without a last push.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, tightly structured sentence front-loads the action and resource, then enumerates concrete outputs. There is no filler, repetition, or unnecessary detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter read-only metadata tool, the description is largely complete: it states the operation, target resource, and output fields. A note about when to prefer recent_commits would improve it, but that gap is already reflected in the usage guidelines score.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has no parameter descriptions and the description does not define 'owner' or 'repo' beyond the general reference to a GitHub repository. The parameter names are fairly self-evident, but the description adds no meaningful semantic depth.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Begins with 'Get summary info for a GitHub repository' which is a specific verb plus resource, and lists concrete fields (description, stars, language, last push) that clearly distinguish it from the sibling tool recent_commits.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not explicitly state when to use this tool versus recent_commits, nor does it provide prerequisites or exclusions. Usage context must be inferred from the word 'summary' and the listed output fields.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
recent_commitsB
List the most recent commit messages on a repository's default branch.
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | ||
| limit | No | ||
| owner | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It usefully clarifies that only the default branch is inspected and that only messages are returned, but it does not mention ordering beyond 'most recent,' pagination, authentication needs, or rate-limit behavior. This is adequate but not richly transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One short, front-loaded sentence that states the core behavior without filler or redundancy. Every word contributes meaning, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only listing tool, the description covers the main action and branch scope, and an output schema exists to describe return values. However, it leaves the limit parameter's semantics completely unaddressed and assumes the agent infers the standard owner/repo relationship, so the context is minimally sufficient rather than complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description does not explain any of the three parameters (owner, repo, limit). It adds no meaning beyond the raw property names and default value already present in the input schema, so it fails to compensate for the low schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('List') and a specific resource ('recent commit messages'), clearly scoping them to 'a repository's default branch.' This distinguishes it from the sibling get_repo, which is about repository metadata rather than commit messages.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use when recent commit messages are needed, but it provides no explicit guidance about when not to use it or how it compares to the sibling get_repo. It does not include exclusions or alternative recommendations, so usage guidance is only implicit.
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.
2 tool updates
v0.1.0- First observed
get_repo - First observed
recent_commits
TDQS
Scored across 2 tools
get_repo and recent_commits are clearly distinct: one fetches repository metadata, the other lists recent commit messages. There is no ambiguity between them.
Both names use snake_case but follow different patterns: get_repo uses a verb_noun construction while recent_commits is an adjective_noun phrase. The inconsistency is minor but noticeable.
With only 2 tools, the server feels thin for a GitHub-related purpose. It is slightly under the typical well-scoped range, though acceptable for a narrow read-only trial.
The tools only cover repository metadata and recent commits. Obvious gaps like branches, issues, pull requests, and other common repository operations are missing, which would significantly hinder agents needing broader repo access.
Maintenance
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A MCP server built for developers enabling Git based project management with project and personal…
Create, deploy, and operate MCP servers directly from your GitHub repositories.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that enables analyzing and querying GitHub repositories through the GitHub Chat API, allowing users to index repositories and ask questions about their code, architecture and tech stack.290MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with the GitHub API, enabling AI assistants to query repositories, pull requests, issues, commits, users, and more.261 npmISC
- FlicenseNot gradedqualityDmaintenanceA read-only MCP server that exposes GitHub user profiles, repository info, and search via tools for AI assistants like Claude.-
- AlicenseAqualityDmaintenanceMCP server that enables AI assistants to look up and analyze GitHub repositories, including stars, forks, description, open issues, and README content.238 npmMIT