llm-mcp
About
A Ruby gem for integrating Large Language Models (LLMs) via the Model Context Protocol (MCP) into development workflows.
Details
- Author
- parruda
- Categories
- Developer Tools, AI
Jump to
Setup
Install llm-mcp in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/parruda/llm-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
A Ruby gem that exposes Large Language Models (LLMs) via the Model Context Protocol (MCP), enabling seamless integration of AI capabilities into your development workflow.
llm-mcp creates an MCP server that provides standardized access to various LLM providers (OpenAI, Google Gemini, and OpenAI-compatible APIs) while supporting advanced features like session management, conversation persistence, and integration with external MCP tools.
- π€Multi-Provider Support: Works with OpenAI, Google Gemini, and any OpenAI-compatible API
- π¬Session Management: Persist conversations across server restarts
- π§MCP Tool Integration: Connect to external MCP servers and use their tools within LLM conversations
- πComprehensive Logging: JSON-formatted logs for debugging and analysis
- πExtensible Architecture: Easy to add new providers and customize behavior
- πBuilt on FastMCP: Leverages the fast and efficient MCP server framework
Add this line to your application's Gemfile:
Set up your API keys based on the provider you want to use:
# For OpenAI export OPENAI_API_KEY="your-openai-api-key" # For Google Gemini export GEMINI_API_KEY="your-gemini-api-key" # or export GOOGLE_API_KEY="your-google-api-key"
Start an MCP server that exposes an LLM:
# Using OpenAI llm-mcp mcp-serve --provider openai --model gpt-4 # Using Google Gemini llm-mcp mcp-serve --provider google --model gemini-1.5-flash # Using a custom OpenAI-compatible API llm-mcp mcp-serve --provider openai --model llama-3.1-8b --base-url https://api.groq.com/openai/v1
llm-mcp mcp-serve \ --provider openai \ --model gpt-4 \ --verbose \ # Enable verbose logging --json-log-path logs/llm.json \ # Log to JSON file --session-id my-project \ # Resume a specific session --session-path ~/my-sessions \ # Custom session storage location --append-system-prompt "You are a Ruby expert" \ # Add to system prompt --skip-model-validation # Skip model name validation
llm-mcp can connect to other MCP servers, allowing the LLM to use their tools:
- Create an MCP configuration file (e.g.,~/.mcp/config.json):
{ "mcpServers": { "filesystem": { "command": "npx", "args": ["@modelcontextprotocol/server-filesystem", "/tmp"] }, "github": { "command": "mcp-github", "env": { "GITHUB_TOKEN": "your-github-token" } }, "http-api": { "url": "https://api.example.com/mcp/sse", "transport": "sse", "headers": { "Authorization": "Bearer your-token" } } } }
llm-mcp mcp-serve \ --provider openai \ --model gpt-4 \ --mcp-config ~/.mcp/config.json
Now the LLM can use tools from the connected MCP servers in its responses!
Send a request to the LLM and get a response.
- prompt(required): The message or question for the LLM
- temperature(optional): Control randomness (0.0-2.0, default: 0.7)
- max_tokens(optional): Maximum response length
{ "method": "tools/call", "params": { "name": "task", "arguments": { "prompt": "Explain the concept of dependency injection", "temperature": 0.7, "max_tokens": 500 } } }
Clear the conversation history and start fresh.
{ "method": "tools/call", "params": { "name": "reset_session", "arguments": {} } }
Sessions automatically persist conversations to disk, allowing you to:
- Resume previous conversations
- Maintain context across server restarts
- Track token usage over time
Sessions are stored in~/.llm-mcp/sessions/by default, with each session saved as a JSON file.
- Message history (user, assistant, and system messages)
- Timestamps for each interaction
- Token usage statistics
- Session metadata
Enable JSON logging for comprehensive debugging:
llm-mcp mcp-serve \ --provider openai \ --model gpt-4 \ --json-log-path logs/llm.json \ --verbose
- All requests and responses
- Tool calls and their results
- Session operations
- Error messages and stack traces
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{ "mcpServers": { "llm-mcp": { "command": "llm-mcp", "args": ["mcp-serve", "--provider", "openai", "--model", "gpt-4"], "env": { "OPENAI_API_KEY": "your-api-key" } } } }
require 'mcp-client' client = MCP::Client.new client.connect_stdio('llm-mcp', 'mcp-serve', '--provider', 'openai', '--model', 'gpt-4') # Use the task tool response = client.call_tool('task', { prompt: "Write a haiku about Ruby programming", temperature: 0.9 }) puts response.content
Create a powerful AI assistant by combining llm-mcp with other MCP servers:
{ "mcpServers": { "llm": { "command": "llm-mcp", "args": ["mcp-serve", "--provider", "openai", "--model", "gpt-4", "--mcp-config", "mcp-tools.json"] }, "filesystem": { "command": "mcp-filesystem", "args": ["/project"] }, "git": { "command": "mcp-git" } } }
After checking out the repo, runbin/setupto install dependencies. Then, runrake testto run the tests.
# Install dependencies bundle install # Run tests bundle exec rake test # Run linter bundle exec rubocop -A # Install gem locally bundle exec rake install
Bug reports and pull requests are welcome on GitHub athttps://github.com/parruda/llm-mcp.
The gem is available as open source under the terms of the MIT License.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
next-devtools-mcp is a MCP server that provides Next.js development tools and utilities for AI coding assistants like Claude and Cursor.
Word search, crossword, and sudoku generator MCP server with printable PDF worksheets, themed word banks, and verifiable LLM evals. Local-first, from the makers of puzzletide.com.
A demonstration server for ActionKit, providing access to Slack actions via Claude Desktop.
MCP server that lets Claude Code agents delegate tasks to agents in other project directories, with parallel dispatch, sessions, and async jobs.
Statistical regression testing for LLM agents: p-value, effect size, and CI on behavior change.
A Python MCP package that gives your LLM agents complete file system and shell capabilities β production-ready, sandboxed, and wired to any LLM in minutes.
Integrates with Google AI Studio/Gemini API for PDF to Markdown conversion and content generation.
Anchor Browser (https://anchorbrowser.io) is secure infrastructure for computer-use agents β stealth cloud browsers, authentication, captcha bypass, and a hosted MCP server for Cursor, Claude, and Windsurf.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




