You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using HTTP+SSE transport with the `--token` option, clients must include an Authorization header with their requests:
@@ -45,6 +51,10 @@ When using HTTP+SSE transport with the `--token` option, clients must include an
45
51
Authorization: Bearer your-secret-token
46
52
```
47
53
54
+
## OpenAPI support
55
+
56
+
The `--openapi` option enables OpenAPI endpoints for AI plugin integration. When this option is used, the server will provide an OpenAPI specification at `/openapi.json` and an AI plugin manifest at `/.well-known/ai-plugin.json`. This allows for easy integration with AI models and other tools that support OpenAPI.
57
+
48
58
## Custom Server Implementation
49
59
50
60
To implement your own MCP server:
@@ -78,6 +88,19 @@ transport.authorizationHandler = { token in
78
88
try transport.run()
79
89
```
80
90
91
+
## Documentation Extraction
92
+
93
+
The `@MCPServer` and `@MCPTool` macros extract documentation comments to describe class, parameters and return value.
94
+
95
+
## Macros Functionality
96
+
97
+
The macros in this repository provide functionality for defining and exposing tools and servers in the SwiftMCP framework. Here are the main functionalities of the macros:
98
+
99
+
*`@MCPServer`: This macro is used to define a class or actor as an MCP server. It extracts documentation comments to describe the class, parameters, and return values. An example of its usage can be seen in the `Demos/SwiftMCPDemo/Calculator.swift` file, where the `Calculator` actor is annotated with `@MCPServer(name: "SwiftMCP Demo")`.
100
+
*`@MCPTool`: This macro is used to define functions within an MCP server that can be called as tools. It also extracts documentation comments to describe the function, parameters, and return values. Examples of its usage can be seen in the `Demos/SwiftMCPDemo/Calculator.swift` file, where various functions such as `add`, `subtract`, `testArray`, `multiply`, `divide`, `greet`, `ping`, and `noop` are annotated with `@MCPTool`.
101
+
102
+
These macros help in automatically generating the necessary metadata and documentation for the MCP server and its tools, making it easier to expose them for JSON-RPC communication and integration with AI models.
103
+
81
104
## License
82
105
83
106
This project is licensed under the BSD 2-clause License - see the LICENSE file for details.
0 commit comments