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' | |
'application' | |
'chat' | |
'collection' | |
'context' | |
'docs' | |
'generation' | |
'git' | |
'usage' | |
'workspace' | |
'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.requestedScopes. An inline Application or a raw Source Application declares the same scopes on its <iframe-app requested-scopes="..."> container.listTools(), callTool() or connect(). Do not derive a scope by prepending mcp. to that alias: mcp.vfs, mcp.{alias} and the broad wildcard mcp.* are not valid MCP call-site declarations.listServers() | mcp.discover |
mcp.platform.{serverName} | |
mcp.org.{serverId} | |
mcp.adhoc.{connectionName} | |
mcp.adhoc.{connectionName} and oauth.token |
callTool('vfs', ...) uses mcp.platform.vfs.connect('bigquery', { mcpServerId: 'abc-123' }) uses mcp.org.abc-123. The local alias bigquery does not change that authority.gh uses mcp.adhoc.gh; if it uses OAuth, it also requires oauth.token.connect(), listTools() and callTool() for that connection. Prefer exact declarations. A portable Application that discovers Organization servers whose IDs are not known at authoring time may declare mcp.org.*; because wildcard declarations are not pre-granted in the ask-once batch, the User still decides each concrete Organization server when first used.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.