Skip to content

x/pkgsite: remote MCP support  #75857

@H0llyW00dzZ

Description

@H0llyW00dzZ

What is the URL of the page with the issue?

https://pkg.go.dev/

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Screenshot

No response

What did you do?

If possible, it would be beneficial to implement MCP (Model Context Protocol) support similar to gopls for pkg.go.dev. This would make integration with AI tools significantly easier, especially for learning and reading Go documentation through https://pkg.go.dev/.

What did you see happen?

Currently, pkg.go.dev does not expose an MCP server interface. While the website provides excellent documentation through its web interface, there is no programmatic way for AI tools to:

  • Query package information via MCP protocol
  • Retrieve documentation in a structured format for AI consumption
  • Access code examples and API references through standardized MCP tools
  • Integrate with AI coding assistants like those supporting gopls MCP

This limitation means developers using AI-assisted tools must manually copy documentation or rely on potentially outdated information embedded in AI training data.

What did you expect to see?

An MCP server implementation for pkg.go.dev that provides:

Core MCP Tools:

  1. search_packages - Search for Go packages by name or description

    {
      "name": "search_packages",
      "description": "Search for Go packages on pkg.go.dev",
      "inputSchema": {
        "query": "string",
        "limit": "number (optional)"
      }
    }
  2. get_package_doc - Retrieve complete package documentation

    {
      "name": "get_package_doc",
      "description": "Get documentation for a specific package",
      "inputSchema": {
        "import_path": "string",
        "version": "string (optional)"
      }
    }
  3. get_symbol_doc - Get documentation for specific functions, types, or methods

    {
      "name": "get_symbol_doc",
      "description": "Get documentation for a specific symbol",
      "inputSchema": {
        "import_path": "string",
        "symbol_name": "string"
      }
    }
  4. get_examples - Retrieve code examples for packages or symbols

    {
      "name": "get_examples",
      "description": "Get code examples from package documentation",
      "inputSchema": {
        "import_path": "string",
        "symbol_name": "string (optional)"
      }
    }
  5. list_versions - List available versions of a package

    {
      "name": "list_versions",
      "description": "List all available versions of a package",
      "inputSchema": {
        "import_path": "string"
      }
    }

Configuration Example:

{
  "mcp": {
    "pkgsite": {
      "type": "remote",
      "url": "https://pkg.go.dev/mcp",
      "enabled": true,
      "options": {
        "cache_duration": "24h",
        "max_results": 50
      }
    }
  }
}

Benefits:

  • Enhanced AI Integration: AI coding assistants can provide accurate, up-to-date Go documentation
  • Improved Developer Experience: Seamless documentation lookup without leaving the development environment
  • Standardized Access: Consistent interface for accessing Go documentation across different AI tools
  • Learning Acceleration: AI tutors can reference official documentation when teaching Go
  • Version-aware Assistance: AI tools can provide version-specific documentation and migration guidance

Implementation Considerations:

  • Follow the MCP specification similar to gopls implementation
  • Implement rate limiting to prevent abuse
  • Support both SSE (Server-Sent Events) and stdio transports
  • Provide caching mechanisms for frequently accessed documentation
  • Maintain compatibility with existing pkg.go.dev infrastructure

Related Work

This feature would position pkg.go.dev as a leader in AI-assisted development tooling and significantly improve the Go learning and development experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.pkgsite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions