| name | mcp |
| description | Model Context Protocol server management and tool integration |
| emoji | 🔌 |
MCP - Complete API Reference
Manage Model Context Protocol (MCP) servers, external tools, and AI integrations.
Chat Commands
Server Management
/mcp list List configured MCP servers
/mcp status Check server connection status
/mcp add <name> <command> Add new MCP server
/mcp remove <name> Remove MCP server
/mcp restart <name> Restart server
Tool Interaction
/mcp tools List available tools
/mcp tools <server> Tools from specific server
/mcp call <server> <tool> [args] Call a tool directly
/mcp resources <server> List server resources
Configuration
/mcp config <server> View server config
/mcp config <server> set <key> <value> Update config
/mcp logs <server> View server logs
TypeScript API Reference
Create MCP Client
import { createMCPClient } from 'clodds/mcp';
const mcp = createMCPClient({
transport: 'stdio',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-filesystem'],
timeout: 30000,
retries: 3,
});
Connect to Server
await mcp.connect();
const status = mcp.getStatus();
console.log(`Connected: ${status.connected}`);
console.log(`Server: ${status.serverInfo?.name}`);
console.log(`Version: ${status.serverInfo?.version}`);
await mcp.disconnect();
List Tools
const tools = await mcp.listTools();
for (const tool of tools) {
console.log(`${tool.name}: ${tool.description}`);
console.log(` Input schema: ${JSON.stringify(tool.inputSchema)}`);
}
Call Tool
const result = await mcp.callTool({
name: 'read_file',
arguments: {
path: '/path/to/file.txt',
},
});
console.log(`Result: ${JSON.stringify(result)}`);
List Resources
const resources = await mcp.listResources();
for (const resource of resources) {
console.log(`${resource.uri}: ${resource.name}`);
console.log(` Type: ${resource.mimeType}`);
}
const content = await mcp.readResource('file:///path/to/file.txt');
console.log(content);
List Prompts
const prompts = await mcp.listPrompts();
for (const prompt of prompts) {
console.log(`${prompt.name}: ${prompt.description}`);
}
const prompt = await mcp.getPrompt('code-review', {
code: 'function add(a, b) { return a + b; }',
});
console.log(prompt.messages);
MCP Registry
import { createMCPRegistry } from 'clodds/mcp';
const registry = createMCPRegistry({
configPath: './mcp-servers.json',
});
registry.addServer({
name: 'filesystem',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-filesystem', '/home/user'],
env: {},
});
const servers = registry.listServers();
const server = registry.getServer('filesystem');
registry.removeServer('filesystem');
await registry.startAll();
await registry.stopAll();
Popular MCP Servers
| Server | Purpose | Install |
|---|
| filesystem | File operations | @modelcontextprotocol/server-filesystem |
| github | GitHub API | @modelcontextprotocol/server-github |
| postgres | Database queries | @modelcontextprotocol/server-postgres |
| brave-search | Web search | @modelcontextprotocol/server-brave-search |
| puppeteer | Browser automation | @modelcontextprotocol/server-puppeteer |
Server Configuration
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"],
"env": {}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_..."
}
}
}
}
CLI Commands
clodds mcp list
clodds mcp add filesystem "npx -y @modelcontextprotocol/server-filesystem /home"
clodds mcp test filesystem
clodds mcp remove filesystem
Best Practices
- Use official servers — Start with well-tested MCP servers
- Limit file access — Restrict filesystem server to specific directories
- Secure credentials — Use env vars for tokens, not command args
- Monitor logs — Check server logs for errors
- Timeout handling — Set appropriate timeouts for slow operations