Agent / foldkit-agent-mcp
Sixty seconds: serve a bound runtime
Start with the Agent contract and host guide.
The integration below assumes AssistantAgent is your declared contract and
AgentBuilder is its application-specialized builder. agentRuntime is the
result of binding that contract to your live host and verified principal.
The smallest MCP server is stdio:
import { AgentMcp } from 'foldkit-agent-mcp'
const server = AgentMcp.stdio({ agent: agentRuntime })stdio attaches to the process streams immediately. Retain the returned
handle and call server.close() on application shutdown. Keep application
logs on stderr so stdout remains the MCP protocol stream.
That gives an MCP client the capabilities/resources derived from the same contract used by every other adapter.
For embedding or tests, the protocol mapping is also exposed without a transport:
const served = AgentMcp.handler({
agent: agentRuntime,
onNotification: send,
})
await served.handle({
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
})What the contract becomes
| MCP | foldkit-agent |
|---|---|
tools/list | capabilities currently available in the Model |
tools/call | AgentRuntime dispatch by protocol name |
resources/list / resources/read | named resources plus app://context |
notifications/tools/list_changed | advertised capability set changed |
notifications/cancelled | abort the matching invocation |
The adapter derives input schemas from the capability's Effect Schema. A capability with a completion contract resolves after its correlated success or failure Message; otherwise validated dispatch is the completion boundary.