com.l1fe.forge:forge-mcp
Kotlin/JVM forge-mcp module.
Kotlin/JVM forge-mcp module.
Package contract
| Field | Value |
|---|---|
| Language | kotlin |
| Source version | 0.1.0 |
| Manifest | forge-kt/forge-mcp/build.gradle.kts |
| Source files | 5 |
| Evidence | Source reference; registry publication and runtime conformance are separate checks |
Import boundary
import com.l1fe.forge.mcp.*Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.
Source reference
Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.
com/l1fe/forge/mcp/McpClient.kt
Read declaration text · 7 declaration entries
public class McpClient(
private val transport: McpTransport,
private val telemetry: TelemetryEmitter;
public val isConnected: Boolean get();
public suspend fun connect()
public suspend fun listTools(): List<McpToolDescriptor>
public suspend fun callTool(toolName: String, arguments: JsonObject): List<McpContent>
public suspend fun listResources(): List<McpResource>
public suspend fun disconnect()com/l1fe/forge/mcp/McpError.kt
Read declaration text · 19 declaration entries
public sealed class ForgeMcpError(
message: String,
cause: Throwable?;
public class ConnectionFailed(
public val endpoint: String,
public val reason: String,
cause: Throwable?;
public val endpoint: String,
public val reason: String,
cause: Throwable?;
public val reason: String,
cause: Throwable?;
public class ToolCallFailed(
public val toolName: String,
public val reason: String,
cause: Throwable?;
public val toolName: String,
public val reason: String,
cause: Throwable?;
public val reason: String,
cause: Throwable?;
public class ResourceFailed(
public val resourceUri: String,
public val reason: String,
cause: Throwable?;
public val resourceUri: String,
public val reason: String,
cause: Throwable?;
public val reason: String,
cause: Throwable?;
public class ProtocolError(
public val code: Int,
public val detail: String,
) : ForgeMcpError("MCP protocol error (code $code): $detail")
/**
* The MCP transport layer failed.
*
* @property transport The transport type that failed.
* @property reason The failure reason.
*/
public class TransportError(
public val transport: String,
public val reason: String,
cause: Throwable?;
public val code: Int,
public val detail: String,
) : ForgeMcpError("MCP protocol error (code $code): $detail")
/**
* The MCP transport layer failed.
*
* @property transport The transport type that failed.
* @property reason The failure reason.
*/
public class TransportError(
public val transport: String,
public val reason: String,
cause: Throwable?;
public val detail: String,
) : ForgeMcpError("MCP protocol error (code $code): $detail")
/**
* The MCP transport layer failed.
*
* @property transport The transport type that failed.
* @property reason The failure reason.
*/
public class TransportError(
public val transport: String,
public val reason: String,
cause: Throwable?;
public class TransportError(
public val transport: String,
public val reason: String,
cause: Throwable?;
public val transport: String,
public val reason: String,
cause: Throwable?;
public val reason: String,
cause: Throwable?;
public class HandlerError(
public val handler: String,
public val reason: String,
cause: Throwable?;
public val handler: String,
public val reason: String,
cause: Throwable?;
public val reason: String,
cause: Throwable?;com/l1fe/forge/mcp/McpServer.kt
Read declaration text · 14 declaration entries
public fun interface McpToolHandler
public suspend fun handle(arguments: JsonObject): List<McpContent>
}
/**
* A handler for an MCP resource read.
*/
public fun interface McpResourceHandler
public fun interface McpResourceHandler
public suspend fun handle(uri: String): List<McpContent>
}
/**
* A registered tool on the MCP server.
*/
private data class RegisteredTool(
val descriptor: McpToolDescriptor,
val handler: McpToolHandler,
)
/**
* A registered resource on the MCP server.
*/
private data class RegisteredResource(
val resource: McpResource,
val handler: McpResourceHandler,
)
/**
* An MCP server that exposes tools and resources.
*
* Register tools and resources, then call [handleRequest] to process
* incoming JSON-RPC 2.0 messages.
*
* ANVIL Spec Section 16.4
public class McpServer(
public val serverName: String;
public val serverName: String;
public val serverVersion: String;
public fun registerTool(
name: String,
description: String,
inputSchema: JsonSchema;
public fun registerResource(
uri: String,
name: String,
description: String?;
public suspend fun handleRequest(requestJson: String): String
public val toolCount: Int get();
public val resourceCount: Int get();
public fun listRegisteredTools(): List<McpToolDescriptor> =
public fun listRegisteredResources(): List<McpResource> =com/l1fe/forge/mcp/McpTransport.kt
Read declaration text · 14 declaration entries
public interface McpTransport
public suspend fun send(message: String)
/**
* Receive a JSON-RPC message from the transport.
*
* Suspends until a message is available.
*
* @return The received JSON message.
* @throws ForgeMcpError.TransportError if receiving fails.
*/
public suspend fun receive(): String
/**
* Close the transport connection.
*/
public suspend fun close()
/**
* Whether the transport is currently connected.
*/
public val isConnected: Boolean
}
/**
* Transport configuration.
*
public suspend fun receive(): String
/**
* Close the transport connection.
*/
public suspend fun close()
/**
* Whether the transport is currently connected.
*/
public val isConnected: Boolean
}
/**
* Transport configuration.
*
* @property type The transport type.
* @property command The command to execute (for stdio transport).
* @property args Command arguments (for stdio transport).
* @property url The URL to connect to (for SSE/HTTP transport).
* @property headers Optional HTTP headers (for SSE/HTTP transport).
*/
public data class TransportConfig(
val type: TransportType,
val command: String?;
public suspend fun close()
/**
* Whether the transport is currently connected.
*/
public val isConnected: Boolean
}
/**
* Transport configuration.
*
* @property type The transport type.
* @property command The command to execute (for stdio transport).
* @property args Command arguments (for stdio transport).
* @property url The URL to connect to (for SSE/HTTP transport).
* @property headers Optional HTTP headers (for SSE/HTTP transport).
*/
public data class TransportConfig(
val type: TransportType,
val command: String?;
public val isConnected: Boolean
}
/**
* Transport configuration.
*
* @property type The transport type.
* @property command The command to execute (for stdio transport).
* @property args Command arguments (for stdio transport).
* @property url The URL to connect to (for SSE/HTTP transport).
* @property headers Optional HTTP headers (for SSE/HTTP transport).
*/
public data class TransportConfig(
val type: TransportType,
val command: String?;
public data class TransportConfig(
val type: TransportType,
val command: String?;
public enum class TransportType
public class StdioTransport(
private val command: String,
private val args: List<String>;
public fun start()
public class SseTransport(
private val url: String,
private val headers: Map<String, String>;
public fun connect()
public class HttpTransport(
private val url: String,
private val headers: Map<String, String>;
public fun connect()
public fun createTransport(config: TransportConfig): McpTransport;com/l1fe/forge/mcp/McpTypes.kt
Read declaration text · 11 declaration entries
public data class McpToolDescriptor(
val name: String,
val description: String,
val inputSchema: JsonSchema;
public data class McpResource(
val uri: String,
val name: String,
val description: String?;
public data class McpPrompt(
val name: String,
val description: String?;
public data class McpPromptArgument(
val name: String,
val description: String?;
public data class McpRequest(
val jsonrpc: String;
public data class McpResponse(
val jsonrpc: String;
public data class McpJsonRpcError(
val code: Int,
val message: String,
val data: JsonElement?;
public data class McpCapabilities(
val tools: Boolean;
public data class McpContent(
val type: String;
public fun text(text: String): McpContent;
public fun image(data: String, mimeType: String): McpContent =