Skip to content

Add smithy-mcp #402

@jona7o

Description

@jona7o

Goal

Implement an streamable-http endpoint under /mcp as an extension of smithy4play.

every endpoint which is annotated with the mcpTool operation should be added as a tool under /mcp so that an llm can call the endpoint.

An llm should be able to call the endpoint which redirects the tool call to the original rest api together with the header fields like the bearer token.

mcpName overrides the operation name if applied
mcpDescription overrides the operation description if applied
mcpCategories overrides the categories and the default is the filename
mcpParameter contains tool information

Example:
if there is a /user/$id get endpoint which is annotated a llm can call this endpoint through the /mcp endpoint which internally reroutes to the correct endpoint which is descriped by the original smithy file.

more info

  • write high quality code in the same style the repo contains and just add code is needed.
  • validate everything and write tests
  • add a markdown section for mcp

mcp.smithy

https://github.com/innFactory/smithy-mcp/blob/main/model/de/innfactory/mcp/mcp.smithy

$version: "2.0"

namespace de.innfactory.mcp

@trait(selector: "operation")
structure mcpTool {}

@trait(selector: "operation")
string mcpName

@trait(selector: "operation")
string mcpDescription

@trait(selector: "operation")
list mcpCategories {
    member: String
}

@trait(selector: "operation")
string mcpVersion

@trait(selector: "member")
structure mcpParameter {
    example: Document
}

@trait(selector: "operation")
list mcpExamples {
    member: Example
}

structure Example {
    @required
    title: String

    @required
    input: Document

    @required
    output: Document
}

Metadata

Metadata

Assignees

Labels

featureNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions