JSON-RPC 2.0 MCP (2025-03-26) server & client with homoiconic tool schemas, resources, prompts, stdio transport, and web/App mounting.
Model Context Protocol (2025-03-26) JSON-RPC 2.0 server and client for Veko, featuring homoiconic tool schema generation, NDJSON stdio framing, and mountable Streamable HTTP routes over lib/web.
veko pkg add ai_mcp@1.0.0Import in any Veko module:
use [mcp = ai_mcp]2025-03-26: Implements initialize, notifications/initialized, ping, tools/list, tools/call, resources/list, resources/read, prompts/list, and prompts/get, including JSON-RPC 2.0 batch payloads.-32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, -32603 internal error), whereas recoverable tool runtime err values set isError = true inside the tool result content array per MCP specification.mcp/tool-schema transforms quoted Veko parameter declarations (quote [ query str 'Search query', limit i64 .optional 'Max rows' ]) directly into JSON Schema { type = 'object', properties = ..., required = ... } maps without stringly-typed boilerplate.mcp/handle-jsonrpc-line or mount directly onto any web/App route via mcp/mount-http (POST JSON-RPC + 202 Accepted notifications + GET SSE endpoint discovery).mcp/MCP-PROTOCOL-VERSION -> '2025-03-26'mcp/ERR-PARSE-ERROR (-32700), mcp/ERR-INVALID-REQUEST (-32600), mcp/ERR-METHOD-NOT-FOUND (-32601), mcp/ERR-INVALID-PARAMS (-32602), mcp/ERR-INTERNAL (-32603)McpServer — Stateful MCP server registry (name, version, instructions, tools, resources, prompts).McpTool — Tool metadata and handler (fn [args map] any).McpResource — Resource URI metadata and reader (fn [uri str] any).McpPrompt / McpPromptArg — Prompt template definition and builder (fn [args map] any).McpClient — Multi-transport MCP client handle.mcp/new-server name version [/instructions instr] -> McpServermcp/tool-schema spec_blk -> map (JSON Schema object descriptor)mcp/add-tool mut srv name description input_schema handlermcp/add-resource mut srv uri name description mime_type readermcp/prompt-arg name description required -> McpPromptArgmcp/add-prompt mut srv name description arguments buildermcp/text-content text -> mapmcp/prompt-message role text -> mapmcp/handle-message mut srv msg -> any (response map, batch block, or .none)mcp/handle-jsonrpc-line mut srv line -> strmcp/mount-http mut app route_path srvmcp/new-http-client endpoint_url [/headers extra_headers] -> McpClientmcp/new-app-client app route_path -> McpClientmcp/new-custom-client endpoint transport_fn -> McpClientmcp/client-initialize mut client -> anymcp/client-ping mut client -> anymcp/client-list-tools mut client -> anymcp/client-call-tool mut client name arguments -> anymcp/client-list-resources mut client -> anymcp/client-read-resource mut client uri -> anymcp/client-list-prompts mut client -> anymcp/client-get-prompt mut client name arguments -> anyuse [mcp = ai_mcp, web]
mut srv = mcp/new-server 'repo-assistant' '1.0.0'
schema = mcp/tool-schema (quote [
query str 'Search query',
limit i64 .optional 'Max rows'
])
mcp/add-tool mut srv 'search_docs' 'Search repository documentation' schema fn [args map] any [
q = str/append '' (map/get args 'query')
lim = as-i64 (map/get/or args 'limit' [ 5 ])
`Matched {mold lim} docs for {q}`
]
mut app = web/new-app
mcp/mount-http mut app '/mcp' srv
mut client = mcp/new-app-client app '/mcp'
_ = mcp/client-initialize mut client
res = mcp/client-call-tool mut client 'search_docs' { query = 'concurrency', limit = 3 }
print (json/encode res)https://veko-lang.org/pkg/ai_mcp/1.0.0.vkpa8d05f406b5da2f507a549225777b4bee343fb80eeb0b270309512a74a97bb6d600b309007efd60b4ebfaa3b280e3db4cf327c56e89fd3250c9048f60f606eb1ed25519:27406074d8681da1d4e6420f5d887cac15c313334c249ac047ba9d4e2df72b70{"name":"ai_mcp","version":"1.0.0","tier":3.0,"tier_label":"Tier 3: AI, Vector RAG & DataFrames","category":"Model Context Protocol","description":"JSON-RPC 2.0 MCP (2025-03-26) server & client with homoiconic tool schemas, resources, prompts, stdio transport, and web/App mounting.","modules":["ai_mcp"],"homepage":"https://veko-lang.org/packages/ai_mcp"}| Bundle Entry Path | Size | Leaf SHA-256 Digest |
|---|---|---|
| README.md | 4 KB | b2d1910593ec0691b799da1a0610b4c61baf8ee105c0419f81f76b938f6cc784 |
| examples/demo.vk | 7 KB | 6067a1211b9ae2903242b9b8b4e61f8a7ade2639dffdfeefd20b1eac4b940779 |
| mod.vk | 22 KB | d52f0e9913fee760a7be476086639e53bc49d0f97aa9d55960308da42bd052f8 |