Skip to main content

A lightweight agentic AI framework with MCP tool serving

Project description

Agentic AI MCP

Lightweight agentic AI with MCP tools. Supports multiple LLM providers (Anthropic, OpenAI) and distributed setups where tools run on one machine and agents on another.

Install

pip install agentic-ai-mcp

Setup

Set your API key in .env file (only needed on the client/agent machine):

# For Anthropic (default)
ANTHROPIC_API_KEY=sk-ant-...

# For OpenAI
OPENAI_API_KEY=sk-...

Quick Start

See the example notebooks:

Usage

Server Mode (expose tools)

Run this on the machine where you want to host tools:

from agentic_ai_mcp import AgenticAI

def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

def greet(name: str, times: int = 1) -> str:
    """Greet someone."""
    return ("Hello, " + name + "! ") * times

# Create agentic instance and register tools
ai = AgenticAI()
ai.register_tool(add)
ai.register_tool(greet)

# Start server
ai.run_mcp_server()

# Stop when done
ai.stop_mcp_server()

Client Mode (run agents)

Run this on another machine to connect to the server and execute agents:

from agentic_ai_mcp import AgenticAI

# Connect to remote MCP server 
ai = AgenticAI(mcp_url="http://<server-ip>:8888/mcp") ## default provider: Anthropic, use provider = 'openai' to use OpenAI 

# Simple agent workflow
result = await ai.run("Calculate 2+1, then use the result as the number of times to greet 'Alice'.")
print(result)

# Planning-based workflow for complex tasks
result = await ai.run_with_planning("Calculate ((0+2) + (1+1) + 1), then use the result as the number of times to greet 'Bob'.")
print(result)

Using OpenAI

from agentic_ai_mcp import AgenticAI

# Use OpenAI instead of Anthropic
ai = AgenticAI(
    mcp_url="http://<server-ip>:8888/mcp",
    provider="openai",
    model="gpt-4o-mini" ## or 'gpt-4o'/'gpt-4-turbo' etc.
)

result = await ai.run("Calculate -1+2")

Methods

Method Description
ai.register_tool(func) Register a function as an MCP tool
ai.run_mcp_server() Start MCP server in background
ai.stop_mcp_server() Stop the MCP server
ai.run(prompt) Simple agent workflow
ai.run_with_planning(prompt) Complex agent workflow

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentic_ai_mcp-0.5.3.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentic_ai_mcp-0.5.3-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file agentic_ai_mcp-0.5.3.tar.gz.

File metadata

  • Download URL: agentic_ai_mcp-0.5.3.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentic_ai_mcp-0.5.3.tar.gz
Algorithm Hash digest
SHA256 d4b9789eb6f3661cf0af9c0593a55d19fee6103d8c7aa9b22e400c97e327523c
MD5 0cf15dbb58b31980632ccf44d87d4f59
BLAKE2b-256 becea28a9e6035efc4feb1d87ff4684a2691ed21486ff46d758cfa67bbca6595

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.3.tar.gz:

Publisher: cd.yml on hasanjawad001/agentic-ai-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentic_ai_mcp-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: agentic_ai_mcp-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agentic_ai_mcp-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 31db9952259df0920f6d7335645beb9d1adc6f12ba847c0aa28752f08725494e
MD5 5d621e69d78b46cc13e5aee3003420a7
BLAKE2b-256 512623237becfa3e31dda3eebe82ba7067c0653282c597e456c163250f220627

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_ai_mcp-0.5.3-py3-none-any.whl:

Publisher: cd.yml on hasanjawad001/agentic-ai-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page