Skip to content

MCP Examples

This page contains example configurations for popular MCP servers. Use these as templates for your own ~/.cosine/mcp.json file.

Grant Cosine read/write access to specific directories:

{
"mcpServers": {
"documents": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/pz/Documents"]
},
"projects": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/pz/projects", "/Users/pz/work"]
}
}
}

Connect to GitHub’s API for repository operations:

{
"mcpServers": {
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
}
}
}
}
VariableDescription
GITHUB_PERSONAL_ACCESS_TOKENGitHub personal access token with appropriate scopes

Query PostgreSQL databases directly:

{
"mcpServers": {
"postgres": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:pass@localhost/mydb"]
}
}
}

Access SQLite databases:

{
"mcpServers": {
"sqlite": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db"]
}
}
}

Send messages and interact with Slack channels:

{
"mcpServers": {
"slack": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-token",
"SLACK_TEAM_ID": "T123456"
}
}
}
}

Configure multiple MCP servers for different purposes:

{
"mcpServers": {
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/pz/projects"]
},
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token"
}
},
"slack": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-token",
"SLACK_TEAM_ID": "T123456"
}
}
}
}

Enable web search capabilities:

{
"mcpServers": {
"brave-search": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "your_brave_api_key"
}
}
}
}

Make HTTP requests to any URL:

{
"mcpServers": {
"fetch": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-fetch"]
}
}
}

Control browsers programmatically:

{
"mcpServers": {
"puppeteer": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}

Perform Git operations on local repositories:

{
"mcpServers": {
"git": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-git"]
}
}
}

For better security, you can reference environment variables in your config:

{
"mcpServers": {
"github": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}

Then export the variables in your shell:

Terminal window
export GITHUB_TOKEN=ghp_your_token
export DATABASE_URL=postgresql://user:pass@localhost/mydb
cos start

Connect to an MCP server running as a web service:

{
"mcpServers": {
"remote-api": {
"transport": "streamable",
"url": "http://localhost:3000/mcp"
}
}
}

This is useful for:

  • Connecting to MCP servers running in Docker containers
  • Using MCP servers deployed on internal infrastructure
  • Developing and testing custom MCP servers