Version: 0.9.1
date : 2025/10/16
GoLang remoto MCP Server , example
| // app/lib/RpcClient.ts | |
| import { spawn } from "child_process"; | |
| class RpcClient { | |
| constructor(command: any) { | |
| /* @ts-ignore */ | |
| this.proc = spawn(command); | |
| /* @ts-ignore */ | |
| this.idCounter = 1; | |
| /* @ts-ignore */ |
| /** | |
| * Cloudflare Workers - MCP Server with JSON-RPC 2.0 | |
| * Model Context Protocol Remote Server Implementation | |
| */ | |
| export default { | |
| async fetch(request, env, ctx) { | |
| // CORS headers | |
| const corsHeaders = { | |
| 'Access-Control-Allow-Origin': '*', |
| const start = async function() { | |
| try{ | |
| const item = { | |
| "jsonrpc": "2.0", | |
| "method": "tools/list", | |
| "id": 2 | |
| } | |
| const response = await fetch("http://localhost:3000/mcp", { |
| [package] | |
| name = "rust_remoto_mcp_1" | |
| version = "0.1.0" | |
| edition = "2024" | |
| [dependencies] | |
| anyhow = "1.0.100" | |
| axum = "0.7.5" | |
| axum-extra = { version = "0.10.1", features = ["cookie"] } | |
| chrono = { version = "0.4", features = ["serde"] } |
| const start = async function() { | |
| try{ | |
| const item = { | |
| "jsonrpc": "2.0", | |
| "method": "tools/list", | |
| "id": 1 | |
| } | |
| const response = await fetch("http://localhost:3000/mcp", { | |
| method: 'POST', |
| import { spawn } from "child_process"; | |
| class RpcClient { | |
| constructor(command) { | |
| this.proc = spawn(command); | |
| this.idCounter = 1; | |
| this.pending = new Map(); | |
| this.proc.stdout.setEncoding("utf8"); | |
| this.proc.stdout.on("data", (data) => this._handleData(data)); |
| import { spawn } from "child_process"; | |
| class RpcClient { | |
| constructor(command) { | |
| this.proc = spawn(command); | |
| this.idCounter = 1; | |
| this.pending = new Map(); | |
| this.proc.stdout.setEncoding("utf8"); | |
| this.proc.stdout.on("data", (data) => this._handleData(data)); |
| [package] | |
| name = "hello" | |
| version = "0.1.0" | |
| edition = "2024" | |
| [dependencies] | |
| anyhow = "1.0.100" | |
| argon2 = "0.4" # Argon2 実装(PHC 文字列サポート) | |
| rand_core = "0.6" # Salt 生成に OsRng を使うため | |
| password-hash = { version = "0.5.0", features = ["getrandom"] } |
| [package] | |
| name = "rust_mcp_server_1" | |
| version = "0.1.0" | |
| edition = "2024" | |
| [dependencies] | |
| serde = { version = "1.0", features = ["derive"] } | |
| serde_json = "1.0" |