Skip to main content
Glama
GSA-TTS

MCP Hackathon Server

Official
by GSA-TTS

GSA MCP 해커톤 — 서버 템플릿

Model Context Protocol (MCP) 서버를 Python으로 구축하기 위한 바로 실행 가능한 스타터이며, IBM Cloud (watsonx Orchestrate) 및 Databricks 배포 키트가 함께 제공됩니다.

FastMCP와 uv로 제작되었습니다. MCP 서버를 처음 만들어 본다면 **QUICKSTART.md**부터 시작하세요.


MCP 서버란 무엇인가요?

MCP 서버는 도구(모델이 호출할 수 있는 함수), 프롬프트(재사용 가능한 대화 시작 문구), 리소스(모델이 읽을 수 있는 데이터)를 Claude Desktop, Claude Code, watsonx Orchestrate 같은 에이전트 플랫폼 등 AI 클라이언트에 노출합니다. 도구를 작성하면 클라이언트의 모델이 호출 시점을 결정합니다.

이 템플릿은 각각 하나씩 예제가 포함된 작동하는 서버를 제공하므로, 예제를 자신의 서비스로 교체하고 배포하면 됩니다.


Related MCP server: Python MCP Server Template

리포지토리 구조

mcp-hackathon-template/
├── README.md                  # This file
├── QUICKSTART.md              # 5-minute clone → run → connect walkthrough
├── main.py                    # Local entry point (uv run python main.py)
├── pyproject.toml             # Package + dependencies (uv)
├── requirements.txt           # Mirror of runtime deps (for buildpack hosts)
├── Dockerfile                 # Container image (streamable-HTTP, port 8080)
├── manifest.yaml              # cloud.gov (Cloud Foundry) deploy
├── server.json                # MCP registry metadata
├── .env.example               # Copy to .env for local dev
├── .github/workflows/ci.yml   # Lint + test on push/PR
├── src/
│   └── example_server/        # ← rename to your service
│       ├── app.py             # Thin entry point: builds FastMCP, picks transport
│       ├── config.py          # Settings from env vars / .env
│       ├── models.py          # Pydantic models & enums for tool params
│       ├── utils.py           # Shared helpers (HTTP client, pagination)
│       ├── routes.py          # HTTP-only routes (/health, /version)
│       ├── tools/             # ONE FILE PER TOOL
│       │   ├── __init__.py    #   register_tools(mcp) aggregator
│       │   └── example_tool.py
│       ├── prompts/
│       │   ├── __init__.py    #   register_prompts(mcp) aggregator
│       │   └── example.py
│       └── resources/
│           ├── __init__.py    #   register_resources(mcp) aggregator
│           └── example.py
├── tests/                     # Import + registration smoke tests
├── eval/                      # Stub → build a Phoenix eval harness (see mcp-eval skill)
└── deploy/
    ├── README.md              # Which deployment kit to use
    ├── ibm/                   # watsonx Orchestrate: 3 kits (see below)
    └── databricks/            # Databricks Apps kit

시작하기

사전 요구 사항

  • uv — pip install uv 또는 brew install uv

설치 및 실행

cp .env.example .env
uv sync
uv run python main.py

서버는 stdio 모드로 시작됩니다. 즉 stdin/stdout을 통해 JSON-RPC로 통신하며, 이는 로컬 클라이언트(Claude Desktop, Claude Code)가 서버를 시작하는 방식입니다. 클라이언트 연결은 QUICKSTART.md를 참조하세요.

검증

uv sync --group dev
uv run pytest tests/ -v      # tests
uv run ruff check .          # lint

파일당 하나의 도구 패턴

각 도구는 src/example_server/tools/ 아래의 자체 파일에 있으며 register(mcp) 함수를 노출합니다. tools/__init__.py는 register_tools(mcp) 하나에서 각 도구를 호출합니다. 이렇게 하면 도구 목록을 훑어보기 쉬워지고, 두 개의 파일만 만져 통합 기능을 추가하거나 제거할 수 있습니다.

1단계 — src/example_server/tools/my_tool.py 생성:

from typing import Annotated
from fastmcp import FastMCP

from example_server.utils import fetch_json


def register(mcp: FastMCP) -> None:
    @mcp.tool(
        name="example_get_thing",
        annotations={
            "title": "Get a thing",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True,
        },
    )
    async def get_thing(thing_id: Annotated[str, "The ID to fetch."]) -> dict:
        """One-line summary. Document the data source, its update cadence,
        and the return shape here — the model reads this docstring."""
        return await fetch_json(f"https://api.example.gov/things/{thing_id}")

2단계 — tools/__init__.py에 연결:

from example_server.tools import example_tool, my_tool

def register_tools(mcp) -> None:
    example_tool.register(mcp)
    my_tool.register(mcp)  # ← add this line

3단계 — API 키 추가: config.py에 타입 필드로 추가하고 .env.example에 환경 변수를 문서화합니다.

프롬프트(prompts/)와 리소스(resources/)도 정확히 동일한 register(mcp) + 집계 패턴을 따릅니다.


패키지 이름 변경

서버를 배포하기 전에 example_server를 서비스 이름(예: census_mcp)으로 변경하세요:

  1. src/example_server/ 폴더를 src/<your_name>/으로 이름을 바꿉니다.

  2. pyproject.toml: [project].name, [project.scripts], [tool.hatch.build.targets.wheel].packages를 업데이트합니다.

  3. src/, tests/, main.py, Dockerfile, manifest.yaml에서 example_server를 찾아 바꿉니다.


도구 설계 팁(연방 데이터)

  • 산문이 아닌 구조화된 데이터를 반환하세요. 일관된 키를 가진 dict/구조 목록을 반환하고 모델이 설명하게 하세요.

  • 신선도(freshness)를 명확히 하세요. 연방 데이터셋은 지연되어 있습니다. 문서 문자열(docstring)에 업데이트 주기와 "기준일"을 명시하세요.

  • 페이지네이션을 노출하세요. utils.py의 PaginationParams / paginate()를 사용하고 has_more / next_offset을 반환하세요.

  • 명시적 타임아웃을 사용하세요. utils.fetch_json은 기본 30초입니다.

  • 조치 가능한 오류를 반환하세요. 원시 스택 트레이스 대신 hint가 포함된 오류 dict를 반환하세요.


배포하기

로컬 개발은 stdio를 사용합니다. 에이전트 플랫폼과 서버를 공유하려면 배포하고 등록하세요. **deploy/README.md**에서 선택 도구를 확인한 후 다음을 수행하세요:

  • IBM watsonx Orchestrate — deploy/ibm/ 로컬 stdio 도구 키트, Code Engine Git 기반 빌드, 사전 구축 이미지의 세 가지 키트가 있습니다.

  • Databricks 또는 확장 — deploy/databricks/를 참조하세요.

두 배포 모두 동일한 서버 코드를 읽습니다. app.py는 플랫폼에서 포트를 주입하면 자동으로 HTTP를 제공합니다.


평가(Evaluations)

LLM이 사용자의 도구를 얼마나 잘 활용하는지 측정하는 것은 서버 품질의 진짜 시험입니다. 이 템플릿은 의도적으로 평가 하네스를 포함하지 않습니다. mcp-eval 스킬로 평가 하네스를 구축하는 방법은 eval/README.md를 참조하세요.


라이선스

MIT. 취약점 공개 정책과 해커톤 보안 메모는 SECURITY.md를 참조하세요.

Available Tools

1 tool
example_search_datasetsSearch Datasets (example)B
Read-onlyIdempotent

Search federal datasets matching a query string. (STUB — replace me.)

This stub shows the shape of a real tool without calling a live API. Swap the body for an actual request using fetch_json(...); a worked pattern is included below in a comment.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesKeywords to search dataset titles and descriptions.
paginationNoOptional limit/offset (defaults to limit=20, offset=0).
response_formatNoReturn machine-readable JSON (default) or human-readable Markdown.json

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior3/5

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

The annotations (readOnlyHint, openWorldHint, idempotentHint, destructiveHint: false) already establish the safety profile. The description adds one meaningful behavioral fact—'This stub... without calling a live API'—which is honest and useful context. However, it doesn't elaborate on return behavior, result ordering, or error conditions, leaving most of the behavioral burden on the annotations. No contradiction with the annotations is present.

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

Conciseness3/5

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

The text is short and front-loads the meaningful description, which is good. However, roughly three of four lines are implementer-facing stub notes ('(STUB — replace me.)', 'Swap the body...', 'a worked pattern is included below in a comment') that add no value to an agent selecting or invoking the tool. It's not verbose, but those sentences could earn their place better with functional detail.

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

Completeness3/5

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

Given the presence of an output schema, return values don't need explanation. The schema plus annotations cover the mechanical calling contract well. However, the description leaves open real-world questions an agent might face, such as what 'federal datasets' covers, and pagination behavior. For an explicitly stubbed example tool, this is adequate, but not complete for a production tool.

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

Parameters3/5

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

Schema description coverage is 100%, and the schema thoroughly documents all three parameters: the required 'query', the pagination object with limits and defaults, and the response_format enum with its default. Per calibration rules, the baseline is 3 when the schema covers everything. The description itself adds no parameter-level insight, which is acceptable at this coverage level.

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

Purpose4/5

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

The opening sentence 'Search federal datasets matching a query string' uses a specific verb and resource, so an agent immediately knows what the tool does. The remaining stub text is implementer-oriented but does not obscure the purpose. It earns a 4 because it's clear on function, though the nonsensical stub placeholder text prevents a 5.

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool versus alternatives, what input it expects conceptually (beyond schema), or any prerequisites or limitations. The stub text discusses implementation ('Swap the body for an actual request') rather than agent-facing usage. While the absence of sibling tools lowers the need for differentiation, the description still provides no real usage context.

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 observedexample_search_datasets

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no possibility of confusion or overlap. The sole tool has a clear, singular purpose.

Naming Consistency5/5

With a single tool, there is no inconsistency in naming conventions. The name follows a verb_noun pattern (search_datasets).

Tool Count1/5

A single stub tool is a trivial surface for a server, far below the typical 3-15 tool range. It does not constitute a meaningful tool set.

Completeness1/5

The server is explicitly a stub with no real functionality, offering only a placeholder search. It has no coverage of any actual domain or workflow.

Maintenance

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A basic MCP server template that provides a foundation for building custom tools, resources, and prompts. Serves as a starting point for developers to create their own MCP server functionality.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A foundational template for building MCP servers in Python using Streamable HTTP transport. Provides example implementations of tools, resources, and prompts to help developers create custom MCP integrations for AI assistants.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal template MCP server demonstrating basic tools, resources, and prompts functionality. Includes example implementations like a hello tool, history resource, and greet prompt for learning MCP development.
    0
    ISC