diff --git a/knowledge base/ai/README.md b/knowledge base/ai/README.md index b0fcb16..950c180 100644 --- a/knowledge base/ai/README.md +++ b/knowledge base/ai/README.md @@ -18,6 +18,7 @@ TODO ## Further readings - [Large Language Model] (LLM) +- [Model Context Protocol] (MCP) - [Useful AI]: tools, courses, and more, curated and reviewed by experts. ### Sources @@ -29,7 +30,8 @@ TODO -[Large Language Model]: large%20language%20model.md +[Large Language Model]: llm.md +[Model Context Protocol]: mcp.md diff --git a/knowledge base/ai/agent.md b/knowledge base/ai/agent.md index 4490fc8..917bcaf 100644 --- a/knowledge base/ai/agent.md +++ b/knowledge base/ai/agent.md @@ -124,7 +124,7 @@ See [An AI Agent Published a Hit Piece on Me] by Scott Shambaugh. [Claude Code]: claude/claude%20code.md [Gemini CLI]: gemini/cli.md -[Large Language Model]: large%20language%20model.md +[Large Language Model]: llm.md [OpenCode]: opencode.md diff --git a/knowledge base/ai/claude/README.md b/knowledge base/ai/claude/README.md index c36fbe7..8824170 100644 --- a/knowledge base/ai/claude/README.md +++ b/knowledge base/ai/claude/README.md @@ -62,7 +62,7 @@ AI platform built by Anthropic. [Gemini]: ../gemini/README.md -[Large Language Model]: ../large%20language%20model.md +[Large Language Model]: ../llm.md diff --git a/knowledge base/ai/claude/claude code.md b/knowledge base/ai/claude/claude code.md index fff051a..f8fc028 100644 --- a/knowledge base/ai/claude/claude code.md +++ b/knowledge base/ai/claude/claude code.md @@ -9,6 +9,8 @@ Works in a terminal, IDE, browser, and as a desktop app. ## Table of contents 1. [TL;DR](#tldr) +1. [Grant access to tools](#grant-access-to-tools) +1. [Using skills](#using-skills) 1. [Run on local models](#run-on-local-models) 1. [Further readings](#further-readings) 1. [Sources](#sources) @@ -25,7 +27,7 @@ When multiple scopes are active, the **more** specific ones take precedence. | Scope | Location | Area of effect | Shared | | ----------------------- | ------------------------------------ | ---------------------------------- | ----------------------------------------- | | Managed (A.K.A. System) | System-level `managed-settings.json` | All users on the host | Yes (usually deployed by IT) | -| User | `~/.claude/` directory | Single user, across all projects | No | +| User | `$HOME/.claude/` directory | Single user, across all projects | No | | Project | `.claude/` directory in a repository | All collaborators, repository only | Yes (usually committed to the repository) | | Local | `.claude/*.local.*` files | Single user, repository only | No (usually gitignored) | @@ -58,8 +60,24 @@ claude -c # Resume a previous conversation claude -r -# Add MCPs -claude mcp add --transport 'sse' 'linear-server' 'https://mcp.linear.app/sse' +# Add MCP servers. +# Defaults to the 'local' scope if not specified. +claude mcp add --transport 'http' 'linear' 'https://mcp.linear.app/mcp' --scope 'user' + +# List configured MCP servers. +claude mcp list + +# Show MCP servers' details +claude mcp get 'github' + +# Remove MCP servers. +claude mcp remove 'github' +``` + +From within Claude Code: + +```plaintext +/mcp ``` @@ -75,6 +93,126 @@ ANTHROPIC_AUTH_TOKEN='ollama' ANTHROPIC_BASE_URL='http://localhost:11434' ANTHRO +## Grant access to tools + +Add MCP servers to give Claude Code access to tools, databases, and APIs in general. + +> [!caution] +> MCPs are **not** verified, nor otherwise checked for security issues.
+> Be especially careful when using MCP servers that cat fetch untrusted content, as they can fall victim of prompt +> injections. + +Procedure: + +1. Add the desired MCP server. + +
+ Examples + + ```sh + claude mcp add --transport 'http' 'linear' 'https://mcp.linear.app/mcp' --scope 'user' + ``` + +1. From within Claude Code, run the `/mcp` command to configure it. + +
+ AWS API MCP server + +Refer [AWS API MCP Server]. + +Enables AI assistants to interact with AWS services and resources through AWS CLI commands. + +
+ Run as Docker container + +Manually add the MCP server definition to `$HOME/.claude.json`: + +```json +{ + "mcpServers": { + "aws-api": { + "command": "docker", + "args": [ + "run", + "--rm", + "--interactive", + "--env", + "AWS_REGION=eu-west-1", + "--env", + "AWS_API_MCP_TELEMETRY=false", + "--env", + "REQUIRE_MUTATION_CONSENT=true", + "--env", + "READ_OPERATIONS_ONLY=true", + "--volume", + "/Users/yourUserHere/.aws:/app/.aws", + "public.ecr.aws/awslabs-mcp/awslabs/aws-api-mcp-server:latest" + ] + } + } +} +``` + +
+ +
+ +
+ AWS Cost Explorer MCP server + +Refer [Cost Explorer MCP Server]. + +Enables AI assistants to analyze AWS costs and usage data through the AWS Cost Explorer API. + +
+ Run as Docker container + +FIXME: many of those environment variable are probably unnecessary here. + +Manually add the MCP server definition to `$HOME/.claude.json`: + +```json +{ + "mcpServers": { + "aws-cost-explorer": { + "command": "docker", + "args": [ + "run", + "--rm", + "--interactive", + "--env", + "AWS_REGION=eu-west-1", + "--env", + "AWS_API_MCP_TELEMETRY=false", + "--env", + "REQUIRE_MUTATION_CONSENT=true", + "--env", + "READ_OPERATIONS_ONLY=true", + "--volume", + "/Users/yourUserHere/.aws:/app/.aws", + "public.ecr.aws/awslabs-mcp/awslabs/cost-explorer-mcp-server:latest" + ] + } + } +} +``` + +
+ +
+ +## Using skills + +Claude Code automatically discovers skills from: + +- The user's `$HOME/.claude/skills/` directory, and sets them up as user-level skills. +- The project's `.claude/skills/` folder, and sets them up as project-level skills. + +User-level skills are available in all projects.
+Project-level skills are limited to the current project. + +Claude Code activates relevant skills automatically based on the request context. + ## Run on local models Claude _can_ use other models and engines by setting the `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL` and @@ -154,4 +292,6 @@ Claude Code version: `v2.1.41`.
[Website]: https://claude.com/product/overview +[AWS API MCP Server]: https://github.com/awslabs/mcp/tree/main/src/aws-api-mcp-server +[Cost Explorer MCP Server]: https://github.com/awslabs/mcp/tree/main/src/cost-explorer-mcp-server [pffigueiredo/claude-code-sheet.md]: https://gist.github.com/pffigueiredo/252bac8c731f7e8a2fc268c8a965a963 diff --git a/knowledge base/ai/gemini/README.md b/knowledge base/ai/gemini/README.md index 8753281..7b3fa65 100644 --- a/knowledge base/ai/gemini/README.md +++ b/knowledge base/ai/gemini/README.md @@ -64,7 +64,7 @@ Intro [Claude]: ../claude/README.md [CLI]: cli.md -[Large Language Model]: ../large%20language%20model.md +[Large Language Model]: ../llm.md diff --git a/knowledge base/ai/large language model.md b/knowledge base/ai/llm.md similarity index 100% rename from knowledge base/ai/large language model.md rename to knowledge base/ai/llm.md diff --git a/knowledge base/ai/mcp.md b/knowledge base/ai/mcp.md new file mode 100644 index 0000000..e3b4fcf --- /dev/null +++ b/knowledge base/ai/mcp.md @@ -0,0 +1,84 @@ +# Model Context Protocol + +Open protocol enabling seamless integration between AI applications and external data sources and tools by providing +a standardized way to enable LLMs to access key information and perform tasks. + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + +MCP consists of: + +- The _data_ layer, defining the JSON-RPC based protocol for client-server communication.
+ It includes lifecycle management and core primitives, e.g. tools, resources, prompts and notifications. +- The _transport_ layer, defining the communication mechanisms and channels that enable data exchange between clients + and servers.
+ It includes transport-specific connection establishment, message framing, and authorization. + +MCP _hosts_ are AI applications users can interact with, and that coordinate and manage one or more MCP clients.
+MCP _clients_ are components that connect to a single MCP server to gather context from it for the host to use.
+MCP _servers_ are applications providing context data to one or more MCP clients. + +MCP hosts create one MCP client for each MCP server they use.
+Each client maintains a dedicated connection with its corresponding server. + +Servers provide functionality through _tools_, _resources_, and _prompts_.
+_Tools_ are functions that an LLM can **actively** call to take actions, i.e. writing to databases, calling external +APIs, modifying files, or triggering other logic. The LLM decides when to use them based on user requests.
+_Resources_ are **passive** data sources providing **read-only** access to information for context, such as files, +database schemas, or API documentation.
+_Prompts_ are pre-built instruction templates telling the model reading them how to work with specific tools and +resources. + +Clients _can_ provide features to servers, aside from making use of the context they provide.
+Client features allow server authors to build richer interactions through _elicitation_, _roots_, and _sampling_. +_Elicitation_ enables servers to request specific information from users.
+_Roots_ define filesystem boundaries for server operations, allowing clients to specify which folders servers should +focus on.
+_Sampling_ allows servers to request LLM completions through the client. This is what enables an agentic workflow. + +MCP uses string-based version identifiers that follow the `YYYY-MM-DD` format.
+Versions indicate the **last** date that backwards incompatible changes were made in the protocol. + +Version negotiation happens during initialization.
+Clients and servers _may_ support multiple protocol versions simultaneously, but they _**must**_ agree on a single +version to use for the session.
+The protocol provides error handling if version negotiation fails, which allows clients to gracefully terminate +connections when they cannot find a version compatible with the server. + +MCP servers of interest: + +| MCP server | Summary | +| ------------------------------------------------- | ------------------------------------------------------ | +| [AWS API][aws api mcp server] | Interact with all available AWS services and resources | +| [AWS Cost Explorer][aws cost explorer mcp server] | Analyze AWS costs and usage data | + +## Further readings + +- [Website] +- [Codebase] +- [Blog] + +### Sources + +- [Documentation] + + + + + + + +[Blog]: https://blog.modelcontextprotocol.io/ +[Codebase]: https://github.com/modelcontextprotocol +[Documentation]: https://modelcontextprotocol.io/docs/ +[Website]: https://modelcontextprotocol.io + + +[AWS API MCP Server]: https://github.com/awslabs/mcp/tree/main/src/aws-api-mcp-server +[AWS Cost Explorer MCP Server]: https://github.com/awslabs/mcp/tree/main/src/cost-explorer-mcp-server diff --git a/knowledge base/ai/use a local llm for coding assistance in vscode.md b/knowledge base/ai/use a local llm for coding assistance in vscode.md index f7218bc..4a076e3 100644 --- a/knowledge base/ai/use a local llm for coding assistance in vscode.md +++ b/knowledge base/ai/use a local llm for coding assistance in vscode.md @@ -127,7 +127,7 @@ [Docker]: ../docker.md [Docker Running LLMs locally]: ../docker.md#running-llms-locally -[Large Language Model]: large%20language%20model.md +[Large Language Model]: llm.md [Ollama]: ollama.md diff --git a/knowledge base/jargon.md b/knowledge base/jargon.md index 3032470..11a5458 100644 --- a/knowledge base/jargon.md +++ b/knowledge base/jargon.md @@ -5,10 +5,10 @@ | Acronym | Expansion | Summary | | ------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------- | | ACK | ACKnowledgement | | -| ACL | [Access Control List][acl] | | +| ACL | [Access Control List] | | | ACME | [Automatic Certificate Management Environment] | Protocol to automate the issuance and renewal of certificates without human interaction | | AD | Active Directory | | -| ADR | [Architectural Decision Record][adr] | | +| ADR | [Architectural Decision Record] | | | API | Application Programming Interface | A way for two or more computer programs or components to communicate with each other | | APK | Alpine Package Keeper | Package manager used by Alpine Linux | | APT | Advanced Package Tool | Package manager used by Debian Linux | @@ -32,7 +32,7 @@ | CMS | Content Management System | | | CN | Canonical Name | In Active Directory, the full path of an object in a canonical format | | CN | Common Name | In Active Directory, the last element in an object's Distinguished Name (DN) hierarchy | -| CNI | [Container Network Interface][cni] | | +| CNI | [Container Network Interface] | | | COTS | Commercial Off-The-Shelf | Available _as-is_, not optimized for specific scopes or objectives | | CSMA | Carrier-Sense Multiple Access | | | CSMA/CD | Carrier-Sense Multiple Access with Collision Detection | | @@ -92,6 +92,7 @@ | LIFO | Last In First Out | | | LLM | [Large Language Model] | | | M2COTS | Mass Market COTS | Widely available COTS products | +| MCP | [Model Context Protocol] | | | MR | Merge Request | Prevalently used in GitLab | | NACL | Network ACL | | | NIST | National Institute of Science and Technology | | @@ -172,18 +173,19 @@ --> -[acl]: acl.md -[adr]: adr.md +[Access Control List]: acl.md +[Architectural Decision Record]: adr.md [bash]: bash.md -[cni]: cni.md +[Container Network Interface]: cni.md [data warehouse]: data%20warehouse.md [depin]: depin.md [fhs]: filesystem%20hierarchy%20standard.md [fish]: fish.md [iac]: iac.md [kubernetes]: kubernetes/README.md -[Large Language Model]: ai/large%20language%20model.md +[Large Language Model]: ai/llm.md [lora]: lora.md +[Model Context Protocol]: ai/mcp.md [siem]: siem.md [snowflake]: snowflake/README.md [ssh]: ssh.md