HTTP Transport for servers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- swift
- Domain
- networking
Research direction
Start by reading the HTTPClientTransport entry point and the server.start(transport:) call shown in the issue, then compare them with the HTTP SSE protocol requirement. Confirm whether an HTTP SSE server transport is present and determine what is needed for the example server to connect successfully. Done means the requested HTTP transport behavior is implemented or its absence is clearly resolved.
Written by the indexing model from the issue text.
Description
I'm trying to build a very simple MCP Server base on HTTP SSE protocol (not STDIO).
This feature is implemented or not ? The MCP doesn't seem to be connected.
import Foundation
import Logging
// Configure Logger
LoggingSystem.bootstrap { label in
var handler = StreamLogHandler.standardOutput(label: label)
handler.logLevel = .trace
return handler
}
// Create logger
let logger = Logger(label: "com.example.mcp")
let server = Server(
name: "Swift Version Server",
version: "1.0.0",
capabilities: .init(tools: .init(listChanged: false))
)
let transport = HTTPClientTransport(
endpoint: URL(string: "http://localhost:8080")!,
logger:logger
)
try await server.start(transport: transport)
let tool = Tool(name: "swift_version",
description: "Returns the current Swift version",
inputSchema: .object([
"type": .string("object")
]))
await server.withMethodHandler(ListTools.self) { params in
ListTools.Result(tools: [tool])
}
await server.withMethodHandler(CallTool.self) { params in
guard params.name == tool.name else {
throw MCPError.invalidParams("Wrong tool name: \(params.name)")
}
return CallTool.Result(content: [.text(swiftVersion() ?? "No version")])
}
func swiftVersion() -> String? {
let process = Process()
process.executableURL = URL(fileURLWithPath: "/usr/bin/env")
process.arguments = ["swift", "--version"]
let outputPipe = Pipe()
process.standardOutput = outputPipe
do {
try process.run()
process.waitUntilExit()
let data = outputPipe.fileHandleForReading.readDataToEndOfFile()
return String(data: data, encoding: .utf8)
} catch {
return "Error running swift-version: \(error)"
}
}
await server.waitUntilCompleted()
- Dominant language
- Swift
- Stars
- 1.5k
- Forks
- 243
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/swift-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in modelcontextprotocol/swift-sdk
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·