Skip to content

feat(samples): add an MCP server sample - #94

Open
hilariie wants to merge 1 commit into
feat/mcp-server-stdiofrom
feat/mcp-server-sample
Open

hilariie wants to merge 1 commit into
feat/mcp-server-stdiofrom
feat/mcp-server-sample

Conversation

@hilariie

Copy link
Copy Markdown
Contributor

Summary

Adds samples/mcp-server-hello, the sample slice of the MCP server. A bookshop app with three tools is served over stdio with create_mcp_server, and src/client.py drives it with the MCP SDK's own client, so it needs no API key.

  • Each tool takes a Pydantic model, since MCP arguments are always an object.
  • search_books and check_stock return models, so they advertise an output schema and answer with structured content. opening_hours returns text.
  • check_stock raises a PublicError for a title the shop does not carry, which reaches the client as an error result with its status and message.
  • The tests launch the real server and drive it with the SDK client.

Part of #91. Stacked on #93.

Verification

  • uv run src/client.py prints the output shown in the README.
  • uv run pytest samples/mcp-server-hello --no-cov passes, including on Python 3.10.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant