{"id":27147330,"url":"https://github.com/rggh/rig-mcp-server","last_synced_at":"2025-04-10T01:12:55.907Z","repository":{"id":286697863,"uuid":"962255981","full_name":"RGGH/rig-mcp-server","owner":"RGGH","description":"Rig MCP Server Example (April 7, 2025)","archived":false,"fork":false,"pushed_at":"2025-04-09T14:02:28.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:12:55.822Z","etag":null,"topics":["mcp-server","rig","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RGGH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-07T22:12:58.000Z","updated_at":"2025-04-09T14:02:33.000Z","dependencies_parsed_at":"2025-04-07T23:24:53.256Z","dependency_job_id":"3a953d1d-4a1e-40f4-a9ee-5f5127e733ee","html_url":"https://github.com/RGGH/rig-mcp-server","commit_stats":null,"previous_names":["rggh/rig-mcp-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGGH%2Frig-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGGH%2Frig-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGGH%2Frig-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGGH%2Frig-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RGGH","download_url":"https://codeload.github.com/RGGH/rig-mcp-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp-server","rig","rust"],"created_at":"2025-04-08T11:25:48.981Z","updated_at":"2025-04-10T01:12:55.882Z","avatar_url":"https://github.com/RGGH.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Rust](https://github.com/RGGH/rig-mcp-server/actions/workflows/rust.yml/badge.svg)](https://github.com/RGGH/rig-mcp-server/actions/workflows/rust.yml)\n# 🔍 Rust MCP Server + Inspector Example: SSE Transport with an Add Tool\n\ncredit : https://dev.to/joshmo_dev/using-model-context-protocol-with-rig-m7o\n\nThis project demonstrates how to set up an MCP (Model Context Protocol) server and client using Server-Sent Events (SSE) for communication. It includes a simple tool that adds two numbers and integrates with the [RIG](https://github.com/modelcontext/rig) agent for LLM prompting.\n\n---\n\n## 🚀 Getting Started\n\nClone this repo and run with:\n\n```bash\ncargo run\n```\n\nIn a separate terminal start the MCP Inspector with:\n\n```bash\nnpx @modelcontextprotocol/inspector sse http://127.0.0.1:3001/sse\n```\n\nYou'll see output like:\n\n```\nStarting MCP inspector...\nProxy server listening on port 3000\nNew SSE connection\nQuery parameters: { transportType: 'sse', url: 'http://localhost:3001/sse' }\nSSE transport: url=http://localhost:3001/sse, headers=\nConnected to SSE transport\nConnected MCP client to backing server transport\nCreated web app transport\nSet up MCP proxy\n🔍 MCP Inspector is up and running at http://localhost:5173 🚀\n```\n\nYou can now view the web interface at [http://localhost:5173](http://localhost:5173)\n\n---\n\n## 🛠️ Features\n\n- ✅ Sets up a custom MCP server using `ServerSseTransport`\n- ✅ Connects a MCP client to the server\n- ✅ Registers a custom tool: `AddTool`, which adds two numbers\n- ✅ Lists registered tools via MCP\n- ✅ Integrates with RIG and prompts an LLM agent using the tool\n\n---\n\n## 🧠 Code Overview\n\n```rust\n#[tool(\n    name = \"Add\",\n    description = \"Adds two numbers together.\",\n    params(a = \"The first number to add\", b = \"The second number to add\")\n)]\nasync fn add_tool(a: f64, b: f64) -\u003e Result\u003cToolResponseContent\u003e {\n    Ok(tool_text_content!((a + b).to_string()))\n}\n```\n\nThis defines the `Add` tool that is registered in the MCP server.\n\nThe main function sets up:\n- Tracing\n- The MCP server and transport (SSE)\n- A MCP client that initializes and lists available tools\n- A RIG agent with OpenAI backend, which uses the MCP tool\n\nThe agent then runs a prompt:\n```rust\nlet response = agent.prompt(\"Add 10 + 10\").await;\n```\n\n---\n\n## 🧪 Sample Output\n\nWhen run successfully, you'll see logs like:\n\n```\nInitialized: Ok(...)\nTools: Ok([...])\nBuilding RIG agent\nPrompting RIG agent\nAgent response: Some(\"20\")\n```\n\n---\n\n## 🧰 Tech Stack\n\n- 🦀 Rust with [tokio](https://tokio.rs/)\n- 📡 SSE transport from `mcp_core`\n- 🔧 MCP server/client architecture\n- 🤖 RIG agent with OpenAI model\n- 🌐 MCP Inspector web interface\n\n---\n\n## 📦 Dependencies\n\nMake sure you have these in your `Cargo.toml`:\n\n```toml\n[dependencies]\ntokio = { version = \"1\", features = [\"full\"] }\nanyhow = \"1\"\nserde_json = \"1\"\nmcp_core = \"...\"\nmcp_core_macros = \"...\"\nrig = \"...\"\n```\n\n\u003e Replace `...` with the appropriate versions based on your environment.\n\n---\n\n## 📍 Inspector GUI\n\nVisit [http://localhost:5173](http://localhost:5173) to view and interact with the MCP Inspector UI.\n\n---\n\n## ✅ Test Log Sample\n\n```\nQuery parameters: { transportType: 'sse', url: 'http://localhost:3001/sse' }\nConnected to SSE transport\nConnected MCP client to backing server transport\nSet up MCP proxy\nReceived message for sessionId cdd4a8be-57e2-44e3-9b81-3df300e86f22\n```\n![Screenshot from 2025-04-07 23-22-21](https://github.com/user-attachments/assets/741f033f-7a9e-4d03-bff8-b1547b49fd50)\n\n---\n\n## 📬 Questions or Feedback?\n\nFeel free to open an issue or start a discussion!\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frggh%2Frig-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frggh%2Frig-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frggh%2Frig-mcp-server/lists"}