### Install and Start Taiga MCP Server Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Instructions for cloning the repository, installing dependencies, configuring the server via .env, and starting the server in different transport modes (stdio, SSE, Streamable HTTP). ```bash git clone https://github.com/TETRA-2023/pytaiga-mcp.git cd pytaiga-mcp ./install.sh # production deps ./install.sh --dev # add pytest, ruff, mypy, pre-commit cat > .env <<'EOF' TAIGA_API_URL=https://taiga.mycompany.com TAIGA_USERNAME=admin TAIGA_PASSWORD=secret TAIGA_TRANSPORT=stdio LOG_LEVEL=INFO EOF # Start in stdio mode (default — for Claude Code / Cursor) uv run python src/server.py # Start in SSE mode (web-based clients) uv run python src/server.py --sse # Start in Streamable HTTP mode (stateless deployments) uv run python src/server.py --streamable-http ``` ```bash # Run via Docker (stdio) docker run -i --rm \ -e TAIGA_API_URL=https://taiga.mycompany.com \ -e TAIGA_USERNAME=admin \ -e TAIGA_PASSWORD=secret \ ghcr.io/tetra-2023/pytaiga-mcp:latest # Run via Docker (SSE on port 8000) docker run --rm \ -e TAIGA_API_URL=https://taiga.mycompany.com \ -e TAIGA_USERNAME=admin \ -e TAIGA_PASSWORD=secret \ -p 8000:8000 \ ghcr.io/tetra-2023/pytaiga-mcp:latest --sse ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Install project dependencies using the provided install script. Use the --dev flag for development tools. ```bash ./install.sh # For development: ./install.sh --dev ``` -------------------------------- ### Echo Server Example Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md A simple server demonstrating resources, tools, and prompts. ```APIDOC ## Echo Server A simple server demonstrating resources, tools, and prompts: ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("Echo") @mcp.resource("echo://{message}") def echo_resource(message: str) -> str: """Echo a message as a resource""" return f"Resource echo: {message}" @mcp.tool() def echo_tool(message: str) -> str: """Echo a message as a tool""" return f"Tool echo: {message}" @mcp.prompt() def echo_prompt(message: str) -> str: """Create an echo prompt""" return f"Please process this message: {message}" ``` ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/CLAUDE.md Installs the project with development dependencies including linters, formatters, and testing tools. Ensure the .env file is configured before running. ```bash ./install.sh --dev ``` -------------------------------- ### Install Server in Claude Desktop Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Install the developed server into Claude Desktop using the `mcp install` command. Environment variables can be passed using `-v` or loaded from a file using `-f`. ```bash mcp install server.py # Custom name mcp install server.py --name "My Analytics Server" # Environment variables mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://... mcp install server.py -f .env ``` -------------------------------- ### Manual Production Installation Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Manually install production dependencies using uv pip. ```bash uv pip install -e . ``` -------------------------------- ### Set Up Pre-commit Hooks Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Install and configure pre-commit hooks to automatically run linting and tests before each commit. ```bash # Set up pre-commit hooks uv run pre-commit install ``` -------------------------------- ### Manual Development Installation Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Manually install both production and development dependencies using uv pip. ```bash uv pip install -e ".[dev]" ``` -------------------------------- ### Claude Desktop Integration Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Once your server is ready, install it in Claude Desktop. ```APIDOC ## Claude Desktop Integration Once your server is ready, install it in Claude Desktop: ```bash mcp install server.py # Custom name mcp install server.py --name "My Analytics Server" # Environment variables mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://... mcp install server.py -f .env ``` ``` -------------------------------- ### Create a simple MCP server with tools and resources Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md This example demonstrates creating a basic MCP server using FastMCP, adding an addition tool, and a dynamic greeting resource. ```python # server.py from mcp.server.fastmcp import FastMCP # Create an MCP server mcp = FastMCP("Demo") # Add an addition tool @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers""" return a + b # Add a dynamic greeting resource @mcp.resource("greeting://{name}") def get_greeting(name: str) -> str: """Get a personalized greeting""" return f"Hello, {name}!" ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Install development-specific dependencies required for contributing to the project. ```bash # Install development dependencies ./install.sh --dev ``` -------------------------------- ### Install an MCP server for Claude Desktop Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Use the mcp command to install a local Python file as an MCP server for use with Claude Desktop. ```bash mcp install server.py ``` -------------------------------- ### Echo Server Example Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md A basic Echo server demonstrating the implementation of resources, tools, and prompts within the MCP framework. ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("Echo") @mcp.resource("echo://{message}") def echo_resource(message: str) -> str: """Echo a message as a resource""" return f"Resource echo: {message}" @mcp.tool() def echo_tool(message: str) -> str: """Echo a message as a tool""" return f"Tool echo: {message}" @mcp.prompt() def echo_prompt(message: str) -> str: """Create an echo prompt""" return f"Please process this message: {message}" ``` -------------------------------- ### Complete Project Creation Workflow with Pytaiga-MCP Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md This example demonstrates a full workflow: initializing the client, logging in, creating a project, creating an epic within that project, and creating a user story associated with the epic, followed by logging out. ```python from mcp.client import Client # Initialize MCP client client = Client() # Authenticate and get session ID auth_result = client.call_tool("login", { "username": "admin", "password": "password123", "host": "https://taiga.mycompany.com" }) session_id = auth_result["session_id"] # Create a new project project = client.call_tool("create_project", { "session_id": session_id, "name": "My New Project", "description": "A test project created via MCP" }) project_id = project["id"] # Create an epic epic = client.call_tool("create_epic", { "session_id": session_id, "project_id": project_id, "subject": "User Authentication", "description": "Implement user authentication features" }) epic_id = epic["id"] # Create a user story in the epic story = client.call_tool("create_user_story", { "session_id": session_id, "project_id": project_id, "subject": "User Login", "description": "As a user, I want to log in with my credentials", "epic_id": epic_id }) # Logout when done client.call_tool("logout", {"session_id": session_id}) ``` -------------------------------- ### Initialize and Use MCP Client Session Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Demonstrates initializing an MCP client session, listing prompts, getting a prompt, listing resources, listing tools, reading a resource, and calling a tool. Includes an optional sampling callback. ```python async def handle_sampling_message( message: types.CreateMessageRequestParams, ) -> types.CreateMessageResult: return types.CreateMessageResult( role="assistant", content=types.TextContent( type="text", text="Hello, world! from model", ), model="gpt-3.5-turbo", stopReason="endTurn", ) async def run(): async with stdio_client(server_params) as (read, write): async with ClientSession( read, write, sampling_callback=handle_sampling_message ) as session: # Initialize the connection await session.initialize() # List available prompts prompts = await session.list_prompts() # Get a prompt prompt = await session.get_prompt( "example-prompt", arguments={"arg1": "value"} ) # List available resources resources = await session.list_resources() # List available tools tools = await session.list_tools() # Read a resource content, mime_type = await session.read_resource("file://some/path") # Call a tool result = await session.call_tool("tool-name", arguments={"arg1": "value"}) if __name__ == "__main__": import asyncio asyncio.run(run()) ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/CLAUDE.md Copies the example environment file to .env. This file should be configured with your Taiga API URL, username, and password. ```bash cp .env.example .env ``` -------------------------------- ### Run PyTaiga-MCP Server Manually with UV Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Manually start the PyTaiga-MCP server using 'uv'. This allows specifying the transport mode, defaulting to stdio. ```bash # For stdio transport (default) uv run python src/server.py # For SSE transport uv run python src/server.py --sse ``` -------------------------------- ### Install MCP with pip Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Install the MCP package using pip for projects that manage dependencies with pip. ```bash pip install mcp ``` -------------------------------- ### Install MCP with CLI support Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Use uv to add the MCP package with command-line interface support to your Python project. ```bash uv add "mcp[cli]" ``` -------------------------------- ### Run MCP Server with Standard IO Transport Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/CLAUDE.md Starts the MCP server using the standard input/output transport. This is the default method for running the server. ```bash ./run.sh ``` -------------------------------- ### Python Client Auto-Authentication Example Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Demonstrates using the Python client with auto-authentication enabled via environment variables. No explicit login is required for tool calls. ```python # No login needed - uses auto-authenticated default session projects = client.call_tool("list_projects", {}) stories = client.call_tool("list_user_stories", {"project_id": 123}) new_story = client.call_tool("create_user_story", { "project_id": 123, "subject": "New feature request" }) ``` -------------------------------- ### Clone Taiga MCP Bridge Repository Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Clone the repository to get started with the Taiga MCP Bridge project. ```bash git clone https://github.com/TETRA-2023/pytaiga-mcp.git cd pytaiga-mcp ``` -------------------------------- ### Low-Level Server with Lifespan API Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md This example shows how to use the low-level `Server` implementation directly, including managing server startup and shutdown lifecycle using the lifespan API. It requires `asynccontextmanager` and `AsyncIterator` from `typing`. ```python from contextlib import asynccontextmanager from typing import AsyncIterator from fake_database import Database # Replace with your actual DB type from mcp.server import Server @asynccontextmanager async def server_lifespan(server: Server) -> AsyncIterator[dict]: """Manage server startup and shutdown lifecycle.""" # Initialize resources on startup db = await Database.connect() try: yield {"db": db} finally: # Clean up on shutdown await db.disconnect() # Pass lifespan to server server = Server("example-server", lifespan=server_lifespan) # Access lifespan context in handlers @server.call_tool() async def query_db(name: str, arguments: dict) -> list: ctx = server.request_context db = ctx.lifespan_context["db"] return await db.query(arguments["query"]) ``` -------------------------------- ### Run MCP Server with SSE Transport Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/CLAUDE.md Starts the MCP server using the Server-Sent Events (SSE) transport. This is an alternative transport method. ```bash ./run.sh --sse ``` -------------------------------- ### Get Wiki Page by Slug Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Retrieves a specific wiki page using its project ID and slug. ```APIDOC ## get_wiki_page_by_slug ### Description Get wiki page by slug. ### Method client.call_tool ### Parameters - **project_id** (integer) - Required - The ID of the project. - **slug** (string) - Required - The slug of the wiki page to retrieve. ``` -------------------------------- ### Environment Variables Configuration (.env file) Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Example of setting PyTaiga-MCP configuration options using a .env file. This method is an alternative to setting environment variables directly in the shell. ```dotenv TAIGA_API_URL=https://api.taiga.io/api/v1/ TAIGA_USERNAME=your_username TAIGA_PASSWORD=your_password TAIGA_TRANSPORT=stdio LOG_LEVEL=INFO ``` -------------------------------- ### List, Create, and Get User Stories Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Manage the lifecycle of user stories. Filtering options are available for listing, and creation supports optional fields via `kwargs`. Retrieval by `ref` is also supported. ```python # List user stories — filtered to a specific sprint and assignee stories = client.call_tool("list_user_stories", { "project_id": 1, "filters": '{"milestone": 5, "assigned_to": 12}', "verbosity": "minimal" }) # => [{"id": 101, "ref": 42, "subject": "User login", "status": 2, "project": 1}, ...] # Create a user story with optional fields story = client.call_tool("create_user_story", { "project_id": 1, "subject": "As a user, I want to reset my password", "kwargs": '{"description": "Forgot password flow", "tags": [["auth", "#FF0000"]], "milestone": 5}' }) # => {"id": 110, "ref": 50, "subject": "As a user, I want to reset my password", ...} # Get a user story by its UI ref number story = client.call_tool("get_user_story_by_ref", { "project_id": 1, "ref": 50, "verbosity": "full" }) # => {"id": 110, "ref": 50, ..., "tasks": [{"id": 201, "ref": 101, "subject": "..."}]} ``` -------------------------------- ### MCP Client Configuration for Stdio Transport Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Example JSON configuration for an MCP client to connect to PyTaiga-MCP using Docker for stdio transport. Environment variables are forwarded from the host. ```json { "mcpServers": { "taigaApi": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "TAIGA_API_URL", "-e", "TAIGA_USERNAME", "-e", "TAIGA_PASSWORD", "ghcr.io/tetra-2023/pytaiga-mcp:latest" ] } } } ``` -------------------------------- ### Complete Project Workflow - Python Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Orchestrates a multi-step project management workflow including project creation, epic and user story management, sprint setup, and task assignment. ```python # Full workflow: project setup → epics → user stories → sprint → assign from mcp.client import Client client = Client() # 1. Create project (auto-auth from environment) project = client.call_tool("create_project", { "name": "E-Commerce Platform", "description": "B2C online store with cart and checkout", "kwargs": '{"is_kanban_activated": true, "is_backlog_activated": true}' }) pid = project["id"] # 2. Create epics for major features auth_epic = client.call_tool("create_epic", {"project_id": pid, "subject": "Authentication", "kwargs": '{"color": "#8B5CF6"}'}) cart_epic = client.call_tool("create_epic", {"project_id": pid, "subject": "Shopping Cart", "kwargs": '{"color": "#F59E0B"}'}) checkout_epic = client.call_tool("create_epic", {"project_id": pid, "subject": "Checkout Flow", "kwargs": '{"color": "#10B981"}'}) # 3. Bulk create user stories stories = client.call_tool("bulk_create_user_stories", { "project_id": pid, "subjects": [ "User registration", "User login", "Password reset", "Add to cart", "Remove from cart", "View cart", "Enter shipping address", "Payment processing", "Order confirmation" ] }) story_ids = [s["id"] for s in stories] # 4. Link stories to epics client.call_tool("bulk_link_user_stories_to_epic", {"project_id": pid, "epic_id": auth_epic["id"], "user_story_ids": story_ids[0:3]}) client.call_tool("bulk_link_user_stories_to_epic", {"project_id": pid, "epic_id": cart_epic["id"], "user_story_ids": story_ids[3:6]}) client.call_tool("bulk_link_user_stories_to_epic", {"project_id": pid, "epic_id": checkout_epic["id"], "user_story_ids": story_ids[6:9]}) # 5. Create Sprint 1 for auth stories sprint = client.call_tool("create_milestone", { "project_id": pid, "name": "Sprint 1 — Auth", "estimated_start": "2025-07-01", "estimated_finish": "2025-07-14" }) # 6. Move auth stories into the sprint client.call_tool("bulk_update_user_story_milestone", { "project_id": pid, "milestone_id": sprint["id"], "bulk_stories": [{"us_id": story_ids[i], "order": i + 1} for i in range(3)] }) # 7. Get members and assign stories members = client.call_tool("get_project_members", {"project_id": pid}) dev_id = members[0]["user"] for i in range(3): client.call_tool("assign_user_story_to_user", {"user_story_id": story_ids[i], "user_id": dev_id}) ``` -------------------------------- ### Define Resources for Data Exposure Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Define resources using the @mcp.resource decorator to expose data to LLMs. Resources are similar to GET endpoints and should not have side effects. ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("My App") @mcp.resource("config://app") def get_config() -> str: """Static configuration data""" return "App configuration here" @mcp.resource("users://{user_id}/profile") def get_user_profile(user_id: str) -> str: """Dynamic user data""" return f"Profile data for user {user_id}" ``` -------------------------------- ### Read Taiga Projects with Verbosity Control Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Examples of listing all projects or retrieving a single project by ID or slug. The `verbosity` parameter controls the amount of data returned (`minimal`, `standard`, `full`). ```python # List all projects (standard verbosity) projects = client.call_tool("list_projects", {}) # => [{"id": 1, "name": "My Project", "slug": "my-project", "description": "...", ...}] # Get a single project by ID with minimal fields project = client.call_tool("get_project", { "project_id": 1, "verbosity": "minimal" }) # => {"id": 1, "name": "My Project", "slug": "my-project"} # Get a project by slug project = client.call_tool("get_project_by_slug", {"slug": "my-project"}) # => {"id": 1, "name": "My Project", "slug": "my-project", "description": "...", ...} ``` -------------------------------- ### Initialize FastMCP server with lifespan support Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Demonstrates initializing a FastMCP server with context management for startup and shutdown, including type hinting for database interactions. ```python # Add lifespan support for startup/shutdown with strong typing from contextlib import asynccontextmanager from dataclasses import dataclass from typing import AsyncIterator from fake_database import Database # Replace with your actual DB type from mcp.server.fastmcp import Context, FastMCP # Create a named server mcp = FastMCP("My App") ``` -------------------------------- ### MCP Server with Prompts and STDIO Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md This snippet demonstrates setting up an MCP server that handles prompt listing and retrieval, using the STDIO server implementation for communication. It requires `mcp.server.stdio`, `mcp.types`, and `mcp.server.lowlevel`. ```python import mcp.server.stdio import mcp.types as types from mcp.server.lowlevel import NotificationOptions, Server from mcp.server.models import InitializationOptions # Create a server instance server = Server("example-server") @server.list_prompts() async def handle_list_prompts() -> list[types.Prompt]: return [ types.Prompt( name="example-prompt", description="An example prompt template", arguments=[ types.PromptArgument( name="arg1", description="Example argument", required=True ) ], ) ] @server.get_prompt() async def handle_get_prompt( name: str, arguments: dict[str, str] | None ) -> types.GetPromptResult: if name != "example-prompt": raise ValueError(f"Unknown prompt: {name}") return types.GetPromptResult( description="Example prompt", messages=[ types.PromptMessage( role="user", content=types.TextContent(type="text", text="Example prompt text") ) ], ) async def run(): async with mcp.server.stdio.stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, InitializationOptions( server_name="example", server_version="0.1.0", capabilities=server.get_capabilities( notification_options=NotificationOptions(), experimental_capabilities={}, ), ), ) if __name__ == "__main__": import asyncio asyncio.run(run()) ``` -------------------------------- ### Get History Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Retrieves the complete change history for any Taiga object, including field modifications and status transitions. ```APIDOC ## get_history ### Description Retrieve the full change history for any Taiga object. ### Method client.call_tool ### Parameters - **object_id** (integer) - Required - The ID of the object to retrieve history for. - **object_type** (string) - Required - The type of the object (e.g., "user_story", "issue", "task", "wiki"). ``` -------------------------------- ### Manage Application Lifespan with Async Context Manager Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Define and manage the application's startup and shutdown lifecycle using an async context manager. This is useful for initializing resources like databases. ```python @dataclass class AppContext: db: Database @asynccontextmanager async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]: """Manage application lifecycle with type-safe context""" # Initialize on startup db = await Database.connect() try: yield AppContext(db=db) finally: # Cleanup on shutdown await db.disconnect() # Pass lifespan to server mcp = FastMCP("My App", lifespan=app_lifespan) # Access type-safe lifespan context in tools @mcp.tool() def query_db(ctx: Context) -> str: """Tool that uses initialized resources""" db = ctx.request_context.lifespan_context["db"] return db.query() ``` -------------------------------- ### Initialize FastMCP with Dependencies Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Initialize the FastMCP server specifying application dependencies for deployment. ```python mcp = FastMCP("My App", dependencies=["pandas", "numpy"]) ``` -------------------------------- ### create_project Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Creates a new project with specified details and configuration. ```APIDOC ## `create_project` ```python project = client.call_tool("create_project", { "name": "E-Commerce Platform", "description": "B2C online store with cart and checkout", "kwargs": '{"is_kanban_activated": true, "is_backlog_activated": true}' }) pid = project["id"] ``` ``` -------------------------------- ### Create Sprint (Milestone) Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Creates a new sprint, also referred to as a milestone, with a name and estimated start and finish dates. Dates must be in 'YYYY-MM-DD' format. ```python # Create a sprint sprint = client.call_tool("create_milestone", { "project_id": 1, "name": "Sprint 3 - Auth Features", "estimated_start": "2025-06-01", "estimated_finish": "2025-06-14" }) sprint_id = sprint["id"] ``` -------------------------------- ### Resources Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Resources are used to expose data to LLMs. They are similar to GET endpoints in a REST API, providing data without significant computation or side effects. ```APIDOC ## Resources Resources are how you expose data to LLMs. They're similar to GET endpoints in a REST API - they provide data but shouldn't perform significant computation or have side effects: ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("My App") @mcp.resource("config://app") def get_config() -> str: """Static configuration data""" return "App configuration here" @mcp.resource("users://{user_id}/profile") def get_user_profile(user_id: str) -> str: """Dynamic user data""" return f"Profile data for user {user_id}" ``` ``` -------------------------------- ### Build PyTaiga-MCP Docker Image Locally Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Build the PyTaiga-MCP Docker image from the source code in the current directory. ```bash docker build -t pytaiga-mcp . ``` -------------------------------- ### MCP Client STDIO Server Parameters Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md This snippet shows how to configure server parameters for establishing a STDIO connection to an MCP server using the client SDK. It requires `ClientSession`, `StdioServerParameters`, and `types` from `mcp`. ```python from mcp import ClientSession, StdioServerParameters, types from mcp.client.stdio import stdio_client # Create server parameters for stdio connection server_params = StdioServerParameters( command="python", # Executable args=["example_server.py"], # Optional command line arguments env=None, # Optional environment variables ) ``` -------------------------------- ### SQLite Explorer Resource and Tool Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md This snippet demonstrates how to create an MCP resource for fetching database schema and a tool for executing SQL queries. It requires the `sqlite3` module and `FastMCP` from `mcp.server.fastmcp`. ```python import sqlite3 from mcp.server.fastmcp import FastMCP mcp = FastMCP("SQLite Explorer") @mcp.resource("schema://main") def get_schema() -> str: """Provide the database schema as a resource""" conn = sqlite3.connect("database.db") schema = conn.execute("SELECT sql FROM sqlite_master WHERE type='table'").fetchall() return "\n".join(sql[0] for sql in schema if sql[0]) @mcp.tool() def query_data(sql: str) -> str: """Execute SQL queries safely""" conn = sqlite3.connect("database.db") try: result = conn.execute(sql).fetchall() return "\n".join(str(row) for row in result) except Exception as e: return f"Error: {str(e)}" ``` -------------------------------- ### Direct Execution Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md For advanced scenarios like custom deployments. ```APIDOC ## Direct Execution For advanced scenarios like custom deployments: ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("My App") if __name__ == "__main__": mcp.run() ``` Run it with: ```bash python server.py # or mcp run server.py ``` ``` -------------------------------- ### Development Mode Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md The fastest way to test and debug your server is with the MCP Inspector. ```APIDOC ## Development Mode The fastest way to test and debug your server is with the MCP Inspector: ```bash mcp dev server.py # Add dependencies mcp dev server.py --with pandas --with numpy # Mount local code mcp dev server.py --with-editable . ``` ``` -------------------------------- ### List, Create, and Get Tasks Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Perform full CRUD operations on tasks within user stories and sprints. Tasks can be filtered by various criteria including milestone, status, user story, or assignee. ```python # List tasks in a project filtered to a specific user story tasks = client.call_tool("list_tasks", { "project_id": 1, "filters": '{"user_story": 101}', "verbosity": "standard" }) # => [{"id": 201, "ref": 101, "subject": "Write unit tests", "status": 1, ...}] # Create a task linked to a user story and sprint task = client.call_tool("create_task", { "project_id": 1, "subject": "Write unit tests for login", "kwargs": '{"user_story": 101, "milestone": 5, "assigned_to": 12}' }) # Get task by UI ref number task = client.call_tool("get_task_by_ref", {"project_id": 1, "ref": 101}) ``` -------------------------------- ### Create Wiki Page Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Creates a new wiki page within a project, identified by a unique slug. ```APIDOC ## create_wiki_page ### Description Create a wiki page. ### Method client.call_tool ### Parameters - **project_id** (integer) - Required - The ID of the project. - **slug** (string) - Required - The unique slug for the wiki page. - **content** (string) - Required - The content of the wiki page in markdown format. ``` -------------------------------- ### Run Pre-commit Hooks Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Execute pre-commit hooks manually on all files to ensure code quality and style consistency. ```bash # Run pre-commit hooks on all files uv run pre-commit run --all-files ``` -------------------------------- ### Retrieve Object History Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Get the complete change history for issues, tasks, user stories, epics, and wiki pages using `get_history`. Requires `object_id` and `object_type`. The history includes changes to fields, status, assignments, and comments. ```python history = client.call_tool("get_history", { "object_id": 110, "object_type": "user_story" }) # => { # "object_type": "user_story", # "object_id": 110, # "history": [ # {"created_at": "2025-06-01T10:00:00Z", "user": {...}, # "diff": {"status": [1, 2]}, "comment": ""}, # {"created_at": "2025-06-02T09:30:00Z", "user": {...}, # "diff": {}, "comment": "Reviewed and approved"}, # ... # ] # } ``` -------------------------------- ### Run PyTaiga-MCP Server Script Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Execute the PyTaiga-MCP server using the provided run script. Supports default stdio transport or SSE transport via a flag. ```bash # Default stdio transport ./run.sh # For SSE transport ./run.sh --sse ``` -------------------------------- ### Bulk Create Tasks Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Allows for the creation of multiple tasks within a project, optionally linking them to a specific user story. ```APIDOC ## bulk_create_tasks ### Description Bulk create tasks within a sprint (milestone_id is required). ### Method client.call_tool ### Parameters - **project_id** (integer) - Required - The ID of the project. - **subjects** (list of strings) - Required - A list of task subjects to create. - **milestone_id** (integer) - Required - The ID of the milestone (sprint) to associate tasks with. - **user_story_id** (integer) - Optional - The ID of the user story to link the tasks to. ``` -------------------------------- ### Manage project membership Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Retrieve project members with specified verbosity and invite new users via email with a designated role. Bulk invitations are also supported. ```python # Get project members members = client.call_tool("get_project_members", {"project_id": 1, "verbosity": "standard"}) # => [{"id": 50, "user": 7, "full_name": "Alice Smith", "role_name": "Developer", ...}] ``` ```python # Invite a single user client.call_tool("invite_project_user", { "project_id": 1, "email": "bob@example.com", "role_id": members[0]["role"] }) ``` ```python # Bulk invite multiple users client.call_tool("bulk_create_memberships", { "project_id": 1, "members": [ {"email": "carol@example.com", "role_id": 5}, {"email": "dave@example.com", "role_id": 6} ] }) # => {"status": "invited", "project_id": 1, "members_invited": 2} ``` -------------------------------- ### Bulk Create User Stories Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Efficiently creates multiple user stories simultaneously by providing a list of subjects. This is significantly faster than individual creation calls for batch imports. ```python # Bulk create user stories stories = client.call_tool("bulk_create_user_stories", { "project_id": 1, "subjects": [ "User can register with email", "User can login with credentials", "User can reset forgotten password", "User can enable two-factor authentication" ], "verbosity": "minimal" }) ``` -------------------------------- ### Development Mode Server Execution Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Run the server in development mode using the `mcp dev` command for testing and debugging. Dependencies can be added using `--with` and local code can be mounted with `--with-editable`. ```bash mcp dev server.py # Add dependencies mcp dev server.py --with pandas --with numpy # Mount local code mcp dev server.py --with-editable . ``` -------------------------------- ### Run PyTaiga-MCP Docker with Environment Variables Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Execute the PyTaiga-MCP Docker container, providing necessary Taiga API credentials and URL via environment variables for stdio transport. ```bash docker run -i --rm \ -e TAIGA_API_URL=https://your-taiga-instance.com \ -e TAIGA_USERNAME=your_username \ -e TAIGA_PASSWORD=your_password \ ghcr.io/tetra-2023/pytaiga-mcp:latest ``` -------------------------------- ### MCP Client Configuration for Local Execution Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md JSON configuration for an MCP client to connect to a locally running PyTaiga-MCP server using 'uv' for stdio transport. Ensure to replace placeholders with actual values. ```json { "mcpServers": { "taigaApi": { "command": "uv", "args": [ "--directory", "", "run", "src/server.py" ], "env": { "TAIGA_TRANSPORT": "", "TAIGA_API_URL": "", "TAIGA_PASSWORD": "" } } } ``` -------------------------------- ### Develop an MCP server with the MCP Inspector Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Run an MCP server in development mode, allowing interaction and testing with the MCP Inspector. ```bash mcp dev server.py ``` -------------------------------- ### Inspect MCP in Development Mode Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Launch the inspector tool in development mode for enhanced debugging capabilities. ```bash # For development mode ./inspect.sh --dev ``` -------------------------------- ### Prompts Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Prompts are reusable templates that help LLMs interact with your server effectively. ```APIDOC ## Prompts Prompts are reusable templates that help LLMs interact with your server effectively: ```python from mcp.server.fastmcp import FastMCP, types mcp = FastMCP("My App") @mcp.prompt() def review_code(code: str) -> str: return f"Please review this code:\n\n{code}" @mcp.prompt() def debug_error(error: str) -> list[types.Message]: return [ types.UserMessage("I'm seeing this error:"), types.UserMessage(error), types.AssistantMessage("I'll help debug that. What have you tried so far?"), ] ``` ``` -------------------------------- ### Inspect MCP with SSE Transport Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Launch the inspector tool configured for Server-Sent Events (SSE) transport. ```bash # For SSE transport ./inspect.sh --sse ``` -------------------------------- ### Search Project by Text - Python Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Searches across all resource types within a project using a text query. Requires a project ID and the search text. ```python results = client.call_tool("search_project", { "project_id": 1, "text": "authentication" }) # => { # "count": 12, # "userstories": [{"id": 110, "ref": 50, "subject": "User Authentication System"}, ...], # "tasks": [{"id": 201, "ref": 101, "subject": "Write auth tests"}, ...], # "issues": [{"id": 55, "ref": 10, "subject": "Auth token expiry bug"}, ...], # "wikipages": [{"id": 20, "slug": "architecture-overview"}, ...], # "epics": [{"id": 10, "ref": 5, "subject": "User Authentication System"}] # } ``` -------------------------------- ### Run standalone MCP development tools Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Execute the mcp command-line tools within a uv-managed Python environment. ```bash uv run mcp ``` -------------------------------- ### Direct Server Execution Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Run the MCP server directly using Python or the `mcp run` command for custom deployments or advanced scenarios. ```python from mcp.server.fastmcp import FastMCP mcp = FastMCP("My App") if __name__ == "__main__": mcp.run() ``` ```bash python server.py # or mcp run server.py ``` -------------------------------- ### Inspect MCP with Default Transport Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Launch the inspector tool using the default stdio transport for debugging. ```bash # Default stdio transport ./inspect.sh ``` -------------------------------- ### Create, Update, and Delete Projects Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Use these methods to manage Taiga projects. Optional fields like privacy, Kanban, or tags must be passed as a JSON string within the `kwargs` parameter. ```python # Create a new Kanban project project = client.call_tool("create_project", { "name": "Mobile App", "description": "iOS and Android development", "kwargs": '{"is_private": true, "is_kanban_activated": true, "is_backlog_activated": false}' }) project_id = project["id"] # => {"id": 42, "name": "Mobile App", "slug": "mobile-app", ...} # Update project name and tags updated = client.call_tool("update_project", { "project_id": project_id, "kwargs": '{"name": "Mobile App v2", "tags": [["ios", "#FF5733"], ["android", "#33FF57"]]}' }) # Delete a project (irreversible) client.call_tool("delete_project", {"project_id": project_id}) # => {"status": "deleted", "project_id": 42} ``` -------------------------------- ### Tools Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/MCP_SDK.md Tools allow LLMs to take actions through your server. Unlike resources, tools are expected to perform computation and can have side effects. ```APIDOC ## Tools Tools let LLMs take actions through your server. Unlike resources, tools are expected to perform computation and have side effects: ```python import httpx from mcp.server.fastmcp import FastMCP mcp = FastMCP("My App") @mcp.tool() def calculate_bmi(weight_kg: float, height_m: float) -> float: """Calculate BMI given weight in kg and height in meters""" return weight_kg / (height_m**2) @mcp.tool() async def fetch_weather(city: str) -> str: """Fetch current weather for a city""" async with httpx.AsyncClient() as client: response = await client.get(f"https://api.weather.com/{city}") return response.text ``` ``` -------------------------------- ### Bulk Update User Story Milestone, Swimlane, and Order Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Manage user stories in bulk by moving them to a milestone, assigning them to a swimlane based on status, or reordering them in the backlog. Ensure correct `project_id` and relevant IDs (`milestone_id`, `status_id`, `swimlane_id`) are provided. ```python # Move multiple user stories into a sprint client.call_tool("bulk_update_user_story_milestone", { "project_id": 1, "milestone_id": 5, "bulk_stories": [ {"us_id": 110, "order": 1}, {"us_id": 111, "order": 2}, {"us_id": 112, "order": 3} ] }) # => {"status": "updated", "project_id": 1, "milestone_id": 5, "stories_moved": 3} # Bulk assign stories in "In Progress" status to the Backend swimlane client.call_tool("bulk_update_user_story_swimlane", { "project_id": 1, "status_id": 3, # "In Progress" status ID "swimlane_id": 3, # Backend swimlane "user_story_ids": [110, 111] }) # Reorder backlog client.call_tool("bulk_update_user_story_order", { "project_id": 1, "order_type": "backlog", "bulk_stories": [{"us_id": 112, "order": 1}, {"us_id": 110, "order": 2}] }) ``` -------------------------------- ### bulk_create_user_stories Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Creates multiple user stories in a project simultaneously. ```APIDOC ## `bulk_create_user_stories` ```python stories = client.call_tool("bulk_create_user_stories", { "project_id": pid, "subjects": [ "User registration", "User login", "Password reset", "Add to cart", "Remove from cart", "View cart", "Enter shipping address", "Payment processing", "Order confirmation" ] }) story_ids = [s["id"] for s in stories] ``` ``` -------------------------------- ### Pull PyTaiga-MCP Docker Image Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/README.md Use this command to download the latest pre-built PyTaiga-MCP Docker image from GHCR. ```bash docker pull ghcr.io/tetra-2023/pytaiga-mcp:latest ``` -------------------------------- ### Manage project configuration items Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Create, update, delete, and reorder project configuration items such as statuses, types, priorities, and severities. The `config_type` parameter must be one of the supported entity types. ```python # Create a new user story status status = client.call_tool("create_project_config", { "project_id": 1, "config_type": "userstory_status", "name": "In Review", "color": "#F59E0B", "is_closed": False, "order": 35 }) # => {"id": 15, "name": "In Review", "color": "#F59E0B", "is_closed": false, "order": 35} ``` ```python # Reorder statuses client.call_tool("bulk_update_order_project_config", { "project_id": 1, "config_type": "userstory_status", "bulk_orders": [[10, 1], [11, 2], [15, 3], [12, 4], [13, 5]] }) # => {"status": "updated", "config_type": "userstory_status", "items_reordered": 5} ``` ```python # Delete a status client.call_tool("delete_project_config", { "item_id": 15, "config_type": "userstory_status" }) ``` -------------------------------- ### create_epic Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Creates a new epic within a project. ```APIDOC ## `create_epic` ```python auth_epic = client.call_tool("create_epic", {"project_id": pid, "subject": "Authentication", "kwargs": '{"color": "#8B5CF6"}'}) ``` ``` -------------------------------- ### Create Feature Branch Source: https://github.com/tetra-2023/pytaiga-mcp/blob/master/CLAUDE.md Follows the convention for creating a new feature branch. Replace '' with a descriptive name for the feature. ```bash feature/ ``` -------------------------------- ### Bulk Creation Source: https://context7.com/tetra-2023/pytaiga-mcp/llms.txt Provides tools for bulk creation of multiple work items (user stories, tasks, issues, epics) at once from a list of subjects. ```APIDOC ## Bulk Creation ### Description Create multiple work items at once from a list of subjects. Dramatically faster than individual creation calls for batch imports. ### `bulk_create_user_stories` #### Description Bulk creates multiple user stories. #### Parameters - **project_id** (int) - Required - The ID of the project. - **subjects** (list[str]) - Required - A list of subjects for the user stories. - **verbosity** (str) - Optional - The level of detail to return (e.g., `"minimal"`). #### Request Example ```python client.call_tool("bulk_create_user_stories", { "project_id": 1, "subjects": [ "User can register with email", "User can login with credentials", "User can reset forgotten password", "User can enable two-factor authentication" ], "verbosity": "minimal" }) ``` ```