Skip to content

Add initial support for creating and hosting MCP Tools; Add initial support for creating JSON Schema definitions #1668

Merged
Badgerati merged 3 commits intodevelopfrom
mcp-tools
Apr 11, 2026
Merged

Add initial support for creating and hosting MCP Tools; Add initial support for creating JSON Schema definitions #1668
Badgerati merged 3 commits intodevelopfrom
mcp-tools

Conversation

@Badgerati
Copy link
Copy Markdown
Owner

Description of the Change

This adds initial support for creating and host MCP Tools in Pode, as well as utility functions for creating JSON Schema definitions - similar to the existing OpenAPI support.

The MCP Tool support is in the early stages, so could change overtime as further MCP Servers are tested.

Current support for MCP:

  • Hosting a Route to parse requests from MCP Servers - initialize, tools/list, and tools/call
  • Creating MCP Tools via ScriptBlocks - both parameterless and with parameters
  • Assigning Tools into Groups, allowing different Routes to manage different Tools
  • Ability to add parameter definitions via JSON Schema - both manually and automatically
  • JSON RPC error code support for servers

Current JSON Schema support:

  • Types supported: null, string, integer, number, boolean, array, object
  • Property support for objects - to define a name/required for a schema
  • Support for merging schemas into allOf, anyOf, oneOf, and not.
  • (re-usable references currently not implemented)

Examples

Creates and hosts an MCP Tool at http://localhost:8080/mcp, which allows you to ask a connected MCP server Get me all services running on this machine

Start-PodeServer -Threads 2 {
    Add-PodeEndpoint -Address localhost -Port 8080 -Protocol Http

    # Create a simple default group for MCP tools
    Add-PodeMcpGroup -Name 'Default' -Description 'Default group for MCP tools'

    # Add a simple MCP tool for returning windows services names for a given state
    Add-PodeMcpTool -Name 'GetWindowsServicesByState' -Description 'Returns Windows service names for a given state' -Group 'Default' -ScriptBlock {
        param(
            [ValidateSet('Running', 'Stopped', 'Paused')]
            [string]
            $State
        )

        $services = Get-Service -ErrorAction Ignore | Where-Object { $_.Status -ieq $State } | Select-Object Name
        if (($null -eq $services) -or (Test-PodeIsEmpty $services)) {
            $services = "No services found in the '$State' state."
        }

        return New-PodeMcpTextContent -Value $services
    } -PassThru |
        Add-PodeMcpToolProperty -Name 'State' -Required -Definition (
            New-PodeJsonSchemaString -Description 'The state of services to check' -Enum 'Running', 'Stopped', 'Paused'
        )

    # Add the MCP route
    Add-PodeRoute -Method Post -Path '/mcp' -ScriptBlock {
        Resolve-PodeMcpRequest -Group 'Default'
    }
}

@Badgerati Badgerati added this to the 2.13.0 milestone Apr 4, 2026
@Badgerati Badgerati self-assigned this Apr 4, 2026
@Badgerati Badgerati merged commit 292d5e6 into develop Apr 11, 2026
26 checks passed
@Badgerati Badgerati deleted the mcp-tools branch April 11, 2026 10:02
@Badgerati Badgerati mentioned this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant