1. Conduid
  2. Developer Tools
  3. Ainu
MCP server · Developer Tools

Ainu

AI framework

Unclaimed last commit a year ago devtools
41Fair

Scored 5 months ago · breakdown

About Ainu

Ainu is an MCP server published by AINU-Labs in the Developer Tools category: aI framework.

The repository has 1 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/AINU-Labs/ainu

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Ainu

Powered by Claude · Grounded in docs

I know everything about Ainu. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 7 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

AINU

AINU Banner

An unopinionated and easily extensible ai framework

CA: BKNdE8ZRe1cWPYRVytrwy3mUaCw95aDfUqR9zwojbonk

Table of Contents


📚 Documentation

AINU provides comprehensive documentation to help you get started and dive deeper into the framework. Below is an overview of the available resources:

Documentation Type Description Link
TypeDocs Detailed API reference generated from the source code. Includes all classes, methods, and types used in AINU. Ideal for developers looking for in-depth technical details. TypeDocs
Overview Docs High-level documentation covering concepts, examples, and guides for using AINU. Perfect for understanding the framework and its use cases. Overview Docs

⚙️ Installation

ainu can be added to your project through npm.

npm i @ainulabs/ainu

🚀 Getting Started

🛠️ Creating an Agent

Creating an Agent is super simple and only requires a single Provider to be supplied.

const provider = new Anthropic({ apikey: "your-api-key" });
const agent = new Agent({ provider });

💡 Basic Example

The following code is like the hello, world! of he ainu framework.

import { Agent, Anthropic, Tool } from "@ainu/ai";
import { z } from "zod";

async function main() {
  // create the model provider
  const provider = new Anthropic({
    apiKey: "your-api-key",
  });

  // create a simple tool
  const weather = new Tool("getWeather", {
    description: "Get the weather at a given location",
    parameters: z.object({ location: z.string() }),
    handler: ({ location }) => 100,
  });

  // create the agent
  const agent = new Agent({
    provider,
    tools: [tool],
    settings: {
      // optional agent settings
      system: "You are a helpful and charming assistant",
    },
  });

  // use the agent to generateText
  const response = await agent.generateText({
    prompt: "Hello, how are you?",
    maxSteps: 3,
  });

  console.log(response.data?.text);
}

main();

🧰 Tools

Tools can be provided in three ways:

  1. Through the constructor.
  2. By calling .putTool on an agent instance.
  3. By passing the tools parameter directly into a .generateText call.

The first two methods persist the tools in the agent's class, while the third method discards the tool after it is used.


Example 1: Providing Tools Through the Constructor

import z from "zod";
import { Agent } from "./agent";
import { Anthropic } from "./providers";
import { Tool } from "./tools";

const populationTool = new Tool("getPopulation", {
  description: "Get the population of any location",
  parameters: z.object({
    location: z.string(),
  }),
  handler: async (args) => {
    // call some external system
    return { population: 1000000 };
  },
});

const agent = new Agent({
  provider: new Anthropic({
    apiKey: "your-api-key",
  }),
  tools: [populationTool], // Add tools during agent creation
});

Example 2: Adding Tools Dynamically Using .putTool

import z from "zod";
import { Agent } from "./agent";
import { Anthropic } from "./providers";
import { Tool } from "./tools";

const populationTool = new Tool("getPopulation", {
  description: "Get the population of any location",
  parameters: z.object({
    location: z.string(),
  }),
  handler: async (args) => {
    // call some external system
    return { population: 1000000 };
  },
});

const agent = new Agent({
  provider: new Anthropic({
    apiKey: "your-api-key",
  }),
});

// Add the tool dynamically
agent.putTool(populationTool);

Example 3: Passing Tools Directly to .generateText

import z from "zod";
import { Agent } from "./agent";
import { Anthropic } from "./providers";
import { Tool } from "./tools";

const populationTool = new Tool("getPopulation", {
  description: "Get the population of any location",
  parameters: z.object({
    location: z.string(),
  }),
  handler: async (args) => {
    // call some external system
    return { population: 1000000 };
  },
});

const agent = new Agent({
  provider: new Anthropic({
    apiKey: "your-api-key",
  }),
});

// Use the tool directly in a generateText call
const result = await agent.generateText({
  prompt: "What is the population of the US?",
  tools: [populationTool], // Pass tools directly
});

These examples demonstrate the flexibility of tools in AINU. You can choose the method that best fits your use case, whether it's adding tools during agent creation, dynamically adding them later, or using them for specific tasks on the fly.

🔗 MCP Clients

You may also wish to supply your agent with access to an MCP server.

import { Agent, Anthropic, MCP } from "@ainu/ai";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import path from "path";

// Create a MCP instances and pass in the name, version and transport
const solanaMcpClient = new MCP({
  name: "Solana MCP Client",
  version: "1.0.0",
  transport: new StdioClientTransport({
    command: "node",
    args: ["dist/mcp/server.js"],
  }),
});

// Add one or more clients to your agent.
export const agent = new Agent({
  settings: {
    system: "You are a helpful assistant.",
    maxSteps: 5,
  },
  provider: new Anthropic({
    apiKey: "your-api-key",
  }),
  clients: [solanaMcpClient],
});

🤖 Social Agent (WIP)

This is just an example and none of the twitter functionality is actually complete here. I will create a seprate registry tools.

import { Agent, Anthropic, Tool } from "@ainu/ai";
import { input } from "@inquirer/prompts";
import "dotenv/config";
import z from "zod";

// Prep the tiny agent
const anthropic = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const agent = new Agent({
  provider: anthropic,
  settings: {
    maxSteps: 5 //required for the agent to chain tool calls and inference
  }
});

// create a loading function that gets all information relevant for to the agent
function mockLoadContext() {
  return {
    Name: "Artificial Inu",
    Age: 5,
    Location: "Solana",
    Interests: ["AI", "Blockchain", "Web3"],
    FavoriteColor: "Blue",
    FavoriteFood: "Pizza",
    mentions: [
      { from: "user1", text: "Hello, how are you?" },
      { from: "user2", text: "What is your favorite color?" },
      { from: "user3", text: "Do you like pizza?" },
    ],
    recentTweets: [
      { text: "Just had a great pizza!", date: "2023-10-01" },
      { text: "Loving the new AI features!", date: "2023-10-02" },
      { text: "Blockchain is the future!", date: "2023-10-03" },
    ],
  };
}

const loadContext = new Tool("loadContext", {
  description:
    "Load the context before writing a tweet. Must be called before calling 'tweet'. Return the context as a string.",
  handler: () => ({ context: formatContext(mockLoadContext()) }),
});

// add the tool to the agent
agent.putTool(loadContext);

// create a tool that posts tweets. Here you would use the twitter-sdk
const tweet = new Tool("tweet", {
  description: "Post a tweet to Twitter. ",
  parameters: z.object({
    context: z.string();
  }),
  handler: async ({context}) => {
    const generateTweet = agent.generateText({
      prompt: `${context}
      # Task
      Your task is to generate compelling tweets based on all the information above`,
      maxSteps: 5,
      temperature: 0.7,
    });
  },
});

// Add the tool to the agent
agent.putTool(tweet);

async function main() {
  // Here if you ask the agent to write a tweet it will call the tweet tool
  const userMessage = await input({
    message: "You: ",
    validate: (input) => {
      return input.trim() !== "" ? true : "Please enter a message.";
    },
  });

  const response = await agent.generateText({
    prompt: userMessage,
  });

  // Check if the response is valid
  if (!response || !response.success) {
    console.error("Error:", response.error);
    return;
  }

  console.log(`Agent: ${response.data?.text}`);
}

main();

📝 Example Repositories

Example Repo's will be added to a list below.

README fetched from the repository 7 days ago. The original is authoritative.

Questions

About Ainu

How do I install Ainu?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Ainu safe to use with an AI agent?

Its trust score is 41 out of 100 (fair). It passes 4 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Ainu still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.