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
Copy file name to clipboardExpand all lines: Sources/SwiftMCP/SwiftMCP.docc/SwiftMCP.md
+17-33Lines changed: 17 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,10 @@
1
1
# ``SwiftMCP``
2
2
3
-
A framework for exposing Swift functions as tools that can be called by AI assistants.
3
+
A Swift framework that makes it easy to expose your functions as Model Context Protocol (MCP) tools for AI assistants.
4
4
5
5
## Overview
6
6
7
-
SwiftMCP provides a powerful way to expose Swift functions as tools that can be called by AI assistants. The framework offers:
8
-
9
-
- Documentation-driven tool definitions
10
-
- Multiple transport options (HTTP+SSE, stdio)
11
-
- OpenAPI specification generation
12
-
- AI plugin manifest generation
13
-
14
-
### Documentation-Driven Development
15
-
16
-
Define your tools using Swift's native documentation comments. SwiftMCP automatically extracts descriptions, parameter info, and return types.
17
-
18
-
### Multiple Transport Options
19
-
20
-
Choose between HTTP+SSE for web integration or stdio for command-line tools. Easy to extend with custom transports.
21
-
22
-
### OpenAPI Compatible
23
-
24
-
Automatically generate OpenAPI specifications from your tool definitions for easy integration with existing tools.
25
-
26
-
### AI-Ready Integration
27
-
28
-
Generate AI plugin manifests and function schemas compatible with leading AI platforms.
29
-
30
-
## Getting Started
31
-
32
-
To start using SwiftMCP, first create a server that exposes your tools:
7
+
SwiftMCP lets you turn any Swift function into an MCP tool with just a single decorator. It handles all the complexity of JSON-RPC communication, parameter validation, and documentation generation, letting you focus on writing your tool's logic.
33
8
34
9
```swift
35
10
@MCPServer
@@ -41,13 +16,22 @@ class Calculator {
41
16
}
42
17
```
43
18
44
-
Then choose a transport to expose your server:
19
+
The framework automatically:
20
+
- Extracts documentation from your Swift comments to describe tools
21
+
- Validates and converts parameters to the correct types
22
+
- Generates OpenAPI specifications for AI integration
23
+
- Provides multiple transport options (HTTP+SSE, stdio)
45
24
46
-
```swift
47
-
let calculator =Calculator()
48
-
let transport =HTTPSSETransport(server: calculator)
49
-
tryawait transport.run()
50
-
```
25
+
### Key Features
26
+
27
+
-**Documentation-Driven**: Your standard Swift documentation comments are automatically turned into tool descriptions, parameter info, and return type documentation.
28
+
-**Type-Safe**: All parameters are automatically validated and converted to their correct Swift types.
29
+
-**AI-Ready**: Built-in support for OpenAPI specification generation and AI plugin manifests.
30
+
-**Flexible Transport**: Choose between HTTP+SSE for web applications or stdio for command-line tools.
31
+
32
+
## Next Steps
33
+
34
+
Start with <doc:GettingStarted> to create your first MCP server, then explore <doc:CoreConcepts> to understand how SwiftMCP uses documentation to power AI interactions.
0 commit comments