How Applications connect to MCP servers — CharmIQ's built-in servers, Organization-defined servers, and explicit connections.
|
|
connect() step.listServers() and connects using their platform-assigned ID. The URL, authentication, and tool permissions are all managed at the Organization level — your Application just uses them.listServers() returns everything: CharmIQ servers and any Organization-defined servers your admin has configured.const servers = await window.charmiq.mcp.listServers(); // Every server descriptor: // { id, name, isPlatform, allowedTools? } const platformServers = servers.filter(s => s.isPlatform); const orgServers = servers.filter(s => !s.isPlatform);
isPlatform: true and are always present. Organization-defined servers have an allowedTools array when the admin has restricted which tools are accessible — if it's absent, all tools are permitted.connect() call needed. Use the server name as the alias directly.// List what's available on a platform server const tools = await window.charmiq.mcp.listTools('vfs'); // Call a tool const result = await window.charmiq.mcp.callTool('vfs', 'search_documents', { query: 'Q3 budget', limit: 10, });
'vfs' | |
'agent' | |
'chat' | |
'collection' | |
'docs' | |
'generation' | |
'usage' | |
'echo' |
// 1. Discover const servers = await window.charmiq.mcp.listServers(); const bq = servers.find(s => s.name.includes('BigQuery')); // 2. Connect — first argument is your local alias await window.charmiq.mcp.connect('bigquery', { mcpServerId: bq.id }); // 3. List tools (filtered by Organization's allowedTools) const tools = await window.charmiq.mcp.listTools('bigquery'); // 4. Call const result = await window.charmiq.mcp.callTool('bigquery', 'execute_sql', { query: 'SELECT * FROM `project.dataset.orders` WHERE status = "open" LIMIT 50', }); // 5. Disconnect when done await window.charmiq.mcp.disconnect('bigquery');
'bigquery' in this example) is a name you choose. You use it in all subsequent calls until you disconnect.await window.charmiq.mcp.connect('gh', { url: 'https://github.com/mcp', transport: 'proxy', auth: { type: 'oauth', providerUrl: 'https://github.com', scopes: ['repo:read'], }, });
await window.charmiq.mcp.connect('local', { url: 'http://localhost:8080/mcp', transport: 'direct', auth: { type: 'none' }, });
'direct' | |
'proxy' |
callTool() returns the same structure:type McpToolCallResult = { content: Array<{ type: string; text: string }>; structuredContent?: unknown; isError?: boolean; };
const result = await window.charmiq.mcp.callTool('bigquery', 'execute_sql', { query }); if (result.isError) { console.error('Tool error:', result.content[0].text); return; } const rows = JSON.parse(result.content[0].text); renderTable(rows);
allowedTools restriction set by your admin. If allowedTools is ['execute_sql'], your Application cannot call any other tool on that server regardless of what the MCP server advertises. listTools() already returns only the permitted tools — you don't need to filter manually.listServers() to find Organization-defined MCP servers. Their IDs may change when an admin recreates a server definition. Names are more stable.'vfs', run Charm completions via 'agent', or generate content via 'generation' — no admin configuration required.window.charmiq.mcp reference.