Skip to content

Commit eaafbbc

Browse files
authored
Merge pull request #5 from Cocoanetics/odrobnik/update-readme
2 parents e570eee + 5bb1a37 commit eaafbbc

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ The included demo application shows how to use SwiftMCP with different transport
3030

3131
```bash
3232
# Using stdio transport
33-
SwiftMCPDemo --transport stdio
33+
SwiftMCPDemo stdio
3434

3535
# Using HTTP+SSE transport
36-
SwiftMCPDemo --transport httpsse --port 8080
36+
SwiftMCPDemo httpsse --port 8080
3737

3838
# Using HTTP+SSE with authorization
39-
SwiftMCPDemo --transport httpsse --port 8080 --token your-secret-token
39+
SwiftMCPDemo httpsse --port 8080 --token your-secret-token
40+
41+
# Using HTTP+SSE with OpenAPI support
42+
SwiftMCPDemo httpsse --port 8080 --openapi
43+
44+
# Using HTTP+SSE with authorization and OpenAPI support
45+
SwiftMCPDemo httpsse --port 8080 --token your-secret-token --openapi
4046
```
4147

4248
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
4551
Authorization: Bearer your-secret-token
4652
```
4753

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+
4858
## Custom Server Implementation
4959

5060
To implement your own MCP server:
@@ -78,6 +88,19 @@ transport.authorizationHandler = { token in
7888
try transport.run()
7989
```
8090

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+
81104
## License
82105

83106
This project is licensed under the BSD 2-clause License - see the LICENSE file for details.

0 commit comments

Comments
 (0)