mcp-opencode

mcp-opencode

Enables querying a local PostgreSQL database via MCP tools, such as testing connection and listing clients.

Category
Visit Server

README

MCP PostgreSQL para OpenCode

Servidor MCP local em Node.js conectado a um PostgreSQL local em Docker e configurado para uso no OpenCode.

Arquitetura

mcp6/
├── src/
│   ├── db.js
│   └── index.js
├── scripts/
│   ├── test-db.js
│   └── test-mcp.js
├── .env.example
├── .gitignore
├── compose.yaml
├── opencode.json
├── package.json
└── README.md

src/db.js carrega o .env e cria o pool de conexão PostgreSQL.

src/index.js cria o servidor MCP via stdio e registra as ferramentas.

compose.yaml sobe o PostgreSQL local na porta 5466.

opencode.json registra o MCP postgres-local no OpenCode.

Ferramentas MCP

testar_conexao_postgres: executa SELECT NOW(), current_database(), current_user.

listar_clientes: lista clientes da tabela clientes, com parâmetro opcional limite.

Configuração

Diretório: raiz do projeto.

npm install
cp .env.example .env
chmod 600 .env
docker compose up -d

O .env.example usa estes valores locais:

PGHOST=localhost
PGPORT=5466
PGDATABASE=mcp_demo
PGUSER=mcp_user
PGPASSWORD=mcp_password

Preparar Dados De Teste

Diretório: raiz do projeto.

PGPASSWORD=mcp_password psql -h localhost -p 5466 -U mcp_user -d mcp_demo -c "CREATE TABLE IF NOT EXISTS clientes (id SERIAL PRIMARY KEY, nome TEXT NOT NULL, email TEXT NOT NULL UNIQUE, criado_em TIMESTAMP NOT NULL DEFAULT NOW()); INSERT INTO clientes (nome, email) VALUES ('Ana Silva', 'ana@example.com'), ('Bruno Souza', 'bruno@example.com'), ('Carla Lima', 'carla@example.com') ON CONFLICT (email) DO NOTHING; SELECT id, nome, email, criado_em FROM clientes ORDER BY id;"

Testes

Diretório: raiz do projeto.

npm run test:db
npm run test:mcp
opencode mcp list
npm run inspect

Inspector CLI

Se a CLI do Inspector falhar com erro de cli/package.json, execute os comandos a partir de outro diretório e use caminhos absolutos:

Diretório: /tmp/opencode

/home/leonardo/mcp6/node_modules/.bin/mcp-inspector node /home/leonardo/mcp6/src/index.js --cli --method tools/list
/home/leonardo/mcp6/node_modules/.bin/mcp-inspector node /home/leonardo/mcp6/src/index.js --cli --method tools/call --tool-name listar_clientes --tool-arg limite=3

OpenCode

O OpenCode carrega a configuração do arquivo opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "postgres-local": {
      "type": "local",
      "command": ["node", "src/index.js"],
      "enabled": true
    }
  }
}

Depois de alterar opencode.json, reinicie o OpenCode para a nova configuração ser carregada.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured