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:
examples/quickstart_server.ipynb- Run on machine exposing toolsexamples/quickstart_client.ipynb- Run on machine executing agents
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentic_ai_mcp-0.5.4.tar.gz.
File metadata
- Download URL: agentic_ai_mcp-0.5.4.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4383eb3e08e4e999a9a20ae5ccbcf8cde70817371cb734059fb6ae13428f5546
|
|
| MD5 |
c3d1124a5ff9c8cb6b9d5dc66bd26b01
|
|
| BLAKE2b-256 |
60cafea75e40d88119db848b6884e692f7e30f336b0719fc331bf6f0b664af07
|
Provenance
The following attestation bundles were made for agentic_ai_mcp-0.5.4.tar.gz:
Publisher:
cd.yml on hasanjawad001/agentic-ai-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentic_ai_mcp-0.5.4.tar.gz -
Subject digest:
4383eb3e08e4e999a9a20ae5ccbcf8cde70817371cb734059fb6ae13428f5546 - Sigstore transparency entry: 1004977698
- Sigstore integration time:
-
Permalink:
hasanjawad001/agentic-ai-mcp@8326c8cadb88eb9fea3e0c71b859794f20e73684 -
Branch / Tag:
refs/tags/v0.5.4 - Owner: https://github.com/hasanjawad001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@8326c8cadb88eb9fea3e0c71b859794f20e73684 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agentic_ai_mcp-0.5.4-py3-none-any.whl.
File metadata
- Download URL: agentic_ai_mcp-0.5.4-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97076ab1af6fb896f26c33bdbe36dfc72d7c26a92bb547db62d39d515f2660a5
|
|
| MD5 |
300d2fca936fb75a01d5cc3ce478fa17
|
|
| BLAKE2b-256 |
0174160f7465f364a980f07721dd54b487132c12bc3fac35abb69fa755ce143a
|
Provenance
The following attestation bundles were made for agentic_ai_mcp-0.5.4-py3-none-any.whl:
Publisher:
cd.yml on hasanjawad001/agentic-ai-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentic_ai_mcp-0.5.4-py3-none-any.whl -
Subject digest:
97076ab1af6fb896f26c33bdbe36dfc72d7c26a92bb547db62d39d515f2660a5 - Sigstore transparency entry: 1004977745
- Sigstore integration time:
-
Permalink:
hasanjawad001/agentic-ai-mcp@8326c8cadb88eb9fea3e0c71b859794f20e73684 -
Branch / Tag:
refs/tags/v0.5.4 - Owner: https://github.com/hasanjawad001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@8326c8cadb88eb9fea3e0c71b859794f20e73684 -
Trigger Event:
release
-
Statement type: