A high-performance Go implementation of a bridge connecting Model Context Protocol (MCP) servers to LLMs like Ollama. This bridge enables seamless integration between language models and external tools and data sources.
This is very much ALPHA quality software, perhaps not even that. It's something I hacked up in a day to get a proof of concept working.
Note: The flagrant abuse of emojis is thanks to the AI that wrote this readme π
- π Full MCP protocol support via mcp-go
- π οΈ Multiple built-in tools (Database, HTTP, Filesystem, Time)
- πΎ SQLite database integration
- π Goroutine leak detection
- π Interactive CLI and HTTP server modes
- β‘ Efficient error handling with proper types
- π Safe configuration management
- π§© Extensible tool system
- π Multi-server support with dynamic tool discovery
- π Bybit cryptocurrency exchange integration
# Using go install
go install github.com/sammcj/gomcp/cmd/gomcp@latest
# Or clone and build
git clone https://github.com/sammcj/gomcp.git
cd gomcp
make build
- Initialise configuration:
gomcp -init
This creates a default configuration file at ~/.config/gomcp/config.yaml
.
- Edit the configuration file to match your setup. Here's an example with multiple MCP servers:
llm:
model: "qwen2.5-coder-7b-instruct-128k:q6_k" # Your Ollama model
endpoint: "http://localhost:11434/api"
api_key: "" # Optional
system_prompt: |
You are a helpful assistant with access to various tools.
[Tools]
When using the database tool:
1. Use exact column names from the schema
2. Write valid SQL queries
3. Remember this is SQLite
When using bybit tools:
1. All amounts are in USD
2. Follow proper position sizing and risk management
3. Always verify order details before execution
mcp_servers:
- name: "sqlite"
command: "uvx"
arguments:
- "mcp-server-sqlite"
- "--db-path"
- "test.db"
- name: "bybit"
command: "/bin/sh"
arguments:
- "-c"
- "cd /path/to/bybit-mcp && pnpm run serve" # Replace with your bybit-mcp path
env:
BYBIT_API_KEY: "" # Add your Bybit API **READ ONLY** key here
BYBIT_API_SECRET: "" # Add your Bybit API **READ ONLY** secret here
BYBIT_USE_TESTNET: "true" # Set to false for production
database:
path: "test.db"
logging:
level: "info"
format: "text"
server:
enable: false
host: "localhost"
port: 8080
- Run in interactive mode:
gomcp
- Run as a server:
gomcp -server
$ gomcp
MCP LLM Bridge
Type 'quit' or press Ctrl+C to exit
Enter your message: What tables are available in the database?
Response: Let me query the database schema for you...
[Database schema information follows]
Enter your message: Show me the current BTC/USD price on Bybit
Response: I'll fetch the current price from Bybit...
[Price information follows]
Start the server:
gomcp -server
Make requests:
# Send a chat message
curl -X POST http://localhost:8080/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "What are the most expensive products?"}'
# Check server health
curl http://localhost:8080/health
- Executes SQL queries against SQLite databases
- Read-only operations (SELECT queries only)
- Automatic schema detection
- Makes HTTP requests to allowed domains
- Supports GET, POST, PUT, DELETE methods
- Domain allowlist for security
- List directory contents
- Read file contents
- Check file existence
- Get file information
- Path restrictions for security
- Get current time
- Parse timestamps
- Format times
- Compare timestamps
The following tools are available when the bybit-mcp server is configured:
-
get_ticker
: Get real-time ticker information for a trading pair (e.g., "BTCUSDT"){ "name": "get_ticker", "arguments": { "symbol": "BTCUSDT", "category": "spot" } }
-
get_orderbook
: Get orderbook (market depth) data for a trading pair{ "name": "get_orderbook", "arguments": { "symbol": "BTCUSDT", "category": "spot", "limit": 25 } }
-
get_kline
: Get kline/candlestick data for a trading pair{ "name": "get_kline", "arguments": { "symbol": "BTCUSDT", "category": "spot", "interval": "1" } }
-
get_market_info
: Get detailed market information for trading pairs -
get_trades
: Get recent trades for a trading pair -
get_instrument_info
: Get detailed instrument information for a specific trading pair -
get_wallet_balance
: Get wallet balance information for the authenticated user -
get_positions
: Get current positions information for the authenticated user -
get_order_history
: Get order history for the authenticated user
Common Parameters:
symbol
: Trading pair in the format "BTCUSDT", "ETHUSDT", etc.category
: Market category, usually "spot" for spot tradinglimit
: Number of records to return (varies by endpoint)
For detailed usage of each Bybit tool, refer to the bybit-mcp documentation.
- Go 1.23 or later
- SQLite3
- Make
- Node.js and pnpm (for bybit-mcp)
# Build binary
make build
# Run tests
make test
# Run linting
make lint
# Clean build artifacts
make clean
The bridge supports multiple MCP servers running simultaneously. To add a new server:
- Install the MCP server
- Add the server configuration to
~/.config/gomcp/config.yaml
:
mcp_servers:
- name: "your-server"
command: "/bin/sh" # Use shell for complex commands
arguments:
- "-c"
- "cd /path/to/server && command-to-run"
env:
KEY1: "value1"
KEY2: "value2"
- The bridge will automatically discover and expose the server's tools
Tools can be added by implementing the tool interface:
type Tool interface {
GetToolSpec() mcp.Tool
Execute(params map[string]interface{}) (interface{}, error)
}
The project uses custom error types in the types
package:
ConfigError
for configuration issuesBridgeError
for bridge operationsLLMError
for LLM-related errorsToolError
for tool execution issuesDatabaseError
for database operations
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Run tests (
make test
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Create a Pull Request
- bartolli/mcp-llm-bridge for which I took inspiration
- Model Context Protocol specification
- mcp-go package
- Ollama project