Skip to content

nanocoai/nanoclaw / .claude/skills/add-ollama-tool

add-ollama-tool

Verified

Add Ollama MCP server so the container agent can call local models and optionally manage the Ollama model library.

FileKindSize
REMOVE.mdmarkdown1.7 KB
SKILL.mdskill md11.8 KB
ollama-env.tsscript958 B
ollama-mcp-stdio.tsscript13.7 KB
ollama-registration.test.tsscript2.2 KB
ollama-wiring.test.tsscript2.1 KB

ollama-registration.test.ts

View on GitHub
/**
 * Wiring test for the MCP-server registration integration point (container/Bun tree).
 *
 * The handlers are exercised against a live Ollama daemon at build time, but that does
 * not prove the server is registered — delete the index.ts entry and the tool simply
 * never appears, yet any handler check stays green. index.ts is the container boot entry
 * and is not cheaply invocable, so we assert the registration structurally: the
 * `mcpServers` object literal has an `ollama` property whose command runs
 * `ollama-mcp-stdio.ts`.
 */
import fs from 'fs';
import path from 'path';

import { describe, it, expect } from 'bun:test';
import ts from 'typescript';

function sourceFile(): ts.SourceFile {
  const p = path.join(import.meta.dir, 'index.ts');
  return ts.createSourceFile(p, fs.readFileSync(p, 'utf8'), ts.ScriptTarget.Latest, true);
}

/** Find the object literal assigned to `const mcpServers = { ... }`. */
function mcpServersLiteral(sf: ts.SourceFile): ts.ObjectLiteralExpression | undefined {
  let found: ts.ObjectLiteralExpression | undefined;
  const visit = (node: ts.Node) => {
    if (
      ts.isVariableDeclaration(node) &&
      ts.isIdentifier(node.name) &&
      node.name.text === 'mcpServers' &&
      node.initializer &&
      ts.isObjectLiteralExpression(node.initializer)
    ) {
      found = node.initializer;
    }
    if (!found) ts.forEachChild(node, visit);
  };
  visit(sf);
  return found;
}

function property(obj: ts.ObjectLiteralExpression, name: string): ts.PropertyAssignment | undefined {
  return obj.properties.find(
    (p): p is ts.PropertyAssignment =>
      ts.isPropertyAssignment(p) &&
      ((ts.isIdentifier(p.name) && p.name.text === name) ||
        (ts.isStringLiteral(p.name) && p.name.text === name)),
  );
}

describe('index.ts registers the ollama MCP server', () => {
  const obj = mcpServersLiteral(sourceFile());

  it('finds the mcpServers object literal', () => {
    expect(obj).toBeDefined();
  });

  it('has an ollama entry', () => {
    expect(obj && property(obj, 'ollama')).toBeDefined();
  });

  it('points ollama at ollama-mcp-stdio.ts', () => {
    const entry = obj && property(obj, 'ollama');
    const text = entry ? entry.getText() : '';
    expect(text).toContain('ollama-mcp-stdio.ts');
  });
});
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall