Skip to content

Conversation

@dgenio
Copy link

@dgenio dgenio commented Dec 1, 2025

Summary

This PR addresses #235 by providing comprehensive documentation and examples for creating adapters that convert MCP tool schemas to various LLM provider formats (Gemini, OpenAI, Claude).

Changes

  • New documentation page (docs/llm-adapters.md): Comprehensive guide covering:

    • Basic adapter patterns
    • Complete implementations for Gemini, OpenAI, and Anthropic Claude
    • Advanced schema transformations (nested objects, arrays, enums)
    • Error handling patterns
    • Best practices
  • Runnable example (examples/snippets/clients/llm_adapter_example.py): Demonstrates:

    • Connecting to MCP servers
    • Listing and converting tools
    • Batch conversion with error handling
    • Validation utilities
  • Documentation updates: Added references in:

    • docs/index.md - Getting Started section
    • README.md - Advanced Usage and Documentation sections
    • mkdocs.yml - Navigation menu

Design Decision

Following maintainer feedback, this PR provides documentation and examples rather than official adapter utilities. This approach:

  • Makes it easy for developers to create adapters
  • Avoids maintenance burden of third-party SDK dependencies
  • Provides clear patterns and best practices
  • Includes working examples for all three major providers

Testing

  • ✅ All files pass linting (ruff, pyright)
  • ✅ Documentation follows mkdocs format
  • ✅ Example script is registered and runnable
  • ✅ No breaking changes (documentation only)

Related

Closes #235

dgenio and others added 10 commits December 1, 2025 13:29
- Add comprehensive guide for converting MCP tools to LLM provider formats
- Include adapter implementations for Gemini, OpenAI, and Claude
- Add runnable example demonstrating all three adapters
- Addresses modelcontextprotocol#235
- Add link in docs/index.md Getting Started section
- Add entry in mkdocs.yml navigation
- Add reference in README.md Advanced Usage section
- Register example script in pyproject.toml
- Remove emojis from example file to fix encoding issues
- Simplify README snippet to use snippet-source marker
- Add missing newlines at end of files
- Fixes linting errors in README snippet
- Remove null bytes and extra newlines from files
- Ensure files end with exactly one newline
- Fix UTF-8 encoding issues in example file
- Remove emoji character that was causing encoding issues
- Ensure proper UTF-8 encoding throughout file
- Add provider names to duplicate headings (Basic Implementation, Usage Example)
- Fixes MD024/no-duplicate-heading markdownlint errors
- Use Callable from collections.abc instead of lowercase callable
- Remove unnecessary isinstance check (dict[str, Any] is always dict)
- Add explicit type annotations for variables to satisfy pyright
@dgenio dgenio marked this pull request as ready for review December 1, 2025 17:09
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.

Official Adapter Functions for LLM Providers in MCP Python SDK

1 participant